File tree Expand file tree Collapse file tree 7 files changed +65
-2
lines changed
skip-sbt1.4/scalafixEnable Expand file tree Collapse file tree 7 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ object ScalafixPlugin extends AutoPlugin {
9898 def scalafixConfigSettings (config : Configuration ): Seq [Def .Setting [? ]] =
9999 inConfig(config)(
100100 relaxScalacOptionsConfigSettings ++ Seq (
101+ config / scalafix / skip := (config / scalafix / skip).value ||
102+ Seq (" 2.10" , " 2.11" ).contains(scalaBinaryVersion.value),
101103 scalafix := {
102104 // force evaluation of keys looked up in the same scope (config) within
103105 // dynamic tasks to workaround https://github.com/sbt/sbt/issues/5647
@@ -502,7 +504,14 @@ object ScalafixPlugin extends AutoPlugin {
502504 }
503505 }
504506 }
505- task.tag(Scalafix )
507+ Def .taskDyn {
508+ if (! (config / scalafix / skip).value)
509+ task.tag(Scalafix )
510+ else
511+ Def .task {
512+ (config / scalafix / streams).value.log.info(" Skipping scalafix" )
513+ }
514+ }
506515 }
507516
508517 private def scalafixSyntactic (
Original file line number Diff line number Diff line change 1+ rules = [DisableSyntax ]
2+ DisableSyntax.noNulls = true
Original file line number Diff line number Diff line change 1+ resolvers += Resolver .sonatypeRepo(" public" )
2+ addSbtPlugin(" ch.epfl.scala" % " sbt-scalafix" % sys.props(" plugin.version" ))
Original file line number Diff line number Diff line change 1+ object Null1 {
2+ println(null )
3+ }
Original file line number Diff line number Diff line change 1+ object Null2 {
2+ println(null )
3+ }
Original file line number Diff line number Diff line change 1+ -> scalafix
2+ -> Test / scalafix
3+ -> scalafixAll
4+
5+ ##############################
6+ # Project level
7+ ##############################
8+ > set skip := true
9+
10+ > scalafix
11+ > Test / scalafix
12+ > scalafixAll
13+
14+ > set skip := false
15+
16+ ##############################
17+ # Task level
18+ ##############################
19+ > set scalafix / skip := true
20+
21+ > scalafix
22+ > Test / scalafix
23+ > scalafixAll
24+
25+ > set scalafix / skip := false
26+
27+ ##############################
28+ # Config / Task level
29+ ##############################
30+ > set Test / scalafix / skip := true
31+
32+ -> scalafix
33+ > Test / scalafix
34+ -> scalafixAll
35+
36+ > set Compile / skip := true
37+
38+ > scalafix
39+ > Test / scalafix
40+ > scalafixAll
41+
Original file line number Diff line number Diff line change 1313# check that we can run a semantic rule against a Scala 3 dialect source file
1414-> scala3 / scalafix --check SemanticRule
1515> scala3 / scalafix SemanticRule
16- > scala3 / scalafix --check SemanticRule
16+ > scala3 / scalafix --check SemanticRule
17+
18+ # check that a global, aggregating scalafix is safe as unsupported projects are ignored
19+ > scalafix
You can’t perform that action at this time.
0 commit comments