• 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. merged.xml
          1 kB
        2. scalastyle-output.xml
          0.5 kB
        3. pom.xml
          5 kB
        4. scalastyle-output.xml
          56 kB
        5. Bildschirmfoto 2015-03-16 um 22.59.41.png
          Bildschirmfoto 2015-03-16 um 22.59.41.png
          40 kB

          [JENKINS-17287] Provide support for ScalaStyle warnings

          Jan Goyvaerts created issue -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/test/java/hudson/plugins/checkstyle/parser/CheckStyleParserTest.java
          src/test/resources/hudson/plugins/checkstyle/parser/scalastyle-output.xml
          http://jenkins-ci.org/commit/checkstyle-plugin/0c1c01107d4868abde597cb9c880de538b65f725
          Log:
          JENKINS-17287 Added testcase that parses a Scala Style file.


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/test/java/hudson/plugins/checkstyle/parser/CheckStyleParserTest.java src/test/resources/hudson/plugins/checkstyle/parser/scalastyle-output.xml http://jenkins-ci.org/commit/checkstyle-plugin/0c1c01107d4868abde597cb9c880de538b65f725 Log: JENKINS-17287 Added testcase that parses a Scala Style file. – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          Ulli Hafner added a comment -

          Jan, can you please check the console log of your build (there should be some [CHECKSTYLE] messages). I added a unit test that simply parses your file: it worked out of the box! I.e., it should already work in your case. What file pattern did you specify? (Or did you use a maven job type?)

          Ulli Hafner added a comment - Jan, can you please check the console log of your build (there should be some [CHECKSTYLE] messages). I added a unit test that simply parses your file: it worked out of the box! I.e., it should already work in your case. What file pattern did you specify? (Or did you use a maven job type?)

          Jan Goyvaerts added a comment -

          It is a maven job indeed.

          This is what I get on the console:

          [CHECKSTYLE] Parsing file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/checkstyle-result.xml
          [CHECKSTYLE] Successfully parsed file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/checkstyle-result.xml of module Optimus web application with 4 warnings.
          [CHECKSTYLE] Computing warning deltas based on reference build #134

          ScalaStyle generates scalastyle_output.xml in the same directory as checkstyle-result.xml.

          Maybe it a matter of precedence ? It surely looks like I'm patching checkstyle-result.xml on time. But maybe that's not the case.

          Jan Goyvaerts added a comment - It is a maven job indeed. This is what I get on the console: [CHECKSTYLE] Parsing file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/checkstyle-result.xml [CHECKSTYLE] Successfully parsed file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/checkstyle-result.xml of module Optimus web application with 4 warnings. [CHECKSTYLE] Computing warning deltas based on reference build #134 ScalaStyle generates scalastyle_output.xml in the same directory as checkstyle-result.xml. Maybe it a matter of precedence ? It surely looks like I'm patching checkstyle-result.xml on time. But maybe that's not the case.

          Ulli Hafner added a comment -

          Ok, then I understand why it does not work In maven, I read information from the pom to determine the goal and the filename. Can you please attach the corresponding logging output from your maven build, so I can adapt that part of the code (something like checkstyle:checkstyle ...).

          In the meantime as a workaround: switch to a freestyle project. There you can specify the correct file name.
          (What still is missing: support for the message texts. Since these are in a different format this needs a new message parser).

          Ulli Hafner added a comment - Ok, then I understand why it does not work In maven, I read information from the pom to determine the goal and the filename. Can you please attach the corresponding logging output from your maven build, so I can adapt that part of the code (something like checkstyle:checkstyle ...). In the meantime as a workaround: switch to a freestyle project. There you can specify the correct file name. (What still is missing: support for the message texts. Since these are in a different format this needs a new message parser).

          Jan Goyvaerts added a comment -

          I'm not exactly sure what you mean - the output of checkstyle:checkstyle is always those three lines, for each module. (it's a multi-module btw)

          But since you parse the pom for the name of the file, I guess this is what you want ?

          <plugin>
          <groupId>org.scalastyle</groupId>
          <artifactId>scalastyle-maven-plugin</artifactId>
          <version>0.2.0</version>
          <configuration>
          <verbose>true</verbose>
          <failOnViolation>false</failOnViolation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <failOnWarning>false</failOnWarning>
          <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
          <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
          <configLocation>${scalastyle.config}</configLocation>
          <outputFile>${project.basedir}/target/scalastyle-output.xml</outputFile>
          <outputEncoding>UTF-8</outputEncoding>
          </configuration>
          <executions>
          <execution>
          <goals>
          <goal>check</goal>
          </goals>
          </execution>
          </executions>
          </plugin>

          Jan Goyvaerts added a comment - I'm not exactly sure what you mean - the output of checkstyle:checkstyle is always those three lines, for each module. (it's a multi-module btw) But since you parse the pom for the name of the file, I guess this is what you want ? <plugin> <groupId>org.scalastyle</groupId> <artifactId>scalastyle-maven-plugin</artifactId> <version>0.2.0</version> <configuration> <verbose>true</verbose> <failOnViolation>false</failOnViolation> <includeTestSourceDirectory>true</includeTestSourceDirectory> <failOnWarning>false</failOnWarning> <sourceDirectory>${basedir}/src/main/scala</sourceDirectory> <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory> <configLocation>${scalastyle.config}</configLocation> <outputFile>${project.basedir}/target/scalastyle-output.xml</outputFile> <outputEncoding>UTF-8</outputEncoding> </configuration> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin>

          Ulli Hafner added a comment -

          Actually I need the output of your build when you invoke the scalastyle goal:

          [INFO] 
          [INFO] --- maven-checkstyle-plugin:2.9.1:checkstyle (default-cli) @ checkstyle ---
          [INFO] 
          [WARNING] Unable to locate Source XRef to link to - DISABLED
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESS
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 19.944s
          [INFO] Finished at: Wed Mar 20 17:13:10 CET 2013
          [INFO] Final Memory: 26M/229M
          
          

          Or is there an example maven project somewhere available that I can use for tests (since I don't have a Scala maven project yet).

          Ulli Hafner added a comment - Actually I need the output of your build when you invoke the scalastyle goal: [INFO] [INFO] --- maven-checkstyle-plugin:2.9.1:checkstyle (default-cli) @ checkstyle --- [INFO] [WARNING] Unable to locate Source XRef to link to - DISABLED [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 19.944s [INFO] Finished at: Wed Mar 20 17:13:10 CET 2013 [INFO] Final Memory: 26M/229M Or is there an example maven project somewhere available that I can use for tests (since I don't have a Scala maven project yet).

          Jan Goyvaerts added a comment -

          There you are

          [INFO] — scalastyle-maven-plugin:0.2.0:check (default-cli) @ web —
          Processing Configuration for child elements
          Processing child [configLocation]
          Processing child [outputFile]
          Processing child [outputEncoding]
          Processing child [failOnViolation]
          Processing child [failOnWarning]
          Processing child [skip]
          Processing child [verbose]
          Processing child [quiet]
          Processing child [sourceDirectory]
          Processing child [testSourceDirectory]
          Processing child [includeTestSourceDirectory]
          Processing child [buildDirectory]
          Processing child [baseDirectory]
          Processing child [inputEncoding]
          [WARNING] sourceDirectory is not specified or does not exist value=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/main/scala
          Starting scalastyle
          start file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala
          warning file=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala message=Header does not match expected text line=1
          warning file=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala message=Whitespace at end of line line=33 column=20
          end file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala
          Saving to outputFile=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/scalastyle-output.xml
          Processed 1 file(s)
          Found 0 errors
          Found 2 warnings
          Finished in 590 ms

          Jan Goyvaerts added a comment - There you are [INFO] — scalastyle-maven-plugin:0.2.0:check (default-cli) @ web — Processing Configuration for child elements Processing child [configLocation] Processing child [outputFile] Processing child [outputEncoding] Processing child [failOnViolation] Processing child [failOnWarning] Processing child [skip] Processing child [verbose] Processing child [quiet] Processing child [sourceDirectory] Processing child [testSourceDirectory] Processing child [includeTestSourceDirectory] Processing child [buildDirectory] Processing child [baseDirectory] Processing child [inputEncoding] [WARNING] sourceDirectory is not specified or does not exist value=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/main/scala Starting scalastyle start file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala warning file=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala message=Header does not match expected text line=1 warning file=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala message=Whitespace at end of line line=33 column=20 end file /home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/src/test/scala/com/noesis/optimus/web/ScalatestLearningTest.scala Saving to outputFile=/home/jenkins/.jenkins/jobs/Static_code_analysis/workspace/web/target/scalastyle-output.xml Processed 1 file(s) Found 0 errors Found 2 warnings Finished in 590 ms

          Ulli Hafner added a comment -

          Ok, thanks! That should be enough to fix that problem in maven jobs...

          Ulli Hafner added a comment - Ok, thanks! That should be enough to fix that problem in maven jobs...
          Ulli Hafner made changes -
          Labels Original: scala scalastyle

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

              Created:
              Updated:
              Resolved: