Skip to content

Commit

Permalink
avoid deprecated old shell syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Nov 21, 2022
1 parent 5180759 commit 87668fe
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/scalafix/sbt/ScalafixPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object ScalafixPlugin extends AutoPlugin {
inputKey[Unit](
"Run scalafix rule(s) in this project and configuration. " +
"For example: scalafix RemoveUnused. " +
"To run on test sources use test:scalafix or scalafixAll. " +
"To run on test sources use Test/scalafix or scalafixAll. " +
"When invoked, prior compilation with -Xfatal-warnings relaxed will be triggered for semantic rules."
)
val scalafixAll: InputKey[Unit] =
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-1.5/testkit/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-> tests/test
> testsTarget2_13/test:run --save-expect
> testsTarget2_13/Test/run --save-expect
> tests/test
14 changes: 7 additions & 7 deletions src/sbt-test/sbt-scalafix/cross-build/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
-> scalafixAll --test ProcedureSyntax
-> scalafix --test ProcedureSyntax
-> compile:scalafix --test ProcedureSyntax
-> test:scalafix --test ProcedureSyntax
-> Test/scalafix --test ProcedureSyntax
-> it:scalafix --test ProcedureSyntax

> scalafix ProcedureSyntax
> scalafix --test ProcedureSyntax
> compile:scalafix ProcedureSyntax
> compile:scalafix --test ProcedureSyntax
-> test:scalafix --test ProcedureSyntax
-> Test/scalafix --test ProcedureSyntax
-> it:scalafix --test ProcedureSyntax

> test:scalafix ProcedureSyntax
> test:scalafix --test ProcedureSyntax
> Test/scalafix ProcedureSyntax
> Test/scalafix --test ProcedureSyntax
-> it:scalafix --test ProcedureSyntax

> scalafixAll ProcedureSyntax
Expand All @@ -25,13 +25,13 @@
# Should fail because 2.10 has no semanticdb
# Other >2.10 projects should succeed
-> compile:scalafix
-> test:scalafix
-> Test/scalafix
# it config exists only for 2.12
> it:scalafix

> scala212/compile:scalafix
> scala212/test:scalafix
> scala212/Test/scalafix
> scala212/it:scalafix
> scala212/compile:scalafix --test
> scala212/test:scalafix --test
> scala212/Test/scalafix --test
> scala212/it:scalafix --test
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-scalafix/local-rules/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
> service/scalafix LocalSyntacticRule

# ensure updates to the rule definition (that we make sure compiles first) is reflected in the next run
> rules/test:compile
> rules/Test/compile
$ copy-file rules/src/test/scala/local/Boom.scala rules/src/main/scala/local/Boom.scala
$ delete rules/src/main/scala/local/NoOp.scala
-> service/scalafix LocalSyntacticRule
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-scalafix/scalafixEnable/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
> scalafixEnable
> check

-> scala212/test:compile
-> scala212/Test/compile
> scala212/scalafixAll RemoveUnused
> scala212/test:compile
> scala212/Test/compile

-> checkVersion
> ++2.12.15 -v
Expand Down
20 changes: 10 additions & 10 deletions src/sbt-test/sbt-scalafix/scalafixOnCompile/test
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
> it:scalafix --check

# check lint for lint/src/test/scala/Null.scala
-> lint/test:scalafix --check
-> lint/test:scalafix
-> lint/test:compile
-> lint/Test/scalafix --check
-> lint/Test/scalafix
-> lint/Test/compile

# check that default rules are ignored when rules are passed explicitly
-> lint/test:scalafix --check
> lint/test:scalafix --check RemoveUnused
> lint/test:scalafix RemoveUnused
-> lint/Test/scalafix --check
> lint/Test/scalafix --check RemoveUnused
> lint/Test/scalafix RemoveUnused

# check configuration granularity for scalafixOnCompile
> set lint / Test / scalafixOnCompile := false
> lint/test:compile
> lint/Test/compile

# check that triggered rules are respected on compilation, and ignored on explicit invocation.
# `private var` is detected by `DisableSyntax.noVars = true` on explicit invocation,
# and removed by `triggered.RemoveUnused.privates = true` on compilation.
-> triggered/test:scalafix
> triggered/test:compile
> triggered/test:scalafix
-> triggered/Test/scalafix
> triggered/Test/compile
> triggered/Test/scalafix
34 changes: 17 additions & 17 deletions src/sbt-test/skip-windows/caching/test
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ $ copy-file files/ProcedureSyntax.scala src/test/scala/ToPatch.scala
$ copy-file files/Valid.scala src/test/scala/Valid.scala
# avoid rounding in mtime that could cause false negatives in `newer`
$ sleep 1000
> test:scalafix ProcedureSyntax DisableSyntax
> Test/scalafix ProcedureSyntax DisableSyntax
$ newer src/test/scala/ToPatch.scala src/test/scala/Valid.scala
$ exec chmod 000 src/test/scala/ToPatch.scala
-> test:scalafix ProcedureSyntax DisableSyntax
-> Test/scalafix ProcedureSyntax DisableSyntax
$ delete src/test/scala

# an added file after a successful run should be checked
Expand Down Expand Up @@ -90,8 +90,8 @@ $ delete src/main/scala
> set scalafixConfig := None
$ mkdir src/test/scala
$ copy-file files/ProcedureSyntax.scala src/test/scala/InitiallyValid.scala
> test:scalafix --check RemoveUnused
-> test:scalafix --check RemoveUnused ProcedureSyntax
> Test/scalafix --check RemoveUnused
-> Test/scalafix --check RemoveUnused ProcedureSyntax
$ delete src/test/scala

# updating the rule-related flags should not invalidate the cache as long as rules that will run do not change
Expand Down Expand Up @@ -144,13 +144,13 @@ $ delete src/main/scala
> set scalafixConfig := Some(file("files/DisableSyntaxVar.scalafix.conf"))
$ mkdir src/test/scala
$ copy-file files/Valid.scala src/test/scala/Valid.scala
> test:scalafix ProcedureSyntax
> test:scalafix --check
> Test/scalafix ProcedureSyntax
> Test/scalafix --check
$ exec chmod 000 src/test/scala/Valid.scala
> test:scalafix --check ProcedureSyntax DisableSyntax
> test:scalafix --syntactic ProcedureSyntax
> test:scalafix DisableSyntax ProcedureSyntax
> test:scalafix
> Test/scalafix --check ProcedureSyntax DisableSyntax
> Test/scalafix --syntactic ProcedureSyntax
> Test/scalafix DisableSyntax ProcedureSyntax
> Test/scalafix
$ delete src/test/scala

# files should be re-checked after updating the configuration (even if the rule is the same)
Expand Down Expand Up @@ -243,11 +243,11 @@ $ mkdir src/test/scala
$ copy-file files/UnusedImports.scala src/main/scala/Valid.scala
$ copy-file files/Null.scala src/test/scala/Valid.scala
> scalafix --check ProcedureSyntax
> test:scalafix --check ProcedureSyntax
> Test/scalafix --check ProcedureSyntax
$ exec chmod 000 src/main/scala/Valid.scala
$ exec chmod 000 src/test/scala/Valid.scala
> scalafix --check ProcedureSyntax
> test:scalafix --check ProcedureSyntax
> Test/scalafix --check ProcedureSyntax
$ delete src/main/scala
$ delete src/test/scala

Expand All @@ -260,12 +260,12 @@ $ copy-file files/ProcedureSyntax.scala src/test/scala/InitiallyInvalid.scala
-> scalafixAll --check ProcedureSyntax
$ exec chmod 000 src/main/scala/Valid.scala
> scalafix --check ProcedureSyntax
-> test:scalafix --check ProcedureSyntax
> test:scalafix ProcedureSyntax
> test:scalafix ProcedureSyntax
-> Test/scalafix --check ProcedureSyntax
> Test/scalafix ProcedureSyntax
> Test/scalafix ProcedureSyntax
$ exec chmod 000 src/test/scala/InitiallyInvalid.scala
> scalafix --check ProcedureSyntax
> test:scalafix --check ProcedureSyntax
> Test/scalafix --check ProcedureSyntax
> scalafixAll --check ProcedureSyntax
$ delete src/main/scala
$ delete src/test/scala
Expand Down Expand Up @@ -323,7 +323,7 @@ $ delete src/main/scala
$ mkdir src/main/scala
$ copy-file files/Valid.scala src/main/scala/InitiallyValid.scala
> scalafix LocalSyntacticRule
> rules/test:compile
> rules/Test/compile
$ copy-file rules/src/test/scala/local/Boom.scala rules/src/main/scala/local/Boom.scala
$ delete rules/src/main/scala/local/NoOp.scala
-> scalafix LocalSyntacticRule
Expand Down

0 comments on commit 87668fe

Please sign in to comment.