if the rule no-empty-first-line-in-method-block is disabled in .editorconfig under kotlin e.g. [{*.kt,*.kts,*.java}]
then it should not give error for a blank line at start of a method
rule:
no-empty-first-line-in-method-block = disabled
in intellij (v2024.1.1 ) with ktlint plugin v0.22.0
and also tried on terminal with ktlint version 1.2.1
even though the rule is set to disabled in .editorconfig file at the root of the project with root=true in file
it show the empty line at start of a method as a problem in intellij
and on ktlint format command it removes the empty line
similary behavior on terminal too . if run ktlint it gives error for same line:
First line in a method block should not be empty (standard:no-empty-first-line-in-method-block)
Steps to Reproduce
any .kt kotlin file with a method with which has a empty line as first line in method body
Your Environment
Version of ktlint used: 1.2.1 , and ktlint intellij plugin version : v0.22.0
intellij version 2024.1.1 (ultimate edition)
Relevant parts of the .editorconfig settings
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task):
Version of Gradle used (if applicable): N/A
Operating System and version: MacOS Sonomoa 14.4.1
editor config file:
Expected Behavior
if the rule no-empty-first-line-in-method-block is disabled in .editorconfig under kotlin e.g.
[{*.kt,*.kts,*.java}]
then it should not give error for a blank line at start of a method rule:no-empty-first-line-in-method-block = disabled
documentation link: https://pinterest.github.io/ktlint/latest/rules/standard/#no-leading-empty-lines-in-method-blocks
Observed Behavior
in intellij (v2024.1.1 ) with ktlint plugin v0.22.0 and also tried on terminal with ktlint version 1.2.1 even though the rule is set to disabled in .editorconfig file at the root of the project with root=true in file it show the empty line at start of a method as a problem in intellij and on ktlint format command it removes the empty line
similary behavior on terminal too . if run ktlint it gives error for same line:
First line in a method block should not be empty (standard:no-empty-first-line-in-method-block)
Steps to Reproduce
any .kt kotlin file with a method with which has a empty line as first line in method body
Your Environment
.editorconfig
settings[*] charset = utf-8 end_of_line = lf indent_size = 4 tab_width = 4 indent_style = tab trim_trailing_whitespace = true insert_final_newline = true
max_line_length = 120
[{.kt,.kts,*.java}] ktlint_code_style = intellij_idea ktlint_experimental=disabled indent_size = 2 tab_width = 2 indent_style = space max_line_length = 140
ktlint ruleset https://pinterest.github.io/ktlint/latest/rules/standard/
blank-line-before-declaration = enabled if-else-bracing = enabled no-blank-line-in-list = enabled no-empty-first-line-in-method-block = disabled no-blank-line-before-rbrace = disabled no-consecutive-blank-lines = enabled function-signature = default ktlint_function_signature_body_expression_wrapping = default ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 8 ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = unset
multiline-expression-wrapping = disabled
force add trailing comma at declaration site (class,functions)
trailing-comma-on-declaration-site = enabled ij_kotlin_allow_trailing_comma = true
no trailing comma at calling (function parameters)
trailing-comma-on-call-site = disabled ij_kotlin_allow_trailing_comma_on_call_site = false
Disable wildcard imports entirely
ij_kotlin_name_count_to_use_star_import = 999 ij_kotlin_name_count_to_use_star_import_for_members = 999 ij_kotlin_line_break_after_multiline_when_entry = true ktlint_ignore_back_ticked_identifier = false