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

Native Analysis Model Format specifies "lineRanges" but does not use them.

      The documentation of the native format specifies an example here: https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/test/resources/io/jenkins/plugins/analysis/warnings/steps/issues.json

      When you actually feed the example into Jenkins, all entries below "lineRanges" are ignored and not used.

      ...
      "fileName": "test-file.txt",            
      "lineRanges": [                
        {                    
          "start": 110,                    
          "end": 111                
        },                
        {
          "start": 120,                    
          "end": 121                
        }            
      ],
      ...


      "lineStart" and "lineEnd" are accepted.

      ...
      "fileName": "test.xml",            
      "severity": "ERROR",            
      "lineStart": 110,            
      "lineEnd": 111,            
      "columnStart": 210,            
      "columnEnd": 220,            
      "message": "some message",            
      "description": "some description" 
      ...

       

          [JENKINS-70498] Native Analysis Model Format specifies "lineRanges" but does not use them.

          Kris Stern added a comment -

          Thanks yashre_bh for taking on the issue! 

          Kris Stern added a comment - Thanks yashre_bh for taking on the issue! 

          Shreya added a comment -

          krisstern Current update: working on setting up the development environment as specified in the README here

          Shreya added a comment - krisstern Current update: working on setting up the development environment as specified in the README here

          Ulli Hafner added a comment -

          If you just want to fix that bug without seeing it in Jenkins it would be sufficient to clone https://github.com/jenkinsci/analysis-model and import that project in IntelliJ.

          Ulli Hafner added a comment - If you just want to fix that bug without seeing it in Jenkins it would be sufficient to clone https://github.com/jenkinsci/analysis-model and import that project in IntelliJ.

          Ulli Hafner added a comment - - edited

          Here are some steps on how to start:

          • The class JsonParserTest already has a test case. This test needs to be fixed so that it checks for each issue (i.e. report.get(x)) that the lineStart and lineEnd property will be correctly set to the first element of the values in the line ranges array. After that change, this test should fail.
          • The corresponding class JsonBaseParser should set the line start and end values after reading the line ranges

          Ulli Hafner added a comment - - edited Here are some steps on how to start: The class JsonParserTest already has a test case. This test needs to be fixed so that it checks for each issue (i.e. report.get(x) ) that the lineStart and lineEnd property will be correctly set to the first element of the values in the line ranges array. After that change, this test should fail. The corresponding class JsonBaseParser should set the line start and end values after reading the line ranges

          Shreya added a comment -

          Right! will get to it, thank you for the lead drulli 

          Shreya added a comment - Right! will get to it, thank you for the lead drulli  

          Shreya added a comment - - edited

          drulli for cloning and setting up https://github.com/jenkinsci/analysis-model on IntelliJ, I won't need to setup https://github.com/jenkinsci/warnings-ng-plugin-devenv
           ?
          the analysis model also points to the same development instructions https://github.com/jenkinsci/analysis-model/blob/master/CONTRIBUTING.md#:~:text=Development%20environment%20for%20Jenkins%27%20Warnings%20Next%20Generation%20Plugin

          Because the installation is taking way too long :')

          Shreya added a comment - - edited drulli for cloning and setting up https://github.com/jenkinsci/analysis-model on IntelliJ, I won't need to setup https://github.com/jenkinsci/warnings-ng-plugin-devenv  ? the analysis model also points to the same development instructions https://github.com/jenkinsci/analysis-model/blob/master/CONTRIBUTING.md#:~:text=Development%20environment%20for%20Jenkins%27%20Warnings%20Next%20Generation%20Plugin Because the installation is taking way too long :')

          Rutvik added a comment -

          drulli

          At the moment I haven't setup the SDK yet but i just looked through the files

          Could the bug be in the imports.

          In the JsonParserTest.java 

          ```
          import edu.hm.hafner.analysis.LineRange;      // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis
          import edu.hm.hafner.analysis.Report;           // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis
          import edu.hm.hafner.analysis.Severity;         // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis
           
          import edu.hm.hafner.analysis.assertions.SoftAssertions;          // I don't see this package anywhere in the directory
          import static edu.hm.hafner.analysis.assertions.Assertions.*;    // I don't see this package anywhere in the directory
          ```

          the correct imports for JsonParserTest.java should be 

           

          ```

          import edu.hm.hafner.analysis.LineRangeTest;      
          import edu.hm.hafner.analysis.ReportTest;  
          import edu.hm.hafner.analysis.SeverityTest; 

          ```

          Please do lmk about your insights.

          Rutvik added a comment - drulli At the moment I haven't setup the SDK yet but i just looked through the files Could the bug be in the imports. In the  JsonParserTest.java   ``` import edu.hm.hafner.analysis.LineRange;      // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis import edu.hm.hafner.analysis.Report;           // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis import edu.hm.hafner.analysis.Severity;         // This exists in analysis-model/src/main/java/edu/hm/hafner/analysis   import edu.hm.hafner.analysis.assertions.SoftAssertions;          // I don't see this package anywhere in the directory import static edu.hm.hafner.analysis.assertions.Assertions.*;    // I don't see this package anywhere in the directory ``` the correct imports for JsonParserTest.java should be    ``` import edu.hm.hafner.analysis.LineRangeTest;       import edu.hm.hafner.analysis.ReportTest;   import edu.hm.hafner.analysis.SeverityTest;  ``` Please do lmk about your insights.

          Ulli Hafner added a comment -

          The imports edu.hm.hafner.analysis.assertions. are generated with maven, so you need to run maven first!

          Ulli Hafner added a comment - The imports edu.hm.hafner.analysis.assertions. are generated with maven, so you need to run maven first!

          Shreya added a comment -

          https://github.com/jenkinsci/analysis-model/pull/884

          Is this the right way to go drulli ?

          As you instructed, I made changes in the JSONParserTest to read the first element in lineRanges and set LineStart and LineEnd according to it.

          Then made changes in JSONBaseParser to assign lineStart and LineEnd accordingly.

          What my doubt here is- The said changes still don't check for 120-121 range. will I have to make 2 separate issues in JSONBaseParser and a separate test case in JSONParserTest to check for the second line range?

          Shreya added a comment - https://github.com/jenkinsci/analysis-model/pull/884 Is this the right way to go drulli ? As you instructed, I made changes in the JSONParserTest to read the first element in lineRanges and set LineStart and LineEnd according to it. Then made changes in JSONBaseParser to assign lineStart and LineEnd accordingly. What my doubt here is- The said changes still don't check for 120-121 range. will I have to make 2 separate issues in JSONBaseParser and a separate test case in JSONParserTest to check for the second line range?

          HSM added a comment -

          Thanks for the fix!

          HSM added a comment - Thanks for the fix!

            yashre_bh Shreya
            hsm_ci HSM
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: