diff options
author | Jeremy Bettis <jbettis@google.com> | 2022-08-16 13:05:23 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-17 22:09:35 +0000 |
commit | 20e14763fd8ea76156f2f064c23660f882eae8e7 (patch) | |
tree | 1fcff82ecff6692eae55cf4b6c5913c227a0e352 | |
parent | 5d79e92cba579a539d3e8b4dc2ed5be7696a4ea6 (diff) | |
download | chrome-ec-20e14763fd8ea76156f2f064c23660f882eae8e7.tar.gz |
ec: Adjust pylint disabled messages
Add several too-many-* disables to the pylintrc file. The very idea that
a function can have X of Ys but no more is not helpful.
Remove the now duplicated disables from the code.
Also, since pylint (at least as called from cros lint) doesn't inherit
settings from parent dirs, copy the disables to all child .pylintrc
files also.
BRANCH=None
BUG=None
TEST=git ls-files | grep 'py$' | xargs cros lint -v |& less
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Change-Id: I9bb14cd09a066ddd6e2d45cd541cef6695ad36f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3833920
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | pylintrc | 5 | ||||
-rw-r--r-- | zephyr/.pylintrc | 16 | ||||
-rw-r--r-- | zephyr/projects/.pylintrc | 22 | ||||
-rw-r--r-- | zephyr/test/.pylintrc | 22 | ||||
-rw-r--r-- | zephyr/zmake/.pylintrc | 22 | ||||
-rw-r--r-- | zephyr/zmake/tests/test_generate_readme.py | 2 | ||||
-rw-r--r-- | zephyr/zmake/tests/test_zmake.py | 2 | ||||
-rw-r--r-- | zephyr/zmake/zmake/multiproc.py | 4 | ||||
-rw-r--r-- | zephyr/zmake/zmake/zmake.py | 15 |
9 files changed, 83 insertions, 27 deletions
@@ -11,7 +11,10 @@ disable= bad-whitespace, # These have nothing to do with black, they are just annoying fixme, - too-many-arguments + too-many-arguments, + too-many-statements, + too-many-branches, + too-many-locals [format] diff --git a/zephyr/.pylintrc b/zephyr/.pylintrc index 817f2453b3..066e00da9d 100644 --- a/zephyr/.pylintrc +++ b/zephyr/.pylintrc @@ -1,6 +1,20 @@ [MASTER] init-hook='import sys; sys.path.extend(["zephyr/zmake"])' +# cros lint doesn't inherit the pylintrc from the parent dir. +# These settings are copied from platform/ec/pylintrc [MESSAGES CONTROL] -disable=fixme +disable= + bad-continuation, + bad-whitespace, + # These have nothing to do with black, they are just annoying + fixme, + too-many-arguments, + too-many-statements, + too-many-branches, + too-many-locals + +[format] + +string-quote=double diff --git a/zephyr/projects/.pylintrc b/zephyr/projects/.pylintrc index 62896b8eae..f4609e3781 100644 --- a/zephyr/projects/.pylintrc +++ b/zephyr/projects/.pylintrc @@ -1,7 +1,3 @@ -[MESSAGES CONTROL] - -disable=format,fixme - [BASIC] additional-builtins= here, @@ -11,3 +7,21 @@ additional-builtins= register_npcx_project, register_raw_project, good-names=BUILD + +# cros lint doesn't inherit the pylintrc from the parent dir. +# These settings are copied from platform/ec/pylintrc +[MESSAGES CONTROL] + +disable= + bad-continuation, + bad-whitespace, + # These have nothing to do with black, they are just annoying + fixme, + too-many-arguments, + too-many-statements, + too-many-branches, + too-many-locals + +[format] + +string-quote=double diff --git a/zephyr/test/.pylintrc b/zephyr/test/.pylintrc index 62896b8eae..f4609e3781 100644 --- a/zephyr/test/.pylintrc +++ b/zephyr/test/.pylintrc @@ -1,7 +1,3 @@ -[MESSAGES CONTROL] - -disable=format,fixme - [BASIC] additional-builtins= here, @@ -11,3 +7,21 @@ additional-builtins= register_npcx_project, register_raw_project, good-names=BUILD + +# cros lint doesn't inherit the pylintrc from the parent dir. +# These settings are copied from platform/ec/pylintrc +[MESSAGES CONTROL] + +disable= + bad-continuation, + bad-whitespace, + # These have nothing to do with black, they are just annoying + fixme, + too-many-arguments, + too-many-statements, + too-many-branches, + too-many-locals + +[format] + +string-quote=double diff --git a/zephyr/zmake/.pylintrc b/zephyr/zmake/.pylintrc index 1f6856615d..a0f9ac790b 100644 --- a/zephyr/zmake/.pylintrc +++ b/zephyr/zmake/.pylintrc @@ -1,10 +1,24 @@ [MASTER] init-hook='import sys; sys.path.extend(["zephyr/zmake"])' -[MESSAGES CONTROL] - -disable=format,fixme,wrong-import-order - [BASIC] good-names= e, + +# cros lint doesn't inherit the pylintrc from the parent dir. +# These settings are copied from platform/ec/pylintrc +[MESSAGES CONTROL] + +disable= + bad-continuation, + bad-whitespace, + # These have nothing to do with black, they are just annoying + fixme, + too-many-arguments, + too-many-statements, + too-many-branches, + too-many-locals + +[format] + +string-quote=double diff --git a/zephyr/zmake/tests/test_generate_readme.py b/zephyr/zmake/tests/test_generate_readme.py index 882b9c81ca..ee4bb5767e 100644 --- a/zephyr/zmake/tests/test_generate_readme.py +++ b/zephyr/zmake/tests/test_generate_readme.py @@ -33,7 +33,7 @@ def test_generate_readme_diff( expected_contents, actual_contents, return_code, -): # pylint: disable=too-many-arguments +): """Verify that the diff function can detect different text.""" def generate_readme(): diff --git a/zephyr/zmake/tests/test_zmake.py b/zephyr/zmake/tests/test_zmake.py index 82c6b6a8eb..c0fbee441d 100644 --- a/zephyr/zmake/tests/test_zmake.py +++ b/zephyr/zmake/tests/test_zmake.py @@ -280,7 +280,7 @@ class TestFilters: ) def test_list_projects( project_names, fmt, search_dir, expected_output, capsys, zmake_from_dir -): # pylint: disable=too-many-arguments +): """Test listing projects with default directory.""" fake_projects = { name: zmake.project.Project( diff --git a/zephyr/zmake/zmake/multiproc.py b/zephyr/zmake/zmake/multiproc.py index 5f1497c0dc..be33057c4e 100644 --- a/zephyr/zmake/zmake/multiproc.py +++ b/zephyr/zmake/zmake/multiproc.py @@ -56,7 +56,7 @@ class LogWriter: """Reset this module to its starting state (useful for tests)""" LogWriter._logging_map.clear() - def __init__( # pylint: disable=too-many-arguments + def __init__( self, logger, log_level, @@ -202,7 +202,7 @@ class LogWriter: LogWriter._log_fd(file) @classmethod - def log_output( # pylint: disable=too-many-arguments + def log_output( cls, logger, log_level, diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py index d76910d522..5a1f29831e 100644 --- a/zephyr/zmake/zmake/zmake.py +++ b/zephyr/zmake/zmake/zmake.py @@ -152,7 +152,7 @@ class Zmake: # pylint: disable=too-many-instance-attributes - def __init__( # pylint: disable=too-many-arguments + def __init__( self, checkout=None, jobserver: Optional[zmake.jobserver.JobClient] = None, @@ -233,7 +233,7 @@ class Zmake: ) from e return projects - def configure( # pylint: disable=too-many-arguments,too-many-locals + def configure( self, project_names, build_dir=None, @@ -301,7 +301,7 @@ class Zmake: return result return 0 - def build( # pylint: disable=too-many-arguments + def build( self, project_names, build_dir=None, @@ -335,7 +335,7 @@ class Zmake: static_version=static_version, ) - def test( # pylint: disable=too-many-arguments,too-many-locals,unused-argument + def test( # pylint: disable=unused-argument self, project_names, ): @@ -349,7 +349,7 @@ class Zmake: return 0 - def testall( # pylint: disable=too-many-arguments + def testall( self, ): """Build and run tests for all projects. @@ -376,8 +376,6 @@ class Zmake: delete_intermediates=False, static_version=False, ): - # pylint: disable=too-many-arguments,too-many-locals,too-many-branches - # pylint: disable=too-many-statements """Set up a build directory to later be built by "zmake build".""" try: # Clobber build directory if requested. @@ -580,7 +578,7 @@ class Zmake: self.failed_projects.append(project.config.project_name) raise - def _build( # pylint: disable=too-many-arguments + def _build( self, build_dir, project: zmake.project.Project, @@ -589,7 +587,6 @@ class Zmake: multiproject=False, static_version=False, ): - # pylint: disable=too-many-locals,too-many-branches """Build a pre-configured build directory.""" def wait_and_check_success(procs, writers): |