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

          Or actually, I could simply look at the unit tests in the repo.

          Jean-Christophe Morin added a comment - Or actually, I could simply look at the unit tests in the repo.

          Morten Brekkevold added a comment - - edited

          Which version of analysis-model-api do you have installed?

           
          Hi drulli, I have version 2.1.2 of that plugin.

          1. Replace number in category with text (resolved now)
          2. Provide descriptions of category (still open) - (btw: actually category is the wrong property, it should be type).

           
          On my end, I cannot confirm that #1 is resolved (which is what I was most hoping for). #2 is not that important to me, as there is a detailed message attached to each reported code line anyway. However, the output of pylint --list-msgs is easily converted to JSON. See attached file.
           
          I'm not sure I understand your distinction between "type" and "category", with regards to warnings-ng, but pylint establishes 5 different message types:
           

          • (C) convention, for programming standard violation
          • (R) refactor, for bad code smell
          • (W) warning, for python specific problems
          • (E) error, for much probably bugs in the code
          • (F) fatal, if an error occurred which prevented pylint from doing

          Each message emitted has one of these types and a four digit integer code to identify it.
           

          Morten Brekkevold added a comment - - edited Which version of analysis-model-api do you have installed?   Hi drulli , I have version 2.1.2 of that plugin. Replace number in category with text (resolved now) Provide descriptions of category (still open) - (btw: actually category is the wrong property, it should be type).   On my end, I cannot confirm that #1 is resolved (which is what I was most hoping for). #2 is not that important to me, as there is a detailed message attached to each reported code line anyway. However, the output of  pylint --list-msgs is easily converted to JSON. See attached file.   I'm not sure I understand your distinction between "type" and "category", with regards to warnings-ng, but pylint establishes 5 different message types:   (C) convention, for programming standard violation (R) refactor, for bad code smell (W) warning, for python specific problems (E) error, for much probably bugs in the code (F) fatal, if an error occurred which prevented pylint from doing Each message emitted has one of these types and a four digit integer code to identify it.  

          Forgot to actually attach the file, here it is: pylint-messages.json

          Morten Brekkevold added a comment - Forgot to actually attach the file, here it is:  pylint-messages.json

          Ulli Hafner added a comment -

          category and type are typically a 1:n relationship. The type contains the name (or ID) of the rule that has been executed. The category groups a set of n rules. Examples from Java:

          Ulli Hafner added a comment - category and type are typically a 1: n relationship. The type contains the name (or ID) of the rule that has been executed. The category groups a set of n  rules. Examples from Java: https://github.com/pmd/pmd/wiki/Rule-Categories http://checkstyle.sourceforge.net/checks.html  (Navigation menu shows categories, Rules are types)

          Ulli Hafner added a comment -

          mbrekkevold, jeanchristophemorinperso: Is the result format the same if your projects if you compare it line by line? 

          I think I will put your result in a test to see what is different...

          Ulli Hafner added a comment - mbrekkevold , jeanchristophemorinperso : Is the result format the same if your projects if you compare it line by line?  I think I will put your result in a test to see what is different...

          category and type are typically a 1:n relationship. The type contains the name (or ID) of the rule that has been executed. The category groups a set of n rules.

          So the current categories (C0111, R0201, etc) need to be switched to types, and the real categories needs to be categories. (C, R, W, E, F).

          So we still need to open a new issue for this one, and I'm willing to work on it.

           

          is what we already had in our reports, and we are still only seeing opaque codes in the report:

          mbrekkevold umm, interesting. I'll triple check on a clean jenkins instance as soon as I can. To create the screenshot I did, I used the exact same msg-template as you. On your side, do you think you can spin-up a fresh new instance (let's say with docker or whatever the way you prefer) and see if it changes something? (Here I'm implying you are looking at a production instance, but I might me wrong and maybe you already did it).

           

          Is the result format the same if your projects if you compare it line by line?

          drulli I guess you mean our pylint output result? If so yes it's the same I have. And when I use the regex to parse mbrekkevold pylint output, I get the proper groups (see https://regex101.com/r/tsspv2/1)

          Jean-Christophe Morin added a comment - category and type are typically a 1: n  relationship. The type contains the name (or ID) of the rule that has been executed. The category groups a set of  n  rules. So the current categories (C0111, R0201, etc) need to be switched to types, and the real categories needs to be categories. (C, R, W, E, F). So we still need to open a new issue for this one, and I'm willing to work on it.   is what we already had in our reports, and we are still only seeing opaque codes in the report: mbrekkevold umm, interesting. I'll triple check on a clean jenkins instance as soon as I can. To create the screenshot I did, I used the exact same msg-template as you. On your side, do you think you can spin-up a fresh new instance (let's say with docker or whatever the way you prefer) and see if it changes something? (Here I'm implying you are looking at a production instance, but I might me wrong and maybe you already did it).   Is the result format the same if your projects if you compare it line by line? drulli I guess you mean our pylint output result? If so yes it's the same I have. And when I use the regex to parse mbrekkevold pylint output, I get the proper groups (see  https://regex101.com/r/tsspv2/1 )

          Ulli Hafner added a comment - - edited

          So the current categories (C0111, R0201, etc) need to be switched to types, and the real categories needs to be categories. (C, R, W, E, F).

          So we still need to open a new issue for this one, and I'm willing to work on it.

          I think it would be sufficient to use setType rather than setCategory in the current implementation. The categories C, R, W, E, F do not provide any additional information: they are already used as severity. I think a PR is sufficient, no need to create a new issue...

          Ulli Hafner added a comment - - edited So the current categories (C0111, R0201, etc) need to be switched to types, and the real categories needs to be categories. (C, R, W, E, F). So we still need to open a new issue for this one, and I'm willing to work on it. I think it would be sufficient to use setType  rather than setCategory  in the current implementation. The categories C, R, W, E, F do not provide any additional information: they are already used as severity. I think a PR is sufficient, no need to create a new issue...

          Ulli Hafner added a comment -

          mbrekkevold Thanks for adding the messages, they are now part of the plugin: https://github.com/jenkinsci/warnings-ng-plugin/commit/e0915fbe87e032ce031be474650314a1ec37cdda

          We need to update these messages from time to time.

          Ulli Hafner added a comment - mbrekkevold Thanks for adding the messages, they are now part of the plugin: https://github.com/jenkinsci/warnings-ng-plugin/commit/e0915fbe87e032ce031be474650314a1ec37cdda We need to update these messages from time to time.

          Morten Brekkevold added a comment - - edited

          drulli I also solved my issue: Unbeknownst to me, there was a new way of invoking warnings-ng from pipeline script. I was using a step with a WarningsPublisher. However, when I switched to using recordIssues with the pyLint tool, suddenly my warnings report was completely reinvigorated with a new look, with proper symbolic violation names and graphs, and lots of bells and whistles    It looks nothing like the screenshot I provided previously.

          Morten Brekkevold added a comment - - edited drulli I also solved my issue: Unbeknownst to me, there was a new way of invoking warnings-ng from pipeline script. I was using a step with a WarningsPublisher . However, when I switched to using recordIssues with the pyLint tool, suddenly my warnings report was completely reinvigorated with a new look, with proper symbolic violation names and graphs, and lots of bells and whistles     It looks nothing like the screenshot I provided previously.

          Ulli Hafner added a comment -

          Ah, seems I missed the screenshot. Those results are from the old warnings plugin! Good to see that now everything is working...

          Ulli Hafner added a comment - Ah, seems I missed the screenshot. Those results are from the old warnings plugin! Good to see that now everything is working...

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

              Created:
              Updated:
              Resolved: