Skip to content

Commit

Permalink
Upgrade sbt and sbt plugins / Clean up
Browse files Browse the repository at this point in the history
* sbt-devoops to 3.0.0
* sbt-docusaur to 0.15.0
* Clean up the code as suggested by sbt-tpolecat
  • Loading branch information
kevin-lee committed Nov 23, 2023
1 parent baf02cf commit c421319
Show file tree
Hide file tree
Showing 22 changed files with 408 additions and 382 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ jobs:
strategy:
matrix:
scala:
- { name: "Scala", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "" }
# - { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.1
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.scala.java-version }}
distribution: ${{ matrix.scala.java-distribution }}

- name: Cache SBT
uses: actions/cache@v3
uses: actions/cache@v3.3.2
with:
path: |
~/.ivy2/cache
Expand All @@ -40,13 +42,13 @@ jobs:
restore-keys: |
${{ runner.os }}-sbt
- name: "[Push] Build All for ${{ matrix.scala.name }} - ${{ github.run_number }}"
- name: "[Push] Build All for ${{ matrix.scala.name }} v${{ matrix.scala.version }} - ${{ github.run_number }}"
if: github.event_name == 'push'
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
run: |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"
Expand All @@ -55,28 +57,30 @@ jobs:
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "Push #${PUSH_NUMBER}"
java -version
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
sbt \
"+scalafixAll --check" \
+scalafmtCheckAll
++${{ matrix.scala.version }}! \
"scalafixAll --check" \
scalafmtCheckAll
- name: "[PR] Build All for ${{ matrix.scala.name }} - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}"
- name: "[PR] Build All for ${{ matrix.scala.name }} v${{ matrix.scala.version }} - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}"
if: github.event_name == 'pull_request'
env:
CURRENT_BRANCH_NAME: ${{ github.base_ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
run: |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "PR #${PR_NUMBER}"
java -version
echo "JAVA_OPTS=${JAVA_OPTS}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
sbt \
"+scalafixAll --check" \
+scalafmtCheckAll
++${{ matrix.scala.version }}! \
"scalafixAll --check" \
scalafmtCheckAll
126 changes: 73 additions & 53 deletions .scalafix-scala2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,78 @@ rules = [
LeakingImplicitClassVal
NoValInForComprehension
ProcedureSyntax
RedundantSyntax
RemoveUnused

# xuwei-k/scalafix-rules
AddExplicitImplicitTypes
AddLambdaParamParentheses
CirceCodec
CollectHead
CollectHeadOption

FlatTraverse
ImplicitValueClass
KindProjector
LambdaParamParentheses
MapDistinctSize
MapSequenceTraverse
NoElse
ObjectSelfType
OptionMapFlatMap
OptionMatchToRight

SimplifyForYield
ThrowableToNonFatal
UnnecessaryCase
UnnecessaryMatch
UnnecessarySort

UnusedConstructorParams
UnusedTypeParams
WithFilter
]
DisableSyntax.noVars = true
DisableSyntax.noThrows = true
DisableSyntax.noNulls = true
DisableSyntax.noReturns = true
DisableSyntax.noWhileLoops = true
DisableSyntax.noAsInstanceOf = true
DisableSyntax.noIsInstanceOf = true
DisableSyntax.noXml = true
DisableSyntax.noDefaultArgs = true
DisableSyntax.noFinalVal = true
DisableSyntax.noFinalize = true
DisableSyntax.noValPatterns = true
DisableSyntax.regex = []

DisableSyntax {
noVars = true
noThrows = true
noNulls = true
noReturns = true
noWhileLoops = true
noAsInstanceOf = true
noIsInstanceOf = true
noXml = true
noDefaultArgs = true
noFinalVal = true
noFinalize = true
noValPatterns = true
regex = []
}

RemoveUnused {
imports = true
privates = true
locals = true
patternvars = true
params = true
}
//rules = [
// DisableSyntax
// LeakingImplicitClassVal
// NoValInForComprehension
// ProcedureSyntax
// RedundantSyntax
// RemoveUnused
//
// # xuwei-k/scalafix-rules
// AddExplicitImplicitTypes
// AddLambdaParamParentheses
// CirceCodec
// CollectHead
// CollectHeadOption
//
// FlatTraverse
// ImplicitValueClass
// KindProjector
// LambdaParamParentheses
// MapDistinctSize
// MapSequenceTraverse
// NoElse
// ObjectSelfType
// OptionMapFlatMap
// OptionMatchToRight
//
// SimplifyForYield
// ThrowableToNonFatal
// UnnecessaryCase
// UnnecessaryMatch
// UnnecessarySort
//
// UnusedConstructorParams
// UnusedTypeParams
// WithFilter
//]
//
//DisableSyntax {
// noVars = true
// noThrows = true
// noNulls = true
// noReturns = true
// noWhileLoops = true
// noAsInstanceOf = true
// noIsInstanceOf = true
// noXml = true
// noDefaultArgs = true
// noFinalVal = true
// noFinalize = true
// noValPatterns = true
// regex = []
//}
//
//RemoveUnused {
// imports = true
// privates = true
// locals = true
// patternvars = true
// params = true
//}
107 changes: 63 additions & 44 deletions .scalafix-scala3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,68 @@ rules = [
DisableSyntax
LeakingImplicitClassVal
NoValInForComprehension
RedundantSyntax

# xuwei-k/scalafix-rules
AddExplicitImplicitTypes
AddLambdaParamParentheses
CirceCodec
CollectHead
CollectHeadOption

FlatTraverse
ImplicitValueClass
KindProjector
LambdaParamParentheses
MapDistinctSize
MapSequenceTraverse
NoElse
ObjectSelfType
OptionMapFlatMap
OptionMatchToRight

SimplifyForYield
ThrowableToNonFatal
UnnecessaryCase
UnnecessaryMatch
UnnecessarySort

UnusedConstructorParams
UnusedTypeParams
WithFilter
]
DisableSyntax.noVars = true
DisableSyntax.noThrows = true
DisableSyntax.noNulls = true
DisableSyntax.noReturns = true
DisableSyntax.noWhileLoops = true
DisableSyntax.noAsInstanceOf = true
DisableSyntax.noIsInstanceOf = true
DisableSyntax.noXml = true
DisableSyntax.noDefaultArgs = true
DisableSyntax.noFinalVal = true
DisableSyntax.noFinalize = true
DisableSyntax.noValPatterns = true
DisableSyntax.regex = []

DisableSyntax {
noVars = true
noThrows = true
noNulls = true
noReturns = true
noWhileLoops = true
noAsInstanceOf = true
noIsInstanceOf = true
noXml = true
noDefaultArgs = true
noFinalVal = true
noFinalize = true
noValPatterns = true
regex = []
}
//rules = [
// DisableSyntax
// LeakingImplicitClassVal
// NoValInForComprehension
// RedundantSyntax
//
// # xuwei-k/scalafix-rules
// AddExplicitImplicitTypes
// AddLambdaParamParentheses
// CirceCodec
// CollectHead
// CollectHeadOption
//
// FlatTraverse
// ImplicitValueClass
// KindProjector
// LambdaParamParentheses
// MapDistinctSize
// MapSequenceTraverse
// NoElse
// ObjectSelfType
// OptionMapFlatMap
// OptionMatchToRight
//
// SimplifyForYield
// ThrowableToNonFatal
// UnnecessaryCase
// UnnecessaryMatch
// UnnecessarySort
//
// UnusedConstructorParams
// UnusedTypeParams
// WithFilter
//]
//
//DisableSyntax {
// noVars = true
// noThrows = true
// noNulls = true
// noReturns = true
// noWhileLoops = true
// noAsInstanceOf = true
// noIsInstanceOf = true
// noXml = true
// noDefaultArgs = true
// noFinalVal = true
// noFinalize = true
// noValPatterns = true
// regex = []
//}
Loading

0 comments on commit c421319

Please sign in to comment.