├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ └── ci.yml ├── project ├── build.properties └── plugins.sbt ├── version.sbt ├── .scala-steward.conf ├── rules └── src │ └── main │ ├── resources │ └── META-INF │ │ └── services │ │ └── scalafix.v1.Rule │ └── scala │ └── replace_symbol_literals │ └── ReplaceSymbolLiterals.scala ├── output └── src │ └── main │ └── scala │ └── fix │ └── ReplaceSymbolLiterals.scala ├── readme.md ├── input └── src │ └── main │ └── scala │ └── fix │ └── ReplaceSymbolLiterals.scala ├── tests └── src │ └── test │ └── scala │ └── fix │ └── RuleSuite.scala ├── .scalafmt.conf └── LICENSE.txt /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @xuwei-k 2 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.6.2 2 | -------------------------------------------------------------------------------- /version.sbt: -------------------------------------------------------------------------------- 1 | ThisBuild / version := "0.1.2-SNAPSHOT" 2 | -------------------------------------------------------------------------------- /.scala-steward.conf: -------------------------------------------------------------------------------- 1 | updates.fileExtensions = [ 2 | ".scala", 3 | ".sbt", 4 | ".yml", 5 | ".md" 6 | ] 7 | -------------------------------------------------------------------------------- /rules/src/main/resources/META-INF/services/scalafix.v1.Rule: -------------------------------------------------------------------------------- 1 | replace_symbol_literals.ReplaceSymbolLiterals 2 | -------------------------------------------------------------------------------- /output/src/main/scala/fix/ReplaceSymbolLiterals.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | object ReplaceSymbolLiterals { 4 | val foo = Symbol("bar") 5 | } 6 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Moved https://github.com/xuwei-k/scalafix-rules 2 | 3 | https://github.com/xuwei-k/scalafix-rules/commit/5c9ace4fa298b5517a065c56e0e0d11599dd2059 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /input/src/main/scala/fix/ReplaceSymbolLiterals.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = ReplaceSymbolLiterals 3 | */ 4 | package fix 5 | 6 | object ReplaceSymbolLiterals { 7 | val foo = 'bar 8 | } 9 | -------------------------------------------------------------------------------- /tests/src/test/scala/fix/RuleSuite.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import org.scalatest.FunSuiteLike 4 | import scalafix.testkit.AbstractSemanticRuleSuite 5 | 6 | class RuleSuite extends AbstractSemanticRuleSuite with FunSuiteLike { 7 | runAllTests() 8 | } 9 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34") 2 | addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") 3 | addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.11") 4 | addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") 5 | addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") 6 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | runner.dialect = Scala213 2 | maxColumn = 120 3 | align.preset = none 4 | rewrite.rules = [SortImports] 5 | continuationIndent.callSite = 2 6 | continuationIndent.defnSite = 2 7 | continuationIndent.extendSite = 2 8 | docstrings.style = keep 9 | includeCurlyBraceInSelectChains = false 10 | optIn.breakChainOnFirstMethodDot = false 11 | trailingCommas = preserve 12 | version = "3.4.3" 13 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | push: 5 | schedule: 6 | - cron: '0 0 * * 4' 7 | jobs: 8 | test: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | fail-fast: false 12 | steps: 13 | - uses: actions/checkout@v2.4.0 14 | - uses: actions/setup-java@v2 15 | with: 16 | java-version: 8 17 | distribution: temurin 18 | - uses: coursier/cache-action@v6 19 | - run: sbt scalafmtSbtCheck "+scalafmtCheckAll" "+test" 20 | -------------------------------------------------------------------------------- /rules/src/main/scala/replace_symbol_literals/ReplaceSymbolLiterals.scala: -------------------------------------------------------------------------------- 1 | package replace_symbol_literals 2 | 3 | import scalafix.v1.{Patch, SemanticDocument, SemanticRule} 4 | import scala.meta.Lit 5 | 6 | class ReplaceSymbolLiterals extends SemanticRule("ReplaceSymbolLiterals") { 7 | 8 | override def fix(implicit doc: SemanticDocument): Patch = { 9 | doc.tree.collect { case literal @ Lit.Symbol(_) => 10 | Patch.replaceTree(literal, s"""Symbol("${literal.value.name}")""") 11 | }.foldLeft(Patch.empty)(_ + _) 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 replace-symbol-literals contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------