Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid deprecated old shell syntax #324

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -32,7 +32,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
16 changes: 8 additions & 8 deletions src/sbt-test/sbt-1.5/scalafixEnable/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
> scalafixEnable

# check that projects not supported by sbt-scalafix can still compile
> scala210/compile
> scala211/compile
> scala210 / compile
> scala211 / compile

# check that we can run a semantic rule against a Scala 2.12 dialect source file
-> scala212/scalafix --check SemanticRule
> scala212/scalafix SemanticRule
> scala212/scalafix --check SemanticRule
-> scala212 / scalafix --check SemanticRule
> scala212 / scalafix SemanticRule
> scala212 / scalafix --check SemanticRule

# check that we can run a semantic rule against a Scala 3 dialect source file
-> scala3/scalafix --check SemanticRule
> scala3/scalafix SemanticRule
> scala3/scalafix --check SemanticRule
-> scala3 / scalafix --check SemanticRule
> scala3 / scalafix SemanticRule
> scala3 / scalafix --check SemanticRule
6 changes: 3 additions & 3 deletions 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
> tests/test
-> tests / test
> testsTarget2_13 / Test / run --save-expect
> tests / test
8 changes: 4 additions & 4 deletions src/sbt-test/sbt-scalafix/basic/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-> example/scalafix --test
-> example / scalafix --test
$ sleep 2000
> checkLogs
> example/scalafix
> example/scalafix --test
> tests/test
> example / scalafix
> example / scalafix --test
> tests / test
40 changes: 20 additions & 20 deletions src/sbt-test/sbt-scalafix/cross-build/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@

-> scalafixAll --test ProcedureSyntax
-> scalafix --test ProcedureSyntax
-> compile:scalafix --test ProcedureSyntax
-> test:scalafix --test ProcedureSyntax
-> it:scalafix --test ProcedureSyntax
-> Compile / scalafix --test ProcedureSyntax
-> Test / scalafix --test ProcedureSyntax
-> IntegrationTest / scalafix --test ProcedureSyntax

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

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

> scalafixAll ProcedureSyntax
> it:scalafix --test ProcedureSyntax
> IntegrationTest / scalafix --test ProcedureSyntax

> javaProject/compile:scalafix ProcedureSyntax
> javaProject / Compile /scalafix ProcedureSyntax

# it config exists only for 2.12
> it:scalafix
# IntegrationTest exists only for scala212
> IntegrationTest / scalafix

> scala212/compile:scalafix
> scala212/test:scalafix
> scala212/it:scalafix
> scala212/compile:scalafix --test
> scala212/test:scalafix --test
> scala212/it:scalafix --test
> scala212 / Compile / scalafix
> scala212 / Test / scalafix
> scala212 / IntegrationTest / scalafix
> scala212 / Compile / scalafix --test
> scala212 / Test / scalafix --test
> scala212 / IntegrationTest / scalafix --test
6 changes: 3 additions & 3 deletions src/sbt-test/sbt-scalafix/custom-src-directory/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-> app/scalafix --test ProcedureSyntax
> app/scalafix ProcedureSyntax
> app/scalafix --test ProcedureSyntax
-> app / scalafix --test ProcedureSyntax
> app / scalafix ProcedureSyntax
> app / scalafix --test ProcedureSyntax
18 changes: 9 additions & 9 deletions src/sbt-test/sbt-scalafix/inconfig/test
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-> ; example/scalafix --test ; example/it:scalafix --test
-> example/scalafixAll --test
> example/it:scalafix
> example/it:scalafix --test
-> example/scalafix --test
> tests/test
> example/scalafixAll
> example/scalafixAll --test
> example/scalafix --test
-> ; example / scalafix --test ; example / IntegrationTest / scalafix --test
-> example / scalafixAll --test
> example / IntegrationTest / scalafix
> example / IntegrationTest / scalafix --test
-> example / scalafix --test
> tests / test
> example / scalafixAll
> example / scalafixAll --test
> example / scalafix --test
12 changes: 6 additions & 6 deletions src/sbt-test/sbt-scalafix/local-rules/test
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
> service/scalafix LocalSyntacticRule
> 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
-> service / scalafix LocalSyntacticRule

# make sure scalafixDependencies is also honored by running a rule from a remote JAR
> service/scalafix SyntacticRule
> service / scalafix SyntacticRule

# run a rule included from a remote JAR referenced via the Scalafix ivy config
> service/scalafix SyntacticRule
> service / scalafix SyntacticRule

> sameproject/scalafix SameProjectSyntacticRule
> sameproject / scalafix SameProjectSyntacticRule
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-scalafix/relax-scalacOptions/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# ... and indirect scalafix invocation
> clean
> test:scalafix --check RemoveUnused
> Test / scalafix --check RemoveUnused
-> checkLastCompilationCached
> compile
> checkLastCompilationCached
Expand Down
6 changes: 3 additions & 3 deletions src/sbt-test/sbt-scalafix/root-validation/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-> root/scalafix --check RemoveUnused
> root/scalafix RemoveUnused
> root/scalafix --check RemoveUnused
-> root / scalafix --check RemoveUnused
> root / scalafix RemoveUnused
> root / scalafix --check RemoveUnused
6 changes: 3 additions & 3 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

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

-> checkVersion
> ++2.12.15 -v
Expand Down
26 changes: 13 additions & 13 deletions src/sbt-test/sbt-scalafix/scalafixOnCompile/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
> scalafix --check

# check explicit rewrite of rewrite/src/it/scala/UnusedImports.scala via `scalafix`
-> it:scalafix --check
> it:scalafix
> it:scalafix --check
-> IntegrationTest / scalafix --check
> IntegrationTest / scalafix
> IntegrationTest / 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
12 changes: 6 additions & 6 deletions src/sbt-test/sbt-scalafix/semanticdb-enabled/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-> scala212/scalafix --check
> scala212/scalafix
> scala212/scalafix --check
-> scala212 / scalafix --check
> scala212 / scalafix
> scala212 / scalafix --check

-> scala213/scalafix --check
> scala213/scalafix
> scala213/scalafix --check
-> scala213 / scalafix --check
> scala213 / scalafix
> scala213 / scalafix --check
6 changes: 3 additions & 3 deletions src/sbt-test/sbt-scalafix/suppress/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
> scalafixEnable
-> compile:scalafix --test
> compile:scalafix --auto-suppress-linter-errors
> compile:scalafix --test
-> Compile / scalafix --test
> Compile / scalafix --auto-suppress-linter-errors
> Compile / scalafix --test

> check
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 @@ -254,11 +254,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 @@ -271,12 +271,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 @@ -334,7 +334,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