https://github.com/stringbean/scalafix-rules
Custom scalafix rules
https://github.com/stringbean/scalafix-rules
linter scalafix scalafix-rule
Last synced: 3 months ago
JSON representation
Custom scalafix rules
- Host: GitHub
- URL: https://github.com/stringbean/scalafix-rules
- Owner: stringbean
- License: apache-2.0
- Created: 2023-11-01T11:07:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-08T14:22:38.000Z (8 months ago)
- Last Synced: 2025-01-10T05:16:33.717Z (5 months ago)
- Topics: linter, scalafix, scalafix-rule
- Language: Scala
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scalafix rules for scalafix-rules
[](https://github.com/stringbean/scalafix-rules/actions/workflows/ci.yml)
[](https://index.scala-lang.org/stringbean/scalafix-rules/scalafix-rules)
[](https://snyk.io/test/github/stringbean/scalafix-rules?targetFile=build.sbt)


## Installation
```scala
ThisBuild / scalafixDependencies += "software.purpledragon" && "scalafix-rules" % ""
```## Rules
### IllegalImports
Checks for usage of 'illegal' classes or packages. These could be non-portable code (such as
`com.sun.*`), legacy code from third-party libraries or code that will not work on certain
environments (such as `java.awt.*` on a headless server).Inspired by the [`IllegalImportsChecker`][scalastyle-illegalimports] from Scalastyle and the
[`IllegalImport`][checkstyle-illegalimport] check from Checkstyle.Example:
```text
Example.scala:5: error: [IllegalImports] import of class from illegal package
import com.sun.net.httpserver.HttpServer
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```#### Configutation
| Name | Type | Description |
|-----------|----------------|--------------------------------------------------------------------------------------------------------------------------------|
| `error` | `List[String]` | List of imports to make illegal. These can be fully-qualified classes (`java.util.Vector`) or package wildcards (`com.sun.*`). |
| `warning` | `List[String]` | List of imports to warn on usage. These are in the same format as `error` but will not fail the buid. |#### Defaults
```hocon
IllegalImports.imports = [
"com.sun.*"
]
```[checkstyle-illegalimport]: https://checkstyle.sourceforge.io/checks/imports/illegalimport.html#IllegalImport
[scalastyle-illegalimports]: http://www.scalastyle.org/rules-1.0.0.html#org_scalastyle_scalariform_IllegalImportsChecker