@ -25,6 +25,7 @@ except ImportError:
argcomplete = None
argcomplete = None
from ansible import constants as C
from ansible import constants as C
from ansible . module_utils . six import string_types
BASE_DIR = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , ' .. ' , ' .. ' , ' .. ' ) )
BASE_DIR = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , ' .. ' , ' .. ' , ' .. ' ) )
CHANGELOG_DIR = os . path . join ( BASE_DIR , ' changelogs ' )
CHANGELOG_DIR = os . path . join ( BASE_DIR , ' changelogs ' )
@ -175,6 +176,8 @@ def load_plugins(version, force_reload):
LOGGER . info ( ' refreshing plugin cache ' )
LOGGER . info ( ' refreshing plugin cache ' )
plugins_data [ ' version ' ] = version
plugins_data [ ' version ' ] = version
plugins_data [ ' plugins ' ] = { }
for plugin_type in C . DOCUMENTABLE_PLUGINS :
for plugin_type in C . DOCUMENTABLE_PLUGINS :
plugins_data [ ' plugins ' ] [ plugin_type ] = json . loads ( subprocess . check_output ( [ os . path . join ( BASE_DIR , ' bin ' , ' ansible-doc ' ) ,
plugins_data [ ' plugins ' ] [ plugin_type ] = json . loads ( subprocess . check_output ( [ os . path . join ( BASE_DIR , ' bin ' , ' ansible-doc ' ) ,
' --json ' , ' -t ' , plugin_type ] ) )
' --json ' , ' -t ' , plugin_type ] ) )
@ -302,14 +305,26 @@ class ChangelogFragmentLinter(object):
errors = [ ]
errors = [ ]
for section , lines in fragment . content . items ( ) :
for section , lines in fragment . content . items ( ) :
if section not in self . config . sections :
if section == self . config . prelude_name :
errors . append ( ( fragment . path , 0 , 0 , ' invalid section: %s ' % section ) )
if not isinstance ( lines , string_types ) :
errors . append ( ( fragment . path , 0 , 0 , ' section " %s " must be type str not %s ' % ( section , type ( lines ) . __name__ ) ) )
else :
# doesn't account for prelude but only the RM should be adding those
if not isinstance ( lines , list ) :
errors . append ( ( fragment . path , 0 , 0 , ' section " %s " must be type list not %s ' % ( section , type ( lines ) . __name__ ) ) )
if section not in self . config . sections :
errors . append ( ( fragment . path , 0 , 0 , ' invalid section: %s ' % section ) )
if isinstance ( lines , list ) :
if isinstance ( lines , list ) :
for line in lines :
for line in lines :
if not isinstance ( line , string_types ) :
errors . append ( ( fragment . path , 0 , 0 , ' section " %s " list items must be type str not %s ' % ( section , type ( line ) . __name__ ) ) )
continue
results = rstcheck . check ( line , filename = fragment . path , report_level = docutils . utils . Reporter . WARNING_LEVEL )
results = rstcheck . check ( line , filename = fragment . path , report_level = docutils . utils . Reporter . WARNING_LEVEL )
errors + = [ ( fragment . path , 0 , 0 , result [ 1 ] ) for result in results ]
errors + = [ ( fragment . path , 0 , 0 , result [ 1 ] ) for result in results ]
else :
el if i sinstance( lin es, string_types ) :
results = rstcheck . check ( lines , filename = fragment . path , report_level = docutils . utils . Reporter . WARNING_LEVEL )
results = rstcheck . check ( lines , filename = fragment . path , report_level = docutils . utils . Reporter . WARNING_LEVEL )
errors + = [ ( fragment . path , 0 , 0 , result [ 1 ] ) for result in results ]
errors + = [ ( fragment . path , 0 , 0 , result [ 1 ] ) for result in results ]