diff --git a/tools/warn.py b/tools/warn.py index 5f796f528..97f54f9b4 100755 --- a/tools/warn.py +++ b/tools/warn.py @@ -27,6 +27,7 @@ import sys def main(): + """Old main() calls warn.warn.""" os.environ['PYTHONPATH'] = os.path.dirname(os.path.abspath(__file__)) subprocess.check_call(['/usr/bin/python3', '-m', 'warn.warn'] + sys.argv[1:]) diff --git a/tools/warn/android_project_list.py b/tools/warn/android_project_list.py index 82c0fbd63..8383dc0c3 100644 --- a/tools/warn/android_project_list.py +++ b/tools/warn/android_project_list.py @@ -17,6 +17,7 @@ def create_pattern(name, pattern=None): + """Return a tuple of name and warn patten.""" if pattern is not None: return [name, '(^|.*/)' + pattern + '/.*: warning:'] return [name, '(^|.*/)' + name + '/.*: warning:'] diff --git a/tools/warn/chrome_project_list.py b/tools/warn/chrome_project_list.py index 609652267..d8b2179c8 100644 --- a/tools/warn/chrome_project_list.py +++ b/tools/warn/chrome_project_list.py @@ -8,6 +8,7 @@ unification of the Chrome and Android warn.py. def create_pattern(pattern): + """Return a tuple of name and warn patten.""" return [pattern, '(^|.*/)' + pattern + '/.*: warning:'] diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py index e8783bc47..2fa9916ec 100644 --- a/tools/warn/cpp_warn_patterns.py +++ b/tools/warn/cpp_warn_patterns.py @@ -15,10 +15,12 @@ """Warning patterns for C/C++ compiler, but not clang-tidy.""" +# No need of doc strings for trivial small functions. +# pylint:disable=missing-function-docstring + import re # pylint:disable=relative-beyond-top-level -# pylint:disable=g-importing-member from .severity import Severity @@ -56,7 +58,8 @@ def harmless(description, pattern_list): warn_patterns = [ - # pylint:disable=line-too-long,g-inconsistent-quotes + # pylint does not recognize g-inconsistent-quotes + # pylint:disable=line-too-long,bad-option-value,g-inconsistent-quotes medium('Implicit function declaration', [r".*: warning: implicit declaration of function .+", r".*: warning: implicitly declaring library function"]), @@ -300,7 +303,7 @@ warn_patterns = [ medium('Missing noreturn', [r".*: warning: function '.*' could be declared with attribute 'noreturn'"]), medium('User warning', - [r".*: warning: #warning "".+"""]), + [r".*: warning: #warning \".+\""]), medium('Vexing parsing problem', [r".*: warning: empty parentheses interpreted as a function declaration"]), medium('Dereferencing void*', diff --git a/tools/warn/html_writer.py b/tools/warn/html_writer.py index be71b5506..bed25ed6f 100644 --- a/tools/warn/html_writer.py +++ b/tools/warn/html_writer.py @@ -15,6 +15,9 @@ """Emit warning messages to html or csv files.""" +# Many functions in this module have too many arguments to be refactored. +# pylint:disable=too-many-arguments,missing-function-docstring + # To emit html page of warning messages: # flags: --byproject, --url, --separator # Old stuff for static html components: @@ -57,11 +60,10 @@ import html import sys # pylint:disable=relative-beyond-top-level -# pylint:disable=g-importing-member from .severity import Severity -html_head_scripts = """\ +HTML_HEAD_SCRIPTS = """\ ') @@ -246,8 +246,8 @@ def emit_stats_by_project(writer, warn_patterns, project_names): total_by_project = get_total_by_project(warnings, project_names) total_by_severity = get_total_by_severity(warnings, project_names) stats_header = emit_table_header(total_by_severity) - total_all_projects, stats_rows = \ - emit_row_counts_per_project(warnings, total_by_project, total_by_severity, project_names) + total_all_projects, stats_rows = emit_row_counts_per_project( + warnings, total_by_project, total_by_severity, project_names) emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows, total_all_projects, writer) @@ -287,6 +287,7 @@ def dump_stats(writer, warn_patterns): # id for each warning pattern # sort by project, severity, warn_id, warning_message def emit_buttons(writer): + """Write the button elements in HTML.""" writer('\n' '