• 5.0.0-beta2

      ScalaStyle is a tool fulfilling more or less the same role as CheckStyle. But then for the Scala programming language.

      It seems to piggyback on the format of Checkstyle. An example is provided in this ticket.

      Those warnings are not picked up by the plugin. Presumably because it is a separate file ?

      Merging the warnings into checkstyle-result.xml via scripting in a post-build step does not help either. For some reason the scala files are not shown. Maybe it's because ScalaStyle uses warning id unknown to CheckStyle.

      merged.xml : an example of CheckStyle and ScalaStyle warnings merged into one file. An attempt to sneak in the Scala warnings. Alas, they don't appear.

      scalastyle-output.xml : an example of the warnings ScalaStyle generates.

        1. Bildschirmfoto 2015-03-16 um 22.59.41.png
          Bildschirmfoto 2015-03-16 um 22.59.41.png
          40 kB
        2. merged.xml
          1 kB
        3. pom.xml
          5 kB
        4. scalastyle-output.xml
          56 kB
        5. scalastyle-output.xml
          0.5 kB

          [JENKINS-17287] Provide support for ScalaStyle warnings

          Ulli Hafner added a comment -

          Hmm, interesting. I followed your example steps: and now I get a Jenkins maven job with Checkstyle warnings from Scala

          [CHECKSTYLE] Parsing file /Users/hafner/Development/jenkins/jobs/JENKINS-17287/workspace/subcut/scalastyle-output.xml
          [CHECKSTYLE] Successfully parsed file /Users/hafner/Development/jenkins/jobs/JENKINS-17287/workspace/subcut/scalastyle-output.xml of module subcut with 353 unique warnings and 0 duplicates.
          [CHECKSTYLE] Im pom.xml wurde keine Dateikodierung festgelegt, daher wird die vorgegebene Kodierung UTF-8 des aktuellen Systems verwendet. Damit wird der Build abhängig vom System, auf dem er läuft (siehe auch <a href="http://docs.codehaus.org/
          

          Maybe something is broken in your configuration. I'll add my configuration as screenshot...

          Ulli Hafner added a comment - Hmm, interesting. I followed your example steps: and now I get a Jenkins maven job with Checkstyle warnings from Scala [CHECKSTYLE] Parsing file /Users/hafner/Development/jenkins/jobs/JENKINS-17287/workspace/subcut/scalastyle-output.xml [CHECKSTYLE] Successfully parsed file /Users/hafner/Development/jenkins/jobs/JENKINS-17287/workspace/subcut/scalastyle-output.xml of module subcut with 353 unique warnings and 0 duplicates. [CHECKSTYLE] Im pom.xml wurde keine Dateikodierung festgelegt, daher wird die vorgegebene Kodierung UTF-8 des aktuellen Systems verwendet. Damit wird der Build abhängig vom System, auf dem er läuft (siehe auch <a href="http://docs.codehaus.org/ Maybe something is broken in your configuration. I'll add my configuration as screenshot...

          Jan Goyvaerts added a comment -

          You mean that it works for you ???

          Jan Goyvaerts added a comment - You mean that it works for you ???

          Jan Goyvaerts added a comment -

          Something else must be going on. I've made sure to have EXACTLY the same configuration. And yet it doesn't make a difference. I've got load of Java related Checkstyle warnings. But none for Scala files.

          This is the instruction I run:

          clean package jxr:jxr pmd:cpd pmd:pmd checkstyle:checkstyle scalastyle:check findbugs:findbugs -DskipTests=true -Djava.awt.headless=false

          Maybe because I'm also running CheckStyle ? Or because it is a multi-module project ? The out files would be scattered in the different module directories.

          Jan Goyvaerts added a comment - Something else must be going on. I've made sure to have EXACTLY the same configuration. And yet it doesn't make a difference. I've got load of Java related Checkstyle warnings. But none for Scala files. This is the instruction I run: clean package jxr:jxr pmd:cpd pmd:pmd checkstyle:checkstyle scalastyle:check findbugs:findbugs -DskipTests=true -Djava.awt.headless=false Maybe because I'm also running CheckStyle ? Or because it is a multi-module project ? The out files would be scattered in the different module directories.

          Ulli Hafner added a comment -

          Ah, I see. Yes, the reason is that you also run CheckStyle. For all of my plugins I'm checking if there is already a result present. If there is one there then I'm skipping the step. You can check this by running the goals in the opposite order: mvn scalastyle:check checkstyle:checkstyle. Then you will get Scala warnings but no Java warnings.

          That means I need to run the checkstyle reporter multiple times. I.e. in the end there will be multiple Checkstyle results available for a build.

          Ulli Hafner added a comment - Ah, I see. Yes, the reason is that you also run CheckStyle. For all of my plugins I'm checking if there is already a result present. If there is one there then I'm skipping the step. You can check this by running the goals in the opposite order: mvn scalastyle:check checkstyle:checkstyle. Then you will get Scala warnings but no Java warnings. That means I need to run the checkstyle reporter multiple times. I.e. in the end there will be multiple Checkstyle results available for a build.

          Jan Goyvaerts added a comment -

          Indeed, that's it. It works when running only ScalaStyle.

          Problem is ... it's a Java AND Scala project.

          Wouldn't it be easier to have a ScalaStyle plugin instead ? Now those two coincide more or less. And their data can be merged. But how long will it remain that way ?

          Anyway, any idea what I might try to actually merge the data ? I thought I was already doing that. But it looks like the results of one is erased.

          Jan Goyvaerts added a comment - Indeed, that's it. It works when running only ScalaStyle. Problem is ... it's a Java AND Scala project. Wouldn't it be easier to have a ScalaStyle plugin instead ? Now those two coincide more or less. And their data can be merged. But how long will it remain that way ? Anyway, any idea what I might try to actually merge the data ? I thought I was already doing that. But it looks like the results of one is erased.

          Ulli Hafner added a comment -

          The problem only occurs with the maven project type, freestyle project should already pick both files. I think it is not possible to merge these files since the maven build type invokes Checkstyle directly after the goal has been finished.

          An additional plug-in is also somewhat an overkill, since the parser still is the same.

          There are two possibilities:

          1. Add a new reporter class responsible for ScalaStyle (This is then an additional post build step with separate configuration). Then there will be two results (and links) available, one for Java and one for Scala.
          2. Aggregate the results. I'm not sure how easy that approach is since I need to load and discard the first action...

          Ulli Hafner added a comment - The problem only occurs with the maven project type, freestyle project should already pick both files. I think it is not possible to merge these files since the maven build type invokes Checkstyle directly after the goal has been finished. An additional plug-in is also somewhat an overkill, since the parser still is the same. There are two possibilities: Add a new reporter class responsible for ScalaStyle (This is then an additional post build step with separate configuration). Then there will be two results (and links) available, one for Java and one for Scala. Aggregate the results. I'm not sure how easy that approach is since I need to load and discard the first action...

          Jan Goyvaerts added a comment -

          I am already doing (2) but wasn't aware one *Style would erase the results of the other one. So I might ask both to dump into separate files and merge manually. I'll have a go at that. At least now the cause is known. However, I have no clue as to how durably fix this really. I guess apply (1).

          What I am surprised though is why the results are erased at the first place. How come CheckStyle erases a file named scalastyle-output.xml ?

          Jan Goyvaerts added a comment - I am already doing (2) but wasn't aware one *Style would erase the results of the other one. So I might ask both to dump into separate files and merge manually. I'll have a go at that. At least now the cause is known. However, I have no clue as to how durably fix this really. I guess apply (1). What I am surprised though is why the results are erased at the first place. How come CheckStyle erases a file named scalastyle-output.xml ?

          Ulli Hafner added a comment -

          My plug-in does not erase anything Checkstyle creates the checkstyle.xml file that is read by my plugin afterwards. After that, Scalastyle creates scalastyle.cml. This file is not read anymore since there is already a result available. So it won't help to merge the results. With the maven project type, you can change the file names of the results since these information is read from the pom.

          Ulli Hafner added a comment - My plug-in does not erase anything Checkstyle creates the checkstyle.xml file that is read by my plugin afterwards. After that, Scalastyle creates scalastyle.cml. This file is not read anymore since there is already a result available. So it won't help to merge the results. With the maven project type, you can change the file names of the results since these information is read from the pom.

          Jan Goyvaerts added a comment -

          Would it help to run the two in separate invocations ? First 'mvn scalastyle:check' followed by 'mvn checkstyle:checkstyle'. As a workaround of course.

          I have no clue how to durably fix this - as I never wrote a Jenkins- or Maven plugin.

          Jan Goyvaerts added a comment - Would it help to run the two in separate invocations ? First 'mvn scalastyle:check' followed by 'mvn checkstyle:checkstyle'. As a workaround of course. I have no clue how to durably fix this - as I never wrote a Jenkins- or Maven plugin.

          Ulli Hafner added a comment -

          Released in 5.0.0-beta2.

          Ulli Hafner added a comment - Released in 5.0.0-beta2.

            drulli Ulli Hafner
            jan_goyvaerts Jan Goyvaerts
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: