From 2e2dee33961a875c68ddb95c29131127c3b481da Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 19 Aug 2016 12:03:09 -0700 Subject: [PATCH] lint: Ban lines longer than 140 characters without #ignorelongline. --- bots/zephyr_mirror_backend.py | 2 +- tools/lint-all | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 72b28ef0b7..1b93ff1d3e 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -92,7 +92,7 @@ def different_paragraph(line, next_line): len(line) < len(words[0])) # Linewrapping algorithm based on: -# http://gcbenison.wordpress.com/2011/07/03/a-program-to-intelligently-remove-carriage-returns-so-you-can-paste-text-without-having-it-look-awful/ +# http://gcbenison.wordpress.com/2011/07/03/a-program-to-intelligently-remove-carriage-returns-so-you-can-paste-text-without-having-it-look-awful/ #ignorelongline def unwrap_lines(body): lines = body.split("\n") result = "" diff --git a/tools/lint-all b/tools/lint-all index 460e618f66..83500cb9d1 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -139,7 +139,8 @@ def build_custom_checkers(by_lang): print("Exception with %s at %s line %s" % (rule['pattern'], fn, i+1)) traceback.print_exc() if (max_length is not None and len(line) > max_length and - '# type' not in line and 'test' not in fn and 'example' not in fn): + '# type' not in line and 'test' not in fn and 'example' not in fn and + "#ignorelongline" not in line): print("Line too long (%s) at %s line %s: %s" % (len(line), fn, i+1, line_newline_stripped)) lastLine = line if lineFlag and '\n' not in lastLine: @@ -329,7 +330,7 @@ def build_custom_checkers(by_lang): failed = False for fn in by_lang['py']: - if custom_check_file(fn, python_rules, max_length=180): + if custom_check_file(fn, python_rules, max_length=140): failed = True return failed