mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 00:40:49 +00:00
Moves to spotless
This commit is contained in:
parent
ed6c1e62e4
commit
de61f7f383
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@ -0,0 +1,14 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{kt,kts}]
|
||||
max_line_length = 9000
|
||||
ij_kotlin_allow_trailing_comma=true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site=true
|
||||
ktlint_function_naming_ignore_when_annotated_with=Composable, Test
|
||||
|
||||
[*.gradle]
|
||||
indent_size = 4
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Linter (gradle)
|
||||
run: ./gradlew ktlintCheck
|
||||
run: ./gradlew spotlessCheck
|
||||
|
||||
- name: Test (gradle)
|
||||
run: ./gradlew test --no-daemon
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@
|
||||
/.idea/androidTestResultsUserPreferences.xml
|
||||
/.idea/deploymentTargetDropDown.xml
|
||||
/.idea/appInsightsSettings.xml
|
||||
/.idea/ktlint-plugin.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
|
@ -150,8 +150,8 @@ Build the app:
|
||||
|
||||
## Linting
|
||||
```bash
|
||||
./gradlew ktlintCheck
|
||||
./gradlew ktlintFormat
|
||||
./gradlew spotlessCheck
|
||||
./gradlew spotlessApply
|
||||
```
|
||||
|
||||
## Installing on device
|
||||
|
@ -1,7 +1,6 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'org.jlleitschuh.gradle.ktlint' version "11.6.1"
|
||||
id 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
package com.vitorpamplona.amethyst.ui.note
|
40
build.gradle
40
build.gradle
@ -26,16 +26,9 @@ plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.9.10' apply false
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.10' apply false
|
||||
id 'androidx.benchmark' version '1.1.1' apply false
|
||||
id 'com.diffplug.spotless' version '6.22.0' apply false
|
||||
}
|
||||
|
||||
tasks.register('installGitHook', Copy) {
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-push')
|
||||
into { new File(rootProject.rootDir, '.git/hooks') }
|
||||
fileMode 0777
|
||||
}
|
||||
tasks.getByPath(':app:preBuild').dependsOn installGitHook
|
||||
|
||||
subprojects {
|
||||
tasks.withType(KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
@ -55,4 +48,35 @@ subprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
spotless {
|
||||
kotlin {
|
||||
target '**/*.kt'
|
||||
targetExclude("$buildDir/**/*.kt")
|
||||
|
||||
ktlint("1.1.0")
|
||||
ktfmt().googleStyle()
|
||||
licenseHeaderFile rootProject.file('spotless/copyright.txt'), "package|import|class|object|sealed|open|interface|abstract "
|
||||
}
|
||||
|
||||
groovyGradle {
|
||||
target '*.gradle'
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.named("preBuild") {
|
||||
dependsOn("spotlessApply")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.register('installGitHook', Copy) {
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-push')
|
||||
into { new File(rootProject.rootDir, '.git/hooks') }
|
||||
fileMode 0777
|
||||
}
|
||||
tasks.getByPath(':app:preBuild').dependsOn installGitHook
|
@ -12,7 +12,7 @@ echo "$JAVA_HOME"
|
||||
echo "$(java -version)"
|
||||
echo "Running test... "
|
||||
|
||||
./gradlew ktlintCheck
|
||||
./gradlew spotlessCheck
|
||||
|
||||
status=$?
|
||||
|
||||
@ -22,7 +22,7 @@ if [ "$status" = 0 ] ; then
|
||||
else
|
||||
echo "*********************************************************"
|
||||
echo 1>&2 "Static analysis found violations it could not fix."
|
||||
printf "Run ${GREEN}./gradlew ktlintFormat${NO_COLOR} to fix formatting related issues...\n"
|
||||
printf "Run ${GREEN}./gradlew spotlessApply${NO_COLOR} to fix formatting related issues...\n"
|
||||
echo "*********************************************************"
|
||||
exit 1
|
||||
fi
|
||||
|
7
spotless/copyright.kt
Normal file
7
spotless/copyright.kt
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2023 Vitor Pamplona
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Loading…
Reference in New Issue
Block a user