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

pylint icon does not appear when tool id is not "pylint"

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • warnings-ng-plugin
    • None

      Im running 2 pylint jobs in parallel, and for each of them i make a pylint report.

      so i have to use unique ID for each of the pyLint calls,
      but when i do that, the pylint icon does not appear in the job page,

      it seems that the pylint icon is used only if the default id of the pyLint is used (the default id is  "pylint")

      can you please change the plugin so it will use the pylint icon if the id prefix is "pylint" and not only if the id is just "pylint"?

       

      thanks

          [JENKINS-72777] pylint icon does not appear when tool id is not "pylint"

          Yvonne added a comment - - edited

          Hello,

          It sounds like you’re encountering an issue with a continuous integration tool where the pylint icon is not displayed unless the default ID “pylint” is used. This seems to be a limitation or a specific requirement of the tool’s design.

          To address this, you would typically need to modify the plugin’s source code to change the behavior of the icon display logic. This would involve locating the part of the code that sets the condition for displaying the pylint icon and adjusting it to accept IDs with the “pylint” prefix, not just the exact ID “pylint”.

          Here’s a general idea of what the code modification might look like:

          1. This is a hypothetical example and may not directly apply to your situation.
          2. You would need to locate the actual code responsible for the icon display logic.
          1. Original code
            if tool_id == "pylint":
                display_icon("pylint_icon.png" https://www.my-milestonecard.com)
          1. Modified code
            if tool_id.startswith("pylint"):
                display_icon("pylint_icon.png")

          Please note that modifying plugin code can have unintended consequences, so it’s important to test any changes thoroughly before applying them in a production environment.  

          I hope the information may helps you. 

           

          Yvonne added a comment - - edited Hello, It sounds like you’re encountering an issue with a continuous integration tool where the pylint icon is not displayed unless the default ID “pylint” is used. This seems to be a limitation or a specific requirement of the tool’s design. To address this, you would typically need to modify the plugin’s source code to change the behavior of the icon display logic. This would involve locating the part of the code that sets the condition for displaying the pylint icon and adjusting it to accept IDs with the “pylint” prefix, not just the exact ID “pylint”. Here’s a general idea of what the code modification might look like: This is a hypothetical example and may not directly apply to your situation. You would need to locate the actual code responsible for the icon display logic. Original code if tool_id == "pylint":     display_icon("pylint_icon.png" https://www.my-milestonecard.com ) Modified code if tool_id.startswith("pylint"):     display_icon("pylint_icon.png") Please note that modifying plugin code can have unintended consequences, so it’s important to test any changes thoroughly before applying them in a production environment.   I hope the information may helps you.   

          Ofir added a comment -

          Hi,
          can you please point me to the code that checks if the id of the report is "pylint"?

          Ofir added a comment - Hi, can you please point me to the code that checks if the id of the report is "pylint"?

          ofiry, reasoning:

          So: the prefix match might be implementable by changing LabelProviderFactory to search for the longest matching prefix, or by adding an extension that implements StaticAnalysisToolFactory and does that. However, it feels a bit wrong to me that the same id string is used for constructing the URL and for choosing the icon; shouldn't these be separately controllable? I mean, if the plugin parsed the warnings from PyLint format originally, then I think it should use the PyLint icon by default, no matter which id the pipeline specifies. There could then be a separate parameter for overriding the icon. That is, split the id to toolId (for the icon) and reportId (for the URL).

          Kalle Niemitalo added a comment - ofiry , reasoning: https://github.com/jenkinsci/warnings-ng-plugin/blob/v11.2.2/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/PyLint.java defines private static final String ID = "pylint"; and creates new IconLabelProvider(ID, getDisplayName(), getDescriptionProvider()) . https://github.com/jenkinsci/warnings-ng-plugin/blob/v11.2.2/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/IconLabelProvider.java overrides public String getSmallIconUrl() and public String getLargeIconUrl() . getSmallIconUrl() is called from https://github.com/jenkinsci/warnings-ng-plugin/blob/v11.2.2/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/ResultAction.java , which gets the StaticAnalysisLabelProvider by calling new LabelProviderFactory().create(id, name) . https://github.com/jenkinsci/warnings-ng-plugin/blob/v11.2.2/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/LabelProviderFactory.java#L49-L77 compares the id string, and if that matches, then calls ToolDescriptor.getLabelProvider(). If the id does not match, then it tries to ask StaticAnalysisToolFactory extensions instead. The StaticAnalysisToolFactory extension point seems to be implemented only in https://github.com/jenkinsci/warnings-ng-plugin/blob/v11.2.2/plugin/src/main/java/io/jenkins/plugins/analysis/warnings/groovy/ParserConfiguration.java and in tests. So: the prefix match might be implementable by changing LabelProviderFactory to search for the longest matching prefix, or by adding an extension that implements StaticAnalysisToolFactory and does that. However, it feels a bit wrong to me that the same id string is used for constructing the URL and for choosing the icon; shouldn't these be separately controllable? I mean, if the plugin parsed the warnings from PyLint format originally, then I think it should use the PyLint icon by default, no matter which id the pipeline specifies. There could then be a separate parameter for overriding the icon. That is, split the id to toolId (for the icon) and reportId (for the URL).

          Aneesh added a comment -

          is anyone working on this issue?

          Aneesh added a comment - is anyone working on this issue?

            drulli Ulli Hafner
            ofiry Ofir
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: