Browse Source

px4moduledoc: extend validation: limit max line length to 120

sbg
Beat Küng 8 years ago
parent
commit
913cbc773e
  1. 17
      Tools/px4moduledoc/srcparser.py
  2. 2
      src/systemcmds/usb_connected/usb_connected.c

17
Tools/px4moduledoc/srcparser.py

@ -362,6 +362,23 @@ class SourceParser(object): @@ -362,6 +362,23 @@ class SourceParser(object):
print("Warning: undocumented command '%s' in %s" %(command, scope))
self._consistency_checks_failure = True
# limit the maximum line length in the module doc string
max_line_length = 120
module_doc = module_doc.documentation()
verbatim_mode = False
line_nr = 0
for line in module_doc.split('\n'):
line_nr += 1
if line.strip().startswith('```'):
# ignore preformatted blocks
verbatim_mode = not verbatim_mode
elif not verbatim_mode:
if not 'www.' in line and not 'http' in line:
if len(line) > max_line_length:
print('Line too long (%i > %i) in %s:' % (len(line), max_line_length, scope))
print(' '+line)
self._consistency_checks_failure = True
def _parse_arguments(self, contents, start_index):
"""

2
src/systemcmds/usb_connected/usb_connected.c

@ -51,7 +51,7 @@ __EXPORT int usb_connected_main(int argc, char *argv[]); @@ -51,7 +51,7 @@ __EXPORT int usb_connected_main(int argc, char *argv[]);
static void print_usage()
{
PRINT_MODULE_DESCRIPTION("Utility to check if USB is connected. Was previously used in startup scripts. "
PRINT_MODULE_DESCRIPTION("Utility to check if USB is connected. Was previously used in startup scripts.\n"
"A return value of 0 means USB is connected, 1 otherwise."
);

Loading…
Cancel
Save