saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
524 stars 39 forks source link

WRONG_INDENTATION warning message ignores `indentationSize` setting #1886

Closed colesnodgrass closed 9 months ago

colesnodgrass commented 9 months ago

Describe the bug

WRONG_INDENTATION message is hard-coded to 4 spaces instead of being based on the indentationSize value. https://github.com/saveourtool/diktat/blob/46ec9b912eb604fe411898e54ec65e61ea47fab1/diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/constants/Warnings.kt#L113

Given the following configuration

- name: WRONG_INDENTATION
  enabled: true
  configuration:
    indentationSize: 2

Expected behavior

[WRONG_INDENTATION] only spaces are allowed for indentation and each indentation should equal to 2 spaces (tabs are not allowed): expected 2 but was 4 (diktat-ruleset:indentation)

Observed behavior

[WRONG_INDENTATION] only spaces are allowed for indentation and each indentation should equal to 4 spaces (tabs are not allowed): expected 2 but was 4 (diktat-ruleset:indentation)

Steps to Reproduce

Environment information

nulls commented 9 months ago

Hi @colesnodgrass, thanks for raising the issue.

We will fix the warn message