-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce spotless/ktlint #39
Open
whitescent
wants to merge
11
commits into
Kotlin:main
Choose a base branch
from
whitescent:ktlint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d388644
feat: introduce spotless + ktlint
whitescent 26c270f
chore: run `spotlessApply` to format the code
whitescent c431137
chore: exclude `examples` module
whitescent e034eda
fix: PROJECT_VERSION variable name
whitescent 0948e29
fix: remove @Preview from Gallery
whitescent a62c402
chore: fix conflict
whitescent 0a57c2e
build: add spotless CI
whitescent 96591b0
chore: run spotlessApply to format the code
whitescent f193505
build: remove examples module from settings.gradle.kts configuration
whitescent 9cd673e
chore: remove detekt.yml
whitescent 11a59f4
refactor: change the project indentation to 4 spaces
whitescent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{kt,kts}] | ||
ij_kotlin_imports_layout = * | ||
ij_kotlin_allow_trailing_comma = true | ||
ij_kotlin_allow_trailing_comma_on_call_site = true | ||
ij_kotlin_line_break_after_multiline_when_entry = false | ||
ij_kotlin_name_count_to_use_star_import = 2147483647 | ||
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 | ||
ij_kotlin_packages_to_use_import_on_demand = unset | ||
ktlint_code_style = intellij_idea | ||
ktlint_function_naming_ignore_when_annotated_with = Composable | ||
ktlint_standard_function-expression-body = disabled | ||
ktlint_standard_filename = disabled | ||
ktlint_compose_modifier-missing-check = disabled | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.xml] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Spotless Check | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
spotless: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: gradle | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Run Spotless Check | ||
run: ./gradlew spotlessCheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
|
||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import org.jetbrains.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
@Preview | ||
fun App() { | ||
fun App(modifier: Modifier = Modifier) { | ||
var showContent by remember { mutableStateOf(false) } | ||
|
||
MaterialTheme { | ||
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { | ||
Column( | ||
modifier = modifier.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
PrimaryButton(text = "Click Me", onClick = { showContent = !showContent }) | ||
AnimatedVisibility(showContent) { | ||
val greeting = remember { Greeting().greet() } | ||
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) { | ||
ComposeLogo() | ||
ComposeLogo(Modifier.size(600.dp)) | ||
Text("Compose: $greeting") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use 4 spaces, as suggested by the official convention - https://kotlinlang.org/docs/coding-conventions.html#indentation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! but for the compose project, I might prefer 2 spaces for indentation, as it looks more readable in cases with deep component nesting. However, if 4 spaces are to be used, that's fine too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
One more argument for keeping it 4 is that the repository is in Kotlin group, so using the official convention is preferred :)