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

DRY V2.0 no more shows where duplication is

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      In the new Version 2.0 I can no more see where the code is copied from, I only see which code segment is copied.

        Attachments

          Activity

          Hide
          jmboulos jmboulos added a comment -

          I can confirm the issue. I have version 1.343 of Hudson and version 2.2 of the DRY plugin. I thought the idea of this tool/plugin was great and I see that it works for C++ files now so I installed it and got it working. Then after I saw the results were very confusing and I couldn't figure out how to tell where the code is duplicated from, I thought maybe I just didn't know how to use the plugin or that it wasn't as useful as I had hoped. I am glad to see that this is just a bug and the normal functionality is supposed to be useful.

          SO what I see in my version is as others have reported: A list of files with duplicate code in it and when I go to Details it tells me which files, where the block starts at, and how many lines are in the duplicated block, but no reference to where it is copied from...

          Show
          jmboulos jmboulos added a comment - I can confirm the issue. I have version 1.343 of Hudson and version 2.2 of the DRY plugin. I thought the idea of this tool/plugin was great and I see that it works for C++ files now so I installed it and got it working. Then after I saw the results were very confusing and I couldn't figure out how to tell where the code is duplicated from, I thought maybe I just didn't know how to use the plugin or that it wasn't as useful as I had hoped. I am glad to see that this is just a bug and the normal functionality is supposed to be useful. SO what I see in my version is as others have reported: A list of files with duplicate code in it and when I go to Details it tells me which files, where the block starts at, and how many lines are in the duplicated block, but no reference to where it is copied from...
          Hide
          drulli Ulli Hafner added a comment - - edited

          Kohsuke,

          if you need anything to reproduce that on your machine, let me know. I can provide an example job...

          (Link to our discussion: http://n4.nabble.com/Stapler-different-include-file-resolved-when-running-with-mvn-hpi-run-or-java-jar-td1010907.html#a1010907)

          Show
          drulli Ulli Hafner added a comment - - edited Kohsuke, if you need anything to reproduce that on your machine, let me know. I can provide an example job... (Link to our discussion: http://n4.nabble.com/Stapler-different-include-file-resolved-when-running-with-mvn-hpi-run-or-java-jar-td1010907.html#a1010907 )
          Hide
          drulli Ulli Hafner added a comment - - edited

          Hi Kohsuke,

          I digged a little further why the wrong jelly script is found:

          The resource is resolved by the method getResource of the class loader:

              public URL getResource(String name) {
                  URL url;
                  if (parent != null) {
                      url = parent.getResource(name);
                  } else {
                      url = getBootstrapResource(name);
                  }
                  if (url == null) {
                      url = findResource(name);
                  }
                  return url;
              }
          

          The class loader first tries to find the resource with the parent classloader and only if there is no such result then the actual classloader is used. I.e., in my case the anlysis-core plugin resources are found by the parent class loader, but not the resources of the dry plug-in. If I set the parent classloader to null, then the correct resource is found by the classloader. Is there a way to change that behavior?

          Show
          drulli Ulli Hafner added a comment - - edited Hi Kohsuke, I digged a little further why the wrong jelly script is found: The resource is resolved by the method getResource of the class loader: public URL getResource( String name) { URL url; if (parent != null ) { url = parent.getResource(name); } else { url = getBootstrapResource(name); } if (url == null ) { url = findResource(name); } return url; } The class loader first tries to find the resource with the parent classloader and only if there is no such result then the actual classloader is used. I.e., in my case the anlysis-core plugin resources are found by the parent class loader, but not the resources of the dry plug-in. If I set the parent classloader to null, then the correct resource is found by the classloader. Is there a way to change that behavior?
          Hide
          drulli Ulli Hafner added a comment -

          Added a workaround in the details views, see JENKINS-6277.

          Show
          drulli Ulli Hafner added a comment - Added a workaround in the details views, see JENKINS-6277 .
          Hide
          drulli Ulli Hafner added a comment -

          Added another workaround so that the warnings table will show again the affected files of the duplication.

          Show
          drulli Ulli Hafner added a comment - Added another workaround so that the warnings table will show again the affected files of the duplication.

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              resvoe resvoe
            • Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: