-
Notifications
You must be signed in to change notification settings - Fork 8
build(spotless): add Spotless and Ktlint for formatting and linting #44
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| indent_size = 4 | ||
| indent_style = space | ||
| insert_final_newline = false | ||
| max_line_length = 120 | ||
| tab_width = 4 | ||
| ij_continuation_indent_size = 8 | ||
| ij_formatter_off_tag = @formatter:off | ||
| ij_formatter_on_tag = @formatter:on | ||
| ij_formatter_tags_enabled = true | ||
| ij_smart_tabs = false | ||
| ij_visual_guides = | ||
| ij_wrap_on_typing = false | ||
|
|
||
| [.editorconfig] | ||
| ij_editorconfig_align_group_field_declarations = false | ||
| ij_editorconfig_space_after_colon = false | ||
| ij_editorconfig_space_after_comma = true | ||
| ij_editorconfig_space_before_colon = false | ||
| ij_editorconfig_space_before_comma = false | ||
| ij_editorconfig_spaces_around_assignment_operators = true | ||
|
|
||
| [{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,*.png.mcmeta,*.postman_collection,*.postman_collection.json,*.postman_environment,*.postman_environment.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,.ws-context,jest.config,mcmod.info,pack.mcmeta}] | ||
| indent_size = 2 | ||
| ij_json_array_wrapping = split_into_lines | ||
| ij_json_keep_blank_lines_in_code = 0 | ||
| ij_json_keep_indents_on_empty_lines = false | ||
| ij_json_keep_line_breaks = true | ||
| ij_json_keep_trailing_comma = false | ||
| ij_json_object_wrapping = split_into_lines | ||
| ij_json_property_alignment = do_not_align | ||
| ij_json_space_after_colon = true | ||
| ij_json_space_after_comma = true | ||
| ij_json_space_before_colon = false | ||
| ij_json_space_before_comma = false | ||
| ij_json_spaces_within_braces = false | ||
| ij_json_spaces_within_brackets = false | ||
| ij_json_wrap_long_lines = false | ||
|
|
||
| [{*.kt,*.kts}] | ||
| ij_kotlin_align_in_columns_case_branch = true | ||
| ij_kotlin_align_multiline_binary_operation = false | ||
| ij_kotlin_align_multiline_extends_list = false | ||
| ij_kotlin_align_multiline_method_parentheses = false | ||
| ij_kotlin_align_multiline_parameters = true | ||
| ij_kotlin_align_multiline_parameters_in_calls = false | ||
| ij_kotlin_allow_trailing_comma = false | ||
| ij_kotlin_allow_trailing_comma_collection_literal_expression = false | ||
| ij_kotlin_allow_trailing_comma_context_receiver_list = true | ||
| ij_kotlin_allow_trailing_comma_destructuring_declaration = true | ||
| ij_kotlin_allow_trailing_comma_function_literal = true | ||
| ij_kotlin_allow_trailing_comma_indices = false | ||
| ij_kotlin_allow_trailing_comma_on_call_site = false | ||
| ij_kotlin_allow_trailing_comma_type_argument_list = false | ||
| ij_kotlin_allow_trailing_comma_type_parameter_list = true | ||
| ij_kotlin_allow_trailing_comma_value_argument_list = false | ||
| ij_kotlin_allow_trailing_comma_value_parameter_list = true | ||
| ij_kotlin_allow_trailing_comma_when_entry = true | ||
| ij_kotlin_assignment_wrap = normal | ||
| ij_kotlin_blank_lines_after_class_header = 0 | ||
| ij_kotlin_blank_lines_around_block_when_branches = 0 | ||
| ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 | ||
| ij_kotlin_block_comment_add_space = false | ||
| ij_kotlin_block_comment_at_first_column = true | ||
| ij_kotlin_call_parameters_new_line_after_left_paren = true | ||
| ij_kotlin_call_parameters_right_paren_on_new_line = true | ||
| ij_kotlin_call_parameters_wrap = on_every_item | ||
| ij_kotlin_catch_on_new_line = false | ||
| ij_kotlin_class_annotation_wrap = split_into_lines | ||
| ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL | ||
| ij_kotlin_continuation_indent_for_chained_calls = false | ||
| ij_kotlin_continuation_indent_for_expression_bodies = false | ||
| ij_kotlin_continuation_indent_in_argument_lists = false | ||
| ij_kotlin_continuation_indent_in_elvis = false | ||
| ij_kotlin_continuation_indent_in_if_conditions = false | ||
| ij_kotlin_continuation_indent_in_parameter_lists = false | ||
| ij_kotlin_continuation_indent_in_supertype_lists = false | ||
| ij_kotlin_else_on_new_line = false | ||
| ij_kotlin_enum_constants_wrap = off | ||
| ij_kotlin_extends_list_wrap = normal | ||
| ij_kotlin_field_annotation_wrap = split_into_lines | ||
| ij_kotlin_finally_on_new_line = false | ||
| ij_kotlin_if_rparen_on_new_line = true | ||
| ij_kotlin_import_nested_classes = false | ||
| ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ | ||
| ij_kotlin_indent_before_arrow_on_new_line = true | ||
| ij_kotlin_insert_whitespaces_in_simple_one_line_method = true | ||
| ij_kotlin_keep_blank_lines_before_right_brace = 2 | ||
| ij_kotlin_keep_blank_lines_in_code = 2 | ||
| ij_kotlin_keep_blank_lines_in_declarations = 2 | ||
| ij_kotlin_keep_first_column_comment = true | ||
| ij_kotlin_keep_indents_on_empty_lines = false | ||
| ij_kotlin_keep_line_breaks = true | ||
| ij_kotlin_lbrace_on_next_line = false | ||
| ij_kotlin_line_break_after_multiline_when_entry = true | ||
| ij_kotlin_line_comment_add_space = false | ||
| ij_kotlin_line_comment_add_space_on_reformat = false | ||
| ij_kotlin_line_comment_at_first_column = true | ||
| ij_kotlin_method_annotation_wrap = split_into_lines | ||
| ij_kotlin_method_call_chain_wrap = normal | ||
| ij_kotlin_method_parameters_new_line_after_left_paren = true | ||
| ij_kotlin_method_parameters_right_paren_on_new_line = true | ||
| ij_kotlin_method_parameters_wrap = on_every_item | ||
| ij_kotlin_name_count_to_use_star_import = 5 | ||
| ij_kotlin_name_count_to_use_star_import_for_members = 3 | ||
| ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§Ή Nitpick | π΅ Trivial | π€ Low value Verify wildcard imports are intentional. The configuration allows wildcard imports for Confirm this is intentional for your project's conventions. π€ Prompt for AI Agents |
||
| ij_kotlin_parameter_annotation_wrap = off | ||
| ij_kotlin_space_after_comma = true | ||
| ij_kotlin_space_after_extend_colon = true | ||
| ij_kotlin_space_after_type_colon = true | ||
| ij_kotlin_space_before_catch_parentheses = true | ||
| ij_kotlin_space_before_comma = false | ||
| ij_kotlin_space_before_extend_colon = true | ||
| ij_kotlin_space_before_for_parentheses = true | ||
| ij_kotlin_space_before_if_parentheses = true | ||
| ij_kotlin_space_before_lambda_arrow = true | ||
| ij_kotlin_space_before_type_colon = false | ||
| ij_kotlin_space_before_when_parentheses = true | ||
| ij_kotlin_space_before_while_parentheses = true | ||
| ij_kotlin_spaces_around_additive_operators = true | ||
| ij_kotlin_spaces_around_assignment_operators = true | ||
| ij_kotlin_spaces_around_elvis = true | ||
| ij_kotlin_spaces_around_equality_operators = true | ||
| ij_kotlin_spaces_around_function_type_arrow = true | ||
| ij_kotlin_spaces_around_logical_operators = true | ||
| ij_kotlin_spaces_around_multiplicative_operators = true | ||
| ij_kotlin_spaces_around_range = false | ||
| ij_kotlin_spaces_around_relational_operators = true | ||
| ij_kotlin_spaces_around_unary_operator = false | ||
| ij_kotlin_spaces_around_when_arrow = true | ||
| ij_kotlin_variable_annotation_wrap = off | ||
| ij_kotlin_while_on_new_line = false | ||
| ij_kotlin_wrap_elvis_expressions = 1 | ||
| ij_kotlin_wrap_expression_body_functions = 1 | ||
| ij_kotlin_wrap_first_method_in_call_chain = false | ||
|
|
||
| [{*.markdown,*.md}] | ||
| ij_markdown_force_one_space_after_blockquote_symbol = true | ||
| ij_markdown_force_one_space_after_header_symbol = true | ||
| ij_markdown_force_one_space_after_list_bullet = true | ||
| ij_markdown_force_one_space_between_words = true | ||
| ij_markdown_format_tables = true | ||
| ij_markdown_insert_quote_arrows_on_wrap = true | ||
| ij_markdown_keep_indents_on_empty_lines = false | ||
| ij_markdown_keep_line_breaks_inside_text_blocks = true | ||
| ij_markdown_max_lines_around_block_elements = 1 | ||
| ij_markdown_max_lines_around_header = 1 | ||
| ij_markdown_max_lines_between_paragraphs = 1 | ||
| ij_markdown_min_lines_around_block_elements = 1 | ||
| ij_markdown_min_lines_around_header = 1 | ||
| ij_markdown_min_lines_between_paragraphs = 1 | ||
| ij_markdown_wrap_text_if_long = true | ||
| ij_markdown_wrap_text_inside_blockquotes = true | ||
|
|
||
| [{*.properties,spring.handlers,spring.schemas}] | ||
| ij_properties_align_group_field_declarations = false | ||
| ij_properties_keep_blank_lines = false | ||
| ij_properties_key_value_delimiter = equals | ||
| ij_properties_spaces_around_key_value_delimiter = false | ||
|
|
||
| [{*.yaml,*.yml}] | ||
| indent_size = 2 | ||
| ij_yaml_align_values_properties = do_not_align | ||
| ij_yaml_autoinsert_sequence_marker = true | ||
| ij_yaml_block_mapping_on_new_line = false | ||
| ij_yaml_indent_sequence_value = true | ||
| ij_yaml_keep_indents_on_empty_lines = false | ||
| ij_yaml_keep_line_breaks = true | ||
| ij_yaml_line_comment_add_space = false | ||
| ij_yaml_line_comment_add_space_on_reformat = false | ||
| ij_yaml_line_comment_at_first_column = true | ||
| ij_yaml_sequence_on_new_line = false | ||
| ij_yaml_space_before_colon = false | ||
| ij_yaml_spaces_within_braces = true | ||
| ij_yaml_spaces_within_brackets = true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ plugins { | |
| id 'org.jetbrains.kotlin.jvm' version '2.2.0' | ||
| id 'org.jetbrains.kotlin.kapt' version '2.2.0' | ||
| id "com.vanniktech.maven.publish" version "0.34.0" | ||
| id "org.jlleitschuh.gradle.ktlint" version "13.1.0" apply false | ||
| id 'com.diffplug.spotless' version "7.2.1" apply false | ||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§Ή Nitpick | π΅ Trivial π§© Analysis chainπ Script executed: #!/bin/bash
# Description: Check for latest versions and security advisories for Gradle plugins
echo "=== Checking ktlint-gradle plugin latest version ==="
curl -s "https://plugins.gradle.org/plugin/org.jlleitschuh.gradle.ktlint" | grep -o 'Version [0-9.]*' | head -1
echo -e "\n=== Checking spotless plugin latest version ==="
curl -s "https://plugins.gradle.org/plugin/com.diffplug.spotless" | grep -o 'Version [0-9.]*' | head -1
echo -e "\n=== Checking for GitHub security advisories ==="
gh api graphql -f query='
{
securityVulnerabilities(first: 5, ecosystem: MAVEN, package: "org.jlleitschuh.gradle:ktlint-gradle") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
}
}
}'
gh api graphql -f query='
{
securityVulnerabilities(first: 5, ecosystem: MAVEN, package: "com.diffplug.spotless:spotless-plugin-gradle") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
}
}
}'Repository: LMLiam/SPI-Tooling Length of output: 532 Update ktlint/spotless Gradle plugin versions (security impact currently unclear, but pinned versions are behind latest).
π€ Prompt for AI Agents |
||
| } | ||
|
|
||
| allprojects { | ||
|
|
@@ -22,17 +24,17 @@ subprojects { | |
| apply plugin: 'org.jetbrains.kotlin.jvm' | ||
| apply plugin: 'org.jetbrains.kotlin.kapt' | ||
| apply plugin: 'com.vanniktech.maven.publish' | ||
| apply plugin: 'org.jlleitschuh.gradle.ktlint' | ||
| apply plugin: 'com.diffplug.spotless' | ||
|
|
||
| // Configure Vanniktech plugin | ||
| mavenPublishing { | ||
| publishToMavenCentral(true) | ||
| signAllPublications() | ||
|
|
||
| coordinates( | ||
| rootProject.group as String, | ||
| coordinates(rootProject.group as String, | ||
| "${rootProject.name}-${project.name}", | ||
| rootProject.version as String | ||
| ) | ||
| rootProject.version as String) | ||
|
|
||
| pom { | ||
| name = "${rootProject.name}-${project.name}" | ||
|
|
@@ -72,6 +74,30 @@ subprojects { | |
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.named("check") { | ||
| dependsOn("spotlessApply") | ||
| } | ||
|
|
||
| tasks.named("compileKotlin") { | ||
| dependsOn(tasks.named("spotlessApply")) | ||
| } | ||
|
Comment on lines
+78
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Replace Making
The standard pattern is:
π Proposed fix tasks.named("check") {
- dependsOn("spotlessApply")
+ dependsOn("spotlessCheck")
}
-tasks.named("compileKotlin") {
- dependsOn(tasks.named("spotlessApply"))
-}Note: Remove the π€ Prompt for AI Agents |
||
|
|
||
| spotless { | ||
| ratchetFrom 'origin/main' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§Ή Nitpick | π΅ Trivial | π€ Low value Note: The Consider running a full π€ Prompt for AI Agents |
||
|
|
||
| format 'misc', { | ||
| target '*.gradle', '.gitattributes', '.gitignore' | ||
|
|
||
| trimTrailingWhitespace() | ||
| leadingTabsToSpaces() | ||
| endWithNewline() | ||
| } | ||
|
|
||
| kotlin { | ||
| ktlint().setEditorConfigPath("$rootDir/.editorconfig") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.register('copyJar', Copy) { | ||
|
|
||
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.
π§Ή Nitpick | π΅ Trivial | β‘ Quick win
Reconsider disabling final newlines.
Setting
insert_final_newline = falsedeviates from POSIX text file standards and common best practices. Most tools expect text files to end with a newline, and this setting conflicts with theendWithNewline()rule configured for Gradle files inbuild.gradle(line 94).Consider setting this to
truefor consistency withspotlessconfiguration and standard practices.β»οΈ Proposed fix
π Committable suggestion
π€ Prompt for AI Agents