From 698f99a710cf7c5c43e5d748b23df2719a615400 Mon Sep 17 00:00:00 2001 From: Brice Jaglin Date: Tue, 13 Aug 2024 08:58:44 +0200 Subject: [PATCH] avoid deprecated old shell syntax https://github.com/sbt/sbt/commit/2305abd81ead3533920c960fa5e20384a6541c3d --- .../scala/scalafix/sbt/ScalafixPlugin.scala | 2 +- src/sbt-test/sbt-1.5/scalafixEnable/test | 16 ++++---- src/sbt-test/sbt-1.5/testkit/test | 6 +-- src/sbt-test/sbt-scalafix/basic/test | 8 ++-- src/sbt-test/sbt-scalafix/cross-build/test | 40 +++++++++---------- .../sbt-scalafix/custom-src-directory/test | 6 +-- src/sbt-test/sbt-scalafix/inconfig/test | 18 ++++----- src/sbt-test/sbt-scalafix/local-rules/test | 12 +++--- .../sbt-scalafix/relax-scalacOptions/test | 2 +- .../sbt-scalafix/root-validation/test | 6 +-- src/sbt-test/sbt-scalafix/scalafixEnable/test | 6 +-- .../sbt-scalafix/scalafixOnCompile/test | 26 ++++++------ .../sbt-scalafix/semanticdb-enabled/test | 12 +++--- src/sbt-test/sbt-scalafix/suppress/test | 6 +-- src/sbt-test/skip-windows/caching/test | 34 ++++++++-------- 15 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/main/scala/scalafix/sbt/ScalafixPlugin.scala b/src/main/scala/scalafix/sbt/ScalafixPlugin.scala index 1242584a..6dc1da83 100644 --- a/src/main/scala/scalafix/sbt/ScalafixPlugin.scala +++ b/src/main/scala/scalafix/sbt/ScalafixPlugin.scala @@ -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] = diff --git a/src/sbt-test/sbt-1.5/scalafixEnable/test b/src/sbt-test/sbt-1.5/scalafixEnable/test index 3deb3b46..f9664229 100644 --- a/src/sbt-test/sbt-1.5/scalafixEnable/test +++ b/src/sbt-test/sbt-1.5/scalafixEnable/test @@ -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 \ No newline at end of file +-> scala3 / scalafix --check SemanticRule +> scala3 / scalafix SemanticRule +> scala3 / scalafix --check SemanticRule \ No newline at end of file diff --git a/src/sbt-test/sbt-1.5/testkit/test b/src/sbt-test/sbt-1.5/testkit/test index 775b00ef..f6b0ddac 100644 --- a/src/sbt-test/sbt-1.5/testkit/test +++ b/src/sbt-test/sbt-1.5/testkit/test @@ -1,3 +1,3 @@ --> tests/test -> testsTarget2_13/test:run --save-expect -> tests/test +-> tests / test +> testsTarget2_13 / Test / run --save-expect +> tests / test diff --git a/src/sbt-test/sbt-scalafix/basic/test b/src/sbt-test/sbt-scalafix/basic/test index 06da863e..7d7b65f0 100644 --- a/src/sbt-test/sbt-scalafix/basic/test +++ b/src/sbt-test/sbt-scalafix/basic/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/cross-build/test b/src/sbt-test/sbt-scalafix/cross-build/test index 3e4b8c04..005052f4 100644 --- a/src/sbt-test/sbt-scalafix/cross-build/test +++ b/src/sbt-test/sbt-scalafix/cross-build/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/custom-src-directory/test b/src/sbt-test/sbt-scalafix/custom-src-directory/test index 353d25b5..71fe2353 100644 --- a/src/sbt-test/sbt-scalafix/custom-src-directory/test +++ b/src/sbt-test/sbt-scalafix/custom-src-directory/test @@ -1,3 +1,3 @@ --> app/scalafix --test ProcedureSyntax -> app/scalafix ProcedureSyntax -> app/scalafix --test ProcedureSyntax \ No newline at end of file +-> app / scalafix --test ProcedureSyntax +> app / scalafix ProcedureSyntax +> app / scalafix --test ProcedureSyntax \ No newline at end of file diff --git a/src/sbt-test/sbt-scalafix/inconfig/test b/src/sbt-test/sbt-scalafix/inconfig/test index 278899a0..1c1e040a 100644 --- a/src/sbt-test/sbt-scalafix/inconfig/test +++ b/src/sbt-test/sbt-scalafix/inconfig/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/local-rules/test b/src/sbt-test/sbt-scalafix/local-rules/test index fbe71e93..15808542 100644 --- a/src/sbt-test/sbt-scalafix/local-rules/test +++ b/src/sbt-test/sbt-scalafix/local-rules/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/relax-scalacOptions/test b/src/sbt-test/sbt-scalafix/relax-scalacOptions/test index 678f60ff..273d23e2 100644 --- a/src/sbt-test/sbt-scalafix/relax-scalacOptions/test +++ b/src/sbt-test/sbt-scalafix/relax-scalacOptions/test @@ -7,7 +7,7 @@ # ... and indirect scalafix invocation > clean -> test:scalafix --check RemoveUnused +> Test / scalafix --check RemoveUnused -> checkLastCompilationCached > compile > checkLastCompilationCached diff --git a/src/sbt-test/sbt-scalafix/root-validation/test b/src/sbt-test/sbt-scalafix/root-validation/test index 55d8f8c9..0d3f6706 100644 --- a/src/sbt-test/sbt-scalafix/root-validation/test +++ b/src/sbt-test/sbt-scalafix/root-validation/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/scalafixEnable/test b/src/sbt-test/sbt-scalafix/scalafixEnable/test index c43cb601..adf36307 100644 --- a/src/sbt-test/sbt-scalafix/scalafixEnable/test +++ b/src/sbt-test/sbt-scalafix/scalafixEnable/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/scalafixOnCompile/test b/src/sbt-test/sbt-scalafix/scalafixOnCompile/test index 7af329a5..81509374 100644 --- a/src/sbt-test/sbt-scalafix/scalafixOnCompile/test +++ b/src/sbt-test/sbt-scalafix/scalafixOnCompile/test @@ -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 diff --git a/src/sbt-test/sbt-scalafix/semanticdb-enabled/test b/src/sbt-test/sbt-scalafix/semanticdb-enabled/test index 826b64e8..11f6e281 100644 --- a/src/sbt-test/sbt-scalafix/semanticdb-enabled/test +++ b/src/sbt-test/sbt-scalafix/semanticdb-enabled/test @@ -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 \ No newline at end of file +-> scala213 / scalafix --check +> scala213 / scalafix +> scala213 / scalafix --check \ No newline at end of file diff --git a/src/sbt-test/sbt-scalafix/suppress/test b/src/sbt-test/sbt-scalafix/suppress/test index 2643ea09..2b6e5199 100644 --- a/src/sbt-test/sbt-scalafix/suppress/test +++ b/src/sbt-test/sbt-scalafix/suppress/test @@ -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 diff --git a/src/sbt-test/skip-windows/caching/test b/src/sbt-test/skip-windows/caching/test index dfe6b223..a0bc326d 100644 --- a/src/sbt-test/skip-windows/caching/test +++ b/src/sbt-test/skip-windows/caching/test @@ -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 @@ -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 @@ -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) @@ -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 @@ -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 @@ -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