[PATCH 02/19] qapi/schema: add pylint suppressions

John Snow posted 19 patches 1 year ago
There is a newer version of this series
[PATCH 02/19] qapi/schema: add pylint suppressions
Posted by John Snow 1 year ago
With this, pylint is happy with the file, so enable it in the
configuration.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/pylintrc  | 5 -----
 scripts/qapi/schema.py | 4 ++++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
index 90546df5345..aafddd3d8d0 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -1,10 +1,5 @@
 [MASTER]
 
-# Add files or directories matching the regex patterns to the ignore list.
-# The regex matches against base names, not paths.
-ignore-patterns=schema.py,
-
-
 [MESSAGES CONTROL]
 
 # Disable the message, report, category or checker with the given id(s). You
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index c79747b2a15..153e703e0ef 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -13,6 +13,7 @@
 # See the COPYING file in the top-level directory.
 
 # TODO catching name collisions in generated code would be nice
+# pylint: disable=too-many-lines
 
 from collections import OrderedDict
 import os
@@ -82,6 +83,7 @@ def c_name(self):
         return c_name(self.name)
 
     def check(self, schema):
+        # pylint: disable=unused-argument
         assert not self._checked
         seen = {}
         for f in self.features:
@@ -116,6 +118,7 @@ def is_implicit(self):
         return not self.info
 
     def visit(self, visitor):
+        # pylint: disable=unused-argument
         assert self._checked
 
     def describe(self):
@@ -134,6 +137,7 @@ def visit_module(self, name):
         pass
 
     def visit_needed(self, entity):
+        # pylint: disable=unused-argument
         # Default to visiting everything
         return True
 
-- 
2.41.0
Re: [PATCH 02/19] qapi/schema: add pylint suppressions
Posted by Markus Armbruster 1 year ago
John Snow <jsnow@redhat.com> writes:

> With this, pylint is happy with the file, so enable it in the
> configuration.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  scripts/qapi/pylintrc  | 5 -----
>  scripts/qapi/schema.py | 4 ++++
>  2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
> index 90546df5345..aafddd3d8d0 100644
> --- a/scripts/qapi/pylintrc
> +++ b/scripts/qapi/pylintrc
> @@ -1,10 +1,5 @@
>  [MASTER]
>  
> -# Add files or directories matching the regex patterns to the ignore list.
> -# The regex matches against base names, not paths.
> -ignore-patterns=schema.py,
> -
> -
>  [MESSAGES CONTROL]
>  
>  # Disable the message, report, category or checker with the given id(s). You
   # can either give multiple identifiers separated by comma (,) or put this
   # option multiple times (only on the command line, not in the configuration
   # file where it should appear only once). You can also use "--disable=all" to
   # disable everything first and then reenable specific checks. For example, if
   # you want to run only the similarities checker, you can use "--disable=all
   # --enable=similarities". If you want to run only the classes checker, but have
   # no Warning level messages displayed, use "--disable=all --enable=classes
   # --disable=W".
   disable=fixme,
           missing-docstring,
           too-many-arguments,
           too-many-branches,
           too-many-statements,
           too-many-instance-attributes,
           consider-using-f-string,
           useless-option-value,

Unrelated, but here goes anyway: sorting these would be nice.

> diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
> index c79747b2a15..153e703e0ef 100644
> --- a/scripts/qapi/schema.py
> +++ b/scripts/qapi/schema.py
> @@ -13,6 +13,7 @@
>  # See the COPYING file in the top-level directory.
>  
>  # TODO catching name collisions in generated code would be nice

Blank line to separate unrelated comments, please.

> +# pylint: disable=too-many-lines
>  
>  from collections import OrderedDict
>  import os
> @@ -82,6 +83,7 @@ def c_name(self):
>          return c_name(self.name)
>  
>      def check(self, schema):
> +        # pylint: disable=unused-argument
>          assert not self._checked
>          seen = {}
>          for f in self.features:
> @@ -116,6 +118,7 @@ def is_implicit(self):
>          return not self.info
>  
>      def visit(self, visitor):
> +        # pylint: disable=unused-argument
>          assert self._checked
>  
>      def describe(self):
> @@ -134,6 +137,7 @@ def visit_module(self, name):
>          pass
>  
>      def visit_needed(self, entity):
> +        # pylint: disable=unused-argument
>          # Default to visiting everything
>          return True

Reviewed-by: Markus Armbruster <armbru@redhat.com>