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
          drulli Ulli Hafner added a comment -

          Seems, that I overwrote the old view when I extracted the common functionality to the analysis-core plug-in.

          Show
          drulli Ulli Hafner added a comment - Seems, that I overwrote the old view when I extracted the common functionality to the analysis-core plug-in.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : drulli
          Path:
          trunk/hudson/plugins/analysis-core/.classpath
          trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/views/DetailFactory.java
          trunk/hudson/plugins/dry/.classpath
          trunk/hudson/plugins/dry/pom.xml
          trunk/hudson/plugins/dry/src/main/java/hudson/plugins/dry/DryDetailBuilder.java
          trunk/hudson/plugins/dry/src/main/java/hudson/plugins/dry/DryTabDetail.java
          trunk/hudson/plugins/dry/src/main/resources/tabview/details.jelly
          trunk/hudson/plugins/dry/src/main/resources/tabview/warnings.jelly
          http://fisheye4.cenqua.com/changelog/hudson/?cs=24857
          Log:
          [FIXED JENKINS-5034] Fixed detail views for duplicate code warnings.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : drulli Path: trunk/hudson/plugins/analysis-core/.classpath trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/views/DetailFactory.java trunk/hudson/plugins/dry/.classpath trunk/hudson/plugins/dry/pom.xml trunk/hudson/plugins/dry/src/main/java/hudson/plugins/dry/DryDetailBuilder.java trunk/hudson/plugins/dry/src/main/java/hudson/plugins/dry/DryTabDetail.java trunk/hudson/plugins/dry/src/main/resources/tabview/details.jelly trunk/hudson/plugins/dry/src/main/resources/tabview/warnings.jelly http://fisheye4.cenqua.com/changelog/hudson/?cs=24857 Log: [FIXED JENKINS-5034] Fixed detail views for duplicate code warnings.
          Hide
          dszuksztul dszuksztul added a comment -

          i have installed from plugin repository:

          • Hudson Duplicate Code Scanner Plug-in v2.1
          • Hudson Analysis Utilities Plug-in v1.1

          and still i can't see (on details tab) where the duplication is.
          (i've tried on production environment and on clean hudson instance)
          it seems that duplicate code plugin contains code for correct detail display but the default code is used instead

          Show
          dszuksztul dszuksztul added a comment - i have installed from plugin repository: Hudson Duplicate Code Scanner Plug-in v2.1 Hudson Analysis Utilities Plug-in v1.1 and still i can't see (on details tab) where the duplication is. (i've tried on production environment and on clean hudson instance) it seems that duplicate code plugin contains code for correct detail display but the default code is used instead
          Hide
          drulli Ulli Hafner added a comment -

          Hmm, that is really strange. When I'm running the plug-in within the debugger, then the correct view is show. As soon as the plugin is loaded in the normal way, the wrong view is shown...

          Show
          drulli Ulli Hafner added a comment - Hmm, that is really strange. When I'm running the plug-in within the debugger, then the correct view is show. As soon as the plugin is loaded in the normal way, the wrong view is shown...
          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: