https://github.com/lewisjkl/header
Header automation and linting :tada:
https://github.com/lewisjkl/header
mill-plugin
Last synced: over 1 year ago
JSON representation
Header automation and linting :tada:
- Host: GitHub
- URL: https://github.com/lewisjkl/header
- Owner: lewisjkl
- License: apache-2.0
- Created: 2022-09-23T17:15:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-25T02:44:04.000Z (over 1 year ago)
- Last Synced: 2025-01-13T09:43:44.699Z (over 1 year ago)
- Topics: mill-plugin
- Language: Scala
- Homepage:
- Size: 29.3 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Header
_Utilities for checking and updating headers in files._
A big thanks to [sbt-header](https://github.com/sbt/sbt-header) which this project is based on.
## Mill - Basic Usage
```console
> mill __.headerCheck
> mill __.headerCreate
```
In `build.sc` file:
```scala
import $ivy.`com.lewisjkl::header-mill-plugin::0.0.4`
import header._
```
#### Apache 2
```scala mdoc:nest
import header._
object core extends HeaderModule {
override def license: HeaderLicense = HeaderLicense.Apache2("2023", "lewisjkl")
}
```
#### MIT
```scala mdoc:nest
import header._
object core extends HeaderModule {
override def license: HeaderLicense = HeaderLicense.MIT("2023", "lewisjkl")
}
```
#### Custom
```scala mdoc:nest
import header._
object core extends HeaderModule {
override def license: HeaderLicense = HeaderLicense.Custom(
"""|The contents of this file is free and unencumbered software released into the
|public domain. For more information, please refer to """.stripMargin
)
}
```
## Mill Customization
```scala mdoc:nest
import header._
object core extends HeaderModule {
override def license: HeaderLicense = HeaderLicense.Apache2("2023", "lewisjkl")
// defaults to List("scala")
override def includeFileExtensions: List[String] = List("scala", "java")
// if you want more control, you can use the following instead of `includeFileExtensions`
// This shows the default implementation, but you can make it whatever you would like.
override def skipFilePredicate: os.Path => Boolean = path => {
os.isFile(path) && !includeFileExtensions.exists(ext =>
path.segments.toList.last.endsWith(s".$ext")
)
}
// defaults to this.millSourcePath, change this to change where the header checking/creation starts
// looking for files
override def headerRootPath: os.Path = millSourcePath
}
```