Skip to content

Commit 2a622cb

Browse files
Merge pull request #31 from allegro/ktlint
Ktlint
2 parents a692936 + 2df151c commit 2a622cb

173 files changed

Lines changed: 1997 additions & 1696 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 102 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,100 @@ ij_smart_tabs = false
1515
ij_visual_guides = 160
1616
ij_wrap_on_typing = false
1717

18-
[*.feature]
19-
indent_size = 2
20-
ij_visual_guides = 160
21-
ij_gherkin_keep_indents_on_empty_lines = false
18+
[**/build/**/*]
19+
ktlint = disabled
20+
21+
[{*.kt,*.kts}]
22+
ktlint_code_style = intellij_idea
23+
ktlint_function_signature_body_expression_wrapping = multiline
24+
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 1
25+
ktlint_standard_class-naming = disabled
26+
ktlint_standard_function-naming = disabled
27+
ktlint_standard_filename = disabled
28+
ktlint_standard_kdoc = disabled
29+
30+
ij_kotlin_align_in_columns_case_branch = false
31+
ij_kotlin_align_multiline_binary_operation = false
32+
ij_kotlin_align_multiline_extends_list = false
33+
ij_kotlin_align_multiline_method_parentheses = false
34+
ij_kotlin_align_multiline_parameters = true
35+
ij_kotlin_align_multiline_parameters_in_calls = false
36+
ij_kotlin_allow_trailing_comma = true
37+
ij_kotlin_allow_trailing_comma_on_call_site = true
38+
ij_kotlin_assignment_wrap = normal
39+
ij_kotlin_blank_lines_after_class_header = 1
40+
ij_kotlin_blank_lines_around_block_when_branches = 0
41+
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
42+
ij_kotlin_block_comment_add_space = false
43+
ij_kotlin_block_comment_at_first_column = true
44+
ij_kotlin_call_parameters_new_line_after_left_paren = true
45+
ij_kotlin_call_parameters_right_paren_on_new_line = true
46+
ij_kotlin_call_parameters_wrap = on_every_item
47+
ij_kotlin_catch_on_new_line = false
48+
ij_kotlin_class_annotation_wrap = split_into_lines
49+
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
50+
ij_kotlin_continuation_indent_for_chained_calls = false
51+
ij_kotlin_continuation_indent_for_expression_bodies = false
52+
ij_kotlin_continuation_indent_in_argument_lists = false
53+
ij_kotlin_continuation_indent_in_elvis = false
54+
ij_kotlin_continuation_indent_in_if_conditions = false
55+
ij_kotlin_continuation_indent_in_parameter_lists = false
56+
ij_kotlin_continuation_indent_in_supertype_lists = false
57+
ij_kotlin_else_on_new_line = false
58+
ij_kotlin_enum_constants_wrap = normal
59+
ij_kotlin_extends_list_wrap = normal
60+
ij_kotlin_field_annotation_wrap = split_into_lines
61+
ij_kotlin_finally_on_new_line = false
62+
ij_kotlin_if_rparen_on_new_line = true
63+
ij_kotlin_import_nested_classes = false
64+
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
65+
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
66+
ij_kotlin_keep_blank_lines_before_right_brace = 1
67+
ij_kotlin_keep_blank_lines_in_code = 1
68+
ij_kotlin_keep_blank_lines_in_declarations = 1
69+
ij_kotlin_keep_first_column_comment = false
70+
ij_kotlin_keep_indents_on_empty_lines = false
71+
ij_kotlin_keep_line_breaks = true
72+
ij_kotlin_lbrace_on_next_line = false
73+
ij_kotlin_line_break_after_multiline_when_entry = true
74+
ij_kotlin_line_comment_add_space = false
75+
ij_kotlin_line_comment_add_space_on_reformat = false
76+
ij_kotlin_line_comment_at_first_column = true
77+
ij_kotlin_method_annotation_wrap = split_into_lines
78+
ij_kotlin_method_call_chain_wrap = normal
79+
ij_kotlin_method_parameters_new_line_after_left_paren = true
80+
ij_kotlin_method_parameters_right_paren_on_new_line = true
81+
ij_kotlin_method_parameters_wrap = on_every_item
82+
ij_kotlin_name_count_to_use_star_import = 2147483647
83+
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
84+
ij_kotlin_parameter_annotation_wrap = normal
85+
ij_kotlin_space_after_comma = true
86+
ij_kotlin_space_after_extend_colon = true
87+
ij_kotlin_space_after_type_colon = true
88+
ij_kotlin_space_before_catch_parentheses = true
89+
ij_kotlin_space_before_comma = false
90+
ij_kotlin_space_before_extend_colon = true
91+
ij_kotlin_space_before_for_parentheses = true
92+
ij_kotlin_space_before_if_parentheses = true
93+
ij_kotlin_space_before_lambda_arrow = true
94+
ij_kotlin_space_before_type_colon = false
95+
ij_kotlin_space_before_when_parentheses = true
96+
ij_kotlin_space_before_while_parentheses = true
97+
ij_kotlin_spaces_around_additive_operators = true
98+
ij_kotlin_spaces_around_assignment_operators = true
99+
ij_kotlin_spaces_around_equality_operators = true
100+
ij_kotlin_spaces_around_function_type_arrow = true
101+
ij_kotlin_spaces_around_logical_operators = true
102+
ij_kotlin_spaces_around_multiplicative_operators = true
103+
ij_kotlin_spaces_around_range = false
104+
ij_kotlin_spaces_around_relational_operators = true
105+
ij_kotlin_spaces_around_unary_operator = false
106+
ij_kotlin_spaces_around_when_arrow = true
107+
ij_kotlin_variable_annotation_wrap = normal
108+
ij_kotlin_while_on_new_line = false
109+
ij_kotlin_wrap_elvis_expressions = 1
110+
ij_kotlin_wrap_expression_body_functions = 1
111+
ij_kotlin_wrap_first_method_in_call_chain = false
22112

23113
[*.java]
24114
ij_visual_guides = 160
@@ -271,114 +361,7 @@ ij_java_wrap_comments = false
271361
ij_java_wrap_first_method_in_call_chain = false
272362
ij_java_wrap_long_lines = false
273363

274-
[.editorconfig]
275-
ij_visual_guides = 160
276-
ij_editorconfig_align_group_field_declarations = false
277-
ij_editorconfig_space_after_colon = false
278-
ij_editorconfig_space_after_comma = true
279-
ij_editorconfig_space_before_colon = false
280-
ij_editorconfig_space_before_comma = false
281-
ij_editorconfig_spaces_around_assignment_operators = true
282-
283-
[{*.bash,*.sh,*.zsh}]
284-
indent_size = 2
285-
tab_width = 2
286-
ij_visual_guides = 160
287-
ij_shell_binary_ops_start_line = false
288-
ij_shell_keep_column_alignment_padding = false
289-
ij_shell_minify_program = false
290-
ij_shell_redirect_followed_by_space = false
291-
ij_shell_switch_cases_indented = false
292-
ij_shell_use_unix_line_separator = true
293-
294-
[{*.kt,*.kts}]
295-
ktlint_code_style = intellij_idea
296-
ij_visual_guides = 160
297-
ij_kotlin_align_in_columns_case_branch = false
298-
ij_kotlin_align_multiline_binary_operation = false
299-
ij_kotlin_align_multiline_extends_list = false
300-
ij_kotlin_align_multiline_method_parentheses = false
301-
ij_kotlin_align_multiline_parameters = true
302-
ij_kotlin_align_multiline_parameters_in_calls = false
303-
ij_kotlin_allow_trailing_comma = false
304-
ij_kotlin_allow_trailing_comma_on_call_site = false
305-
ij_kotlin_assignment_wrap = normal
306-
ij_kotlin_blank_lines_after_class_header = 1
307-
ij_kotlin_blank_lines_around_block_when_branches = 0
308-
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
309-
ij_kotlin_block_comment_add_space = false
310-
ij_kotlin_block_comment_at_first_column = true
311-
ij_kotlin_call_parameters_new_line_after_left_paren = true
312-
ij_kotlin_call_parameters_right_paren_on_new_line = true
313-
ij_kotlin_call_parameters_wrap = on_every_item
314-
ij_kotlin_catch_on_new_line = false
315-
ij_kotlin_class_annotation_wrap = split_into_lines
316-
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
317-
ij_kotlin_continuation_indent_for_chained_calls = false
318-
ij_kotlin_continuation_indent_for_expression_bodies = false
319-
ij_kotlin_continuation_indent_in_argument_lists = false
320-
ij_kotlin_continuation_indent_in_elvis = false
321-
ij_kotlin_continuation_indent_in_if_conditions = false
322-
ij_kotlin_continuation_indent_in_parameter_lists = false
323-
ij_kotlin_continuation_indent_in_supertype_lists = false
324-
ij_kotlin_else_on_new_line = false
325-
ij_kotlin_enum_constants_wrap = normal
326-
ij_kotlin_extends_list_wrap = normal
327-
ij_kotlin_field_annotation_wrap = split_into_lines
328-
ij_kotlin_finally_on_new_line = false
329-
ij_kotlin_if_rparen_on_new_line = true
330-
ij_kotlin_import_nested_classes = false
331-
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
332-
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
333-
ij_kotlin_keep_blank_lines_before_right_brace = 1
334-
ij_kotlin_keep_blank_lines_in_code = 1
335-
ij_kotlin_keep_blank_lines_in_declarations = 1
336-
ij_kotlin_keep_first_column_comment = false
337-
ij_kotlin_keep_indents_on_empty_lines = false
338-
ij_kotlin_keep_line_breaks = true
339-
ij_kotlin_lbrace_on_next_line = false
340-
ij_kotlin_line_break_after_multiline_when_entry = true
341-
ij_kotlin_line_comment_add_space = false
342-
ij_kotlin_line_comment_add_space_on_reformat = false
343-
ij_kotlin_line_comment_at_first_column = true
344-
ij_kotlin_method_annotation_wrap = split_into_lines
345-
ij_kotlin_method_call_chain_wrap = normal
346-
ij_kotlin_method_parameters_new_line_after_left_paren = true
347-
ij_kotlin_method_parameters_right_paren_on_new_line = true
348-
ij_kotlin_method_parameters_wrap = on_every_item
349-
ij_kotlin_name_count_to_use_star_import = 2147483647
350-
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
351-
ij_kotlin_parameter_annotation_wrap = normal
352-
ij_kotlin_space_after_comma = true
353-
ij_kotlin_space_after_extend_colon = true
354-
ij_kotlin_space_after_type_colon = true
355-
ij_kotlin_space_before_catch_parentheses = true
356-
ij_kotlin_space_before_comma = false
357-
ij_kotlin_space_before_extend_colon = true
358-
ij_kotlin_space_before_for_parentheses = true
359-
ij_kotlin_space_before_if_parentheses = true
360-
ij_kotlin_space_before_lambda_arrow = true
361-
ij_kotlin_space_before_type_colon = false
362-
ij_kotlin_space_before_when_parentheses = true
363-
ij_kotlin_space_before_while_parentheses = true
364-
ij_kotlin_spaces_around_additive_operators = true
365-
ij_kotlin_spaces_around_assignment_operators = true
366-
ij_kotlin_spaces_around_equality_operators = true
367-
ij_kotlin_spaces_around_function_type_arrow = true
368-
ij_kotlin_spaces_around_logical_operators = true
369-
ij_kotlin_spaces_around_multiplicative_operators = true
370-
ij_kotlin_spaces_around_range = false
371-
ij_kotlin_spaces_around_relational_operators = true
372-
ij_kotlin_spaces_around_unary_operator = false
373-
ij_kotlin_spaces_around_when_arrow = true
374-
ij_kotlin_variable_annotation_wrap = normal
375-
ij_kotlin_while_on_new_line = false
376-
ij_kotlin_wrap_elvis_expressions = 1
377-
ij_kotlin_wrap_expression_body_functions = 1
378-
ij_kotlin_wrap_first_method_in_call_chain = false
379-
380364
[{*.markdown,*.md}]
381-
ij_visual_guides = 160
382365
ij_markdown_force_one_space_after_blockquote_symbol = true
383366
ij_markdown_force_one_space_after_header_symbol = true
384367
ij_markdown_force_one_space_after_list_bullet = true
@@ -397,15 +380,13 @@ ij_markdown_wrap_text_if_long = true
397380
ij_markdown_wrap_text_inside_blockquotes = true
398381

399382
[{*.properties,spring.handlers,spring.schemas}]
400-
ij_visual_guides = 160
401383
ij_properties_align_group_field_declarations = false
402384
ij_properties_keep_blank_lines = false
403385
ij_properties_key_value_delimiter = equals
404386
ij_properties_spaces_around_key_value_delimiter = false
405387

406388
[{*.yaml,*.yml}]
407389
indent_size = 2
408-
ij_visual_guides = 160
409390
ij_yaml_align_values_properties = do_not_align
410391
ij_yaml_autoinsert_sequence_marker = true
411392
ij_yaml_block_mapping_on_new_line = false
@@ -416,3 +397,11 @@ ij_yaml_sequence_on_new_line = false
416397
ij_yaml_space_before_colon = false
417398
ij_yaml_spaces_within_braces = true
418399
ij_yaml_spaces_within_brackets = true
400+
401+
[.editorconfig]
402+
ij_editorconfig_align_group_field_declarations = false
403+
ij_editorconfig_space_after_colon = false
404+
ij_editorconfig_space_after_comma = true
405+
ij_editorconfig_space_before_colon = false
406+
ij_editorconfig_space_before_comma = false
407+
ij_editorconfig_spaces_around_assignment_operators = true

allwrite-api/src/main/kotlin/pl/allegro/tech/allwrite/api/RecipeCoordinates.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public data class RecipeCoordinates(
77
val group: String,
88
val action: String,
99
val fromVersion: Version?,
10-
val toVersion: Version?
10+
val toVersion: Version?,
1111
) {
1212

1313
public val canonicalName: String
@@ -33,21 +33,17 @@ public fun RecipeDescriptor.toRecipeCoordinatesOrNull(): RecipeCoordinates? =
3333
group = tagProperty("group"),
3434
action = tagProperty("action"),
3535
fromVersion = getFromVersion(),
36-
toVersion = getToVersion()
36+
toVersion = getToVersion(),
3737
)
3838
}.getOrNull()
3939

40-
public fun RecipeDescriptor.tagPropertyOrNull(key: String): String? =
41-
tags.find { it.startsWith(key) }?.substringAfter(":")
40+
public fun RecipeDescriptor.tagPropertyOrNull(key: String): String? = tags.find { it.startsWith(key) }?.substringAfter(":")
4241

43-
public fun RecipeDescriptor.tagProperty(key: String): String =
44-
tagPropertyOrNull(key) ?: error("Tag property '$key' is missing for recipe $name")
42+
public fun RecipeDescriptor.tagProperty(key: String): String = tagPropertyOrNull(key) ?: error("Tag property '$key' is missing for recipe $name")
4543

46-
public fun RecipeDescriptor.getFromVersion(): Version? =
47-
tagPropertyOrNull("from")?.let { Version.parse(it, false) }
44+
public fun RecipeDescriptor.getFromVersion(): Version? = tagPropertyOrNull("from")?.let { Version.parse(it, false) }
4845

49-
public fun RecipeDescriptor.getToVersion(): Version? =
50-
tagPropertyOrNull("to")?.let { Version.parse(it, false) }
46+
public fun RecipeDescriptor.getToVersion(): Version? = tagPropertyOrNull("to")?.let { Version.parse(it, false) }
5147

5248
public fun Version.toCompactString(): String =
5349
buildString {

allwrite-cli/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,3 @@ tasks {
7676
into(layout.buildDirectory.dir("installation"))
7777
}
7878
}
79-

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/CliModule.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import pl.allegro.tech.allwrite.runtime.RuntimeModule
1212
*
1313
* NOTE: there is no @ComponentScan here to allow some modules to be conditionally loaded.
1414
*/
15-
@Module(includes = [
16-
ApplicationModule::class,
17-
RuntimeModule::class,
18-
OperatingSystemModule::class,
19-
ClockModule::class,
20-
HttpModule::class,
21-
])
15+
@Module(
16+
includes = [
17+
ApplicationModule::class,
18+
RuntimeModule::class,
19+
OperatingSystemModule::class,
20+
ClockModule::class,
21+
HttpModule::class,
22+
],
23+
)
2224
public class CliModule

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/Main.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package pl.allegro.tech.allwrite.cli
33
import org.koin.core.KoinApplication
44
import org.koin.core.context.startKoin
55
import org.koin.ksp.generated.module
6-
import pl.allegro.tech.allwrite.kapt.GenerateCompletions
76
import pl.allegro.tech.allwrite.cli.application.port.incoming.AppEntrypoint
87
import pl.allegro.tech.allwrite.cli.infrastructure.bot.GithubBotModule
98
import pl.allegro.tech.allwrite.cli.infrastructure.github.GithubModule
109
import pl.allegro.tech.allwrite.cli.infrastructure.os.port.incoming.SystemEnvironment
10+
import pl.allegro.tech.allwrite.kapt.GenerateCompletions
1111

1212
@GenerateCompletions
1313
public fun main(args: Array<String>) {
@@ -21,7 +21,7 @@ public fun main(args: Array<String>) {
2121
private fun KoinApplication.loadDynamicModules() {
2222
val dynamicModules = mapOf(
2323
"GITHUB_ACTIONS" to GithubModule().module,
24-
"GH_BOT" to GithubBotModule().module
24+
"GH_BOT" to GithubBotModule().module,
2525
)
2626
dynamicModules
2727
.filterKeys { env[it] == "true" }

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/application/AddExternalRecipeCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import pl.allegro.tech.allwrite.cli.application.port.outgoing.ExternalRecipeStor
88

99
@Single
1010
internal class AddExternalRecipeCommand(
11-
private val externalRecipeStore: ExternalRecipeStore
11+
private val externalRecipeStore: ExternalRecipeStore,
1212
) : ExternalSubCommand(name = COMMAND_NAME, help = "Adds an external recipe JAR from a URL") {
1313

1414
private val name: String by argument(help = "Name for the external recipe source")

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/application/CommandExecutionResult.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import kotlin.time.Duration
55
internal sealed interface CommandExecutionResult {
66
val executedRecipes: List<String>
77

8-
data class ExecutionResult(override val executedRecipes: List<String>) : CommandExecutionResult
8+
data class ExecutionResult(
9+
override val executedRecipes: List<String>,
10+
) : CommandExecutionResult
911

1012
data class TimeMeasuredExecutionResult(
1113
override val executedRecipes: List<String>,
1214
val executionTime: Duration,
13-
val throwable: Throwable? = null
15+
val throwable: Throwable? = null,
1416
) : CommandExecutionResult
1517
}

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/application/CommandListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ internal data class CommandExecutedEvent(
1010
val command: String,
1111
val executionTime: Duration,
1212
val throwable: Throwable?,
13-
val recipes: List<String> = emptyList()
13+
val recipes: List<String> = emptyList(),
1414
)

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/application/ExternalCommand.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import org.koin.core.component.KoinComponent
88
import pl.allegro.tech.allwrite.cli.util.injectAll
99

1010
@Single
11-
internal class ExternalCommand : CliktCommand(name = COMMAND_NAME), KoinComponent {
11+
internal class ExternalCommand :
12+
CliktCommand(name = COMMAND_NAME),
13+
KoinComponent {
1214

1315
private val externalSubCommands: List<ExternalSubCommand> by injectAll()
1416

allwrite-cli/src/main/kotlin/pl/allegro/tech/allwrite/cli/application/ExternalSubCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package pl.allegro.tech.allwrite.cli.application
22

33
internal abstract class ExternalSubCommand(
44
name: String,
5-
help: String
5+
help: String,
66
) : SubCommand(name = name, help = help)

0 commit comments

Comments
 (0)