etsy / sbt-checkstyle-plugin Goto Github PK
View Code? Open in Web Editor NEWSBT Plugin for Running Checkstyle on Java Sources
License: MIT License
SBT Plugin for Running Checkstyle on Java Sources
License: MIT License
The current SBT version is 1.1.0.
It could be better to upgrade to get all improvements to the project.
What do you think? I could provide a PR to upgrade it.
In Java 17 the Security Manager is deprecated. Are there any plans to provide a different solution for what now is solved via the NoExitSecurityManager
?
I have multi-module project. When I try to use checkstyle
in any of my submodules I am getting the following error:
java.lang.NoSuchMethodError: org.apache.commons.cli.Options.hasShortOption(Ljava/lang/String;)Z
Any idea?
This plugin uses checkstyle 6.15, released over 2 years ago. The current version is 8.8: https://github.com/checkstyle/checkstyle/releases
It would be great if this could be upgraded. The maven checkstyle makes it possible to choose the version of checkstyle at runtime: https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html
I am trying to configure the fail build case,
This is my build.sbt
import com.etsy.sbt.Checkstyle.CheckstyleSeverityLevel._
com.etsy.sbt.Checkstyle.CheckstyleTasks.checkstyleSeverityLevel := Some(CheckstyleSeverityLevel.Error)
I keep on getting the following error. I am using play 2.4.x, Scala 2.11.6 and sbt version is 0.13.8
build.sbt:31: error: value CheckstyleSeverityLevel is not a member of object com.etsy.sbt.Checkstyle
import com.etsy.sbt.Checkstyle.CheckstyleSeverityLevel._
^
sbt.compiler.EvalException: Type error in expression
at sbt.compiler.Eval.checkError(Eval.scala:384)
at sbt.compiler.Eval.compileAndLoad(Eval.scala:183)
at sbt.compiler.Eval.evalCommon(Eval.scala:152)
at sbt.compiler.Eval.evalDefinitions(Eval.scala:122)
at sbt.EvaluateConfigurations$.evaluateDefinitions(EvaluateConfigurations.scala:271)
at sbt.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:109)
at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:712)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:717)
at sbt.Load$$anonfun$sbt$Load$$memoLoadSettingsFile$1$1.apply(Load.scala:716)
at scala.collection.MapLike$class.getOrElse(MapLike.scala:128)
at scala.collection.AbstractMap.getOrElse(Map.scala:58)
at sbt.Load$.sbt$Load$$memoLoadSettingsFile$1(Load.scala:716)
at sbt.Load$$anonfun$loadFiles$1$2.apply(Load.scala:723)
at sbt.Load$$anonfun$loadFiles$1$2.apply(Load.scala:723)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at sbt.Load$.loadFiles$1(Load.scala:723)
at sbt.Load$.discoverProjects(Load.scala:734)
at sbt.Load$.discover$1(Load.scala:545)
at sbt.Load$.loadTransitive(Load.scala:574)
at sbt.Load$.loadProjects$1(Load.scala:442)
at sbt.Load$.loadUnit(Load.scala:446)
at sbt.Load$$anonfun$18$$anonfun$apply$11.apply(Load.scala:281)
at sbt.Load$$anonfun$18$$anonfun$apply$11.apply(Load.scala:281)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:91)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:90)
at sbt.BuildLoader.apply(BuildLoader.scala:140)
at sbt.Load$.loadAll(Load.scala:334)
at sbt.Load$.loadURI(Load.scala:289)
at sbt.Load$.load(Load.scala:285)
at sbt.Load$.load(Load.scala:276)
at sbt.Load$.apply(Load.scala:130)
at sbt.Load$.defaultLoad(Load.scala:36)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:481)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$.process(Command.scala:92)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.State$$anon$1.process(State.scala:184)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.MainLoop$.next(MainLoop.scala:98)
at sbt.MainLoop$.run(MainLoop.scala:91)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:70)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:65)
at sbt.Using.apply(Using.scala:24)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:65)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:48)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:32)
at sbt.MainLoop$.runLogged(MainLoop.scala:24)
at sbt.StandardMain$.runManaged(Main.scala:53)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
Hi,
I am using this plugin on my project which has quite a lot sub-projects.
So the issue is after I type sbt checkstyle, it exits sbt in random number of sub-projects, or work very well sometimes.
Working well refers to it can generate reports for all sub-projects.
It seems like this plugin randomly picks up a sub-project to work and exits SBT with unknown reasons.
Any ideas about how to fix it is really appreciated!
At the moment, the plugin does not support formatting of the XML report by using an XLST style sheet. Would it be possible to add this feature? (Reading the XML itself isn't as easy as reading a formatted version.) I believe that checkstyle itself includes style files that could be used.
Like https://github.com/Redmart/sbt-checkstyle-plugin
We might also want to support class path resources like the Maven checkstyle plugin https://maven.apache.org/plugins/maven-checkstyle-plugin/checkstyle-mojo.html#configLocation
The scripted checkstyle/xslt
test fails on Travis despite working locally. It is currently not running as part of the CI build, but this test should be fixed to pass there.
Set up scalastyle for the project and run it in Travis to ensure a consistent code style.
I have a mulit project. One of those projects consists mainly of generated code and I don't want to run checkstyle on those files. Is there a way to specific a subdirectory to run checkstyle on instead of the entire project?
I know this is really a problem between two saxon packages but it shows up any time I try to apply an XSLT to checkstyle.
java.lang.NoSuchMethodError: net.sf.saxon.Configuration.setProcessor(Ljava/lang/Object;)V
at net.sf.saxon.s9api.Processor.(Processor.java:68)
at com.etsy.sbt.checkstyle.Checkstyle$.applyXSLT(Checkstyle.scala:106)
at com.etsy.sbt.checkstyle.Checkstyle$.checkstyle(Checkstyle.scala:56)
See http://www.scala-sbt.org/0.13/docs/Plugins.html for more info
Since this would be a breaking change, maybe we should also do some or all of the following:
I am using checkstyle 7.1 version
with this plugin. sbt checkstyle
command run file and generate report into xml successfully. But when i am using xslt trasnforamtion from xml to html, i am getting following error:
Error at checkstyle on line 2 column 27 of checkstyle-report.xml:
XTSE0150: The supplied file does not appear to be a stylesheet
net.sf.saxon.s9api.SaxonApiException: The supplied file does not appear to be a stylesheet
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:546)
at com.etsy.sbt.checkstyle.Checkstyle$$anonfun$applyXSLT$1.apply(Checkstyle.scala:112)
at com.etsy.sbt.checkstyle.Checkstyle$$anonfun$applyXSLT$1.apply(Checkstyle.scala:109)
at scala.collection.immutable.Set$Set1.foreach(Set.scala:74)
at com.etsy.sbt.checkstyle.Checkstyle$.applyXSLT(Checkstyle.scala:109)
at com.etsy.sbt.checkstyle.Checkstyle$.checkstyle(Checkstyle.scala:56)
at com.etsy.sbt.checkstyle.CheckstylePlugin$autoImport$$anonfun$checkstyleTask$1.apply(CheckstylePlugin.scala:35)
at com.etsy.sbt.checkstyle.CheckstylePlugin$autoImport$$anonfun$checkstyleTask$1.apply(CheckstylePlugin.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
-----------------------------------------------------
Would be nice to have some instructions on how to:
This causes an exception.
lazy val root = (project in file("."))
.disablePlugins(CheckstylePlugin, plugins.JUnitXmlReportPlugin)
This too.
lazy val root = (project in file("."))
.enablePlugins(de.johoop.cpd4sbt.CopyPasteDetector)
.disablePlugins(CheckstylePlugin)
Either of them without the CheckstylePlugin line works.
Exception:
[error] sbt.AutoPluginException: Error determining plugins for project 'root' in D:\dev\java\test:
[error] Contradiction in selected plugins. These plugins were both included and excluded: com.etsy.sbt.checkstyle.CheckstylePlugin
sbt 0.13.12, plugin 3.0.0
Latest Checkstyle versions include some improvements, including support for Lambdas.
Is there a way to get a json style report instead of xml? I want to import the style check into sonarqube but it doesn't take xml. Also, what is the intended way to view the existing xml style report?
Something like a setting checkstyleFailOnError (boolean) or checkstyleCheckSeverityLevel (string/enum) that can be set to fail a build if the code fails style checks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.