Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44915

Pylint Warnings: Details table could provide summary string with category

      In the PyLint Warnings report, the Categories tab provides only the pylint msg_id (e.g. "E0012"), but not the summary string (or symbolic name in pylint speak, e.g. "bad-option-value"). If this summary string was included, it would be much easier to interpret. 

       

          [JENKINS-44915] Pylint Warnings: Details table could provide summary string with category

          Generic Ratslaugh created issue -

          Ulli Hafner added a comment -

          Do you have a link to a file that contains this mapping? Or where can I get this information from?

          Ulli Hafner added a comment - Do you have a link to a file that contains this mapping? Or where can I get this information from?

          Apologies, I hadn't realized I wasn't getting the default output format. I see now that we run pylint during the build stage from a bash shell using the '--output-format=parseable' option. Consequently, in the output the msg_id is immediately followed by the symbolic name (in parenthesis) as shown below:
          plotting_root.py:596: [R0913(too-many-arguments), PlotScatter2DLive.update] Too many arguments (6/5)
          plotting_root.py:614: [E0602(undefined-variable), PlotScatter2DLive.update] Undefined variable 'title'
          plotting_root.py:637: [C0103(invalid-name), PlotScatter2DLive.update] Invalid variable name "xa"
          See also:

          https://pylint.readthedocs.io/en/latest/user_guide/output.html

          and the MSGS dictionaries in these files:

          https://github.com/PyCQA/pylint/tree/2e820672609c489458dc2cf39d811e8c10255fe4/pylint/checkers

          Generic Ratslaugh added a comment - Apologies, I hadn't realized I wasn't getting the default output format. I see now that we run pylint during the build stage from a bash shell using the '--output-format=parseable' option. Consequently, in the output the msg_id is immediately followed by the symbolic name (in parenthesis) as shown below: plotting_root.py:596: [R0913(too-many-arguments), PlotScatter2DLive.update] Too many arguments (6/5) plotting_root.py:614: [E0602(undefined-variable), PlotScatter2DLive.update] Undefined variable 'title' plotting_root.py:637: [C0103(invalid-name), PlotScatter2DLive.update] Invalid variable name "xa" See also: https://pylint.readthedocs.io/en/latest/user_guide/output.html and the MSGS dictionaries in these files: https://github.com/PyCQA/pylint/tree/2e820672609c489458dc2cf39d811e8c10255fe4/pylint/checkers

          Ulli Hafner added a comment - - edited

          I see. Seems that the category actually is the type of the warning.

          Is there an easy way to get an ID to "human readable name" mapping into a file? I never programmed python, maybe one of the pylint contributors can help here?
          What I also see: there is some additional information available for each warning type. This information can be shown as tooltip in the various warning dialogs. Again, it would be helpful if I can get a file with a mapping ID to description.

              'W0301': ('Unnecessary semicolon', # was W0106
                        'unnecessary-semicolon',
                        'Used when a statement is ended by a semi-colon (";"), which \
                        isn\'t necessary (that\'s python, not C ;).'),
          

          Interested in helping to get these two mapping files, then I can add these information to the warnings plugin?

          We actually need something like

          W0301= Unnecessary semicolon
          
          W0301=Used when a statement is ended by a semi-colon (";"), which \
                        isn\'t necessary (that\'s python, not C ;).
          

          (Or something similar in JSON or YAML, etc.)

          Ulli Hafner added a comment - - edited I see. Seems that the category actually is the type of the warning. Is there an easy way to get an ID to "human readable name" mapping into a file? I never programmed python, maybe one of the pylint contributors can help here? What I also see: there is some additional information available for each warning type. This information can be shown as tooltip in the various warning dialogs. Again, it would be helpful if I can get a file with a mapping ID to description. 'W0301': ('Unnecessary semicolon', # was W0106 'unnecessary-semicolon', 'Used when a statement is ended by a semi-colon (";"), which \ isn\'t necessary (that\'s python, not C ;).'), Interested in helping to get these two mapping files, then I can add these information to the warnings plugin? We actually need something like W0301= Unnecessary semicolon W0301=Used when a statement is ended by a semi-colon (";"), which \ isn\'t necessary (that\'s python, not C ;). (Or something similar in JSON or YAML, etc.)
          Ulli Hafner made changes -
          Assignee Original: Ulli Hafner [ drulli ]

          Hi,

          I would also like to have more readable warnings summaries from Pylint in our Jenkins setup.

          There are two ways to get the message code details from pylint itself:

          pylint --list-msgs will list all defined Pylint messages with codes, symbolic names and full-text descriptions in a format that looks like this:

          :blacklisted-name (C0102): *Black listed name "%s"*
            Used when the name is listed in the black list (unauthorized names).
          :invalid-name (C0103): *Invalid %s name "%s"%s*
            Used when the name doesn't match the regular expression associated to its type
            (constant, variable, class...).
          ...
          

          Another way is to query a specific message code, like so:

          $ pylint --help-msg E1101
          No config file found, using default configuration
          :no-member (E1101): *%s %r has no %r member%s*
            Used when a variable is accessed for an unexistent member. This message
            belongs to the typecheck checker.
          

          As the original reporter notes, though, the symbolic names are already present in the output that the Warnings plugins parses. Just using the symbolic name nomember is a big readability improvement over using E1101.

          Morten Brekkevold added a comment - Hi, I would also like to have more readable warnings summaries from Pylint in our Jenkins setup. There are two ways to get the message code details from pylint itself: pylint --list-msgs will list all defined Pylint messages with codes, symbolic names and full-text descriptions in a format that looks like this: :blacklisted-name (C0102): *Black listed name "%s"* Used when the name is listed in the black list (unauthorized names). :invalid-name (C0103): *Invalid %s name "%s"%s* Used when the name doesn't match the regular expression associated to its type (constant, variable, class...). ... Another way is to query a specific message code, like so: $ pylint --help-msg E1101 No config file found, using default configuration :no-member (E1101): *%s %r has no %r member%s* Used when a variable is accessed for an unexistent member. This message belongs to the typecheck checker. As the original reporter notes, though, the symbolic names are already present in the output that the Warnings plugins parses. Just using the symbolic name nomember is a big readability improvement over using E1101 .

          Ulli Hafner added a comment -

          This information could be easily shown in the warnings plugin (at least as part of the new refactoring for pipelines). Interested in helping with a pull request? Basically there needs to be implemented something as this is done for CheckStyle, PMD or FindBugs:

          Ulli Hafner added a comment - This information could be easily shown in the warnings plugin (at least as part of the new refactoring for pipelines). Interested in helping with a pull request? Basically there needs to be implemented something as this is done for CheckStyle, PMD or FindBugs: CheckStyle Parser Definition CheckStyle Type Descriptions
          Ulli Hafner made changes -
          Component/s New: warnings-ng-plugin [ 24526 ]
          Component/s Original: warnings-plugin [ 15513 ]
          Labels Original: warnings New: help-wanted newbie-friendly
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-1528 [ JENKINS-1528 ]
          Jean-Christophe Morin made changes -
          Attachment New: image-2019-02-24-14-18-41-831.png [ 46157 ]

            drulli Ulli Hafner
            generatz Generic Ratslaugh
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: