Skip to content
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

RulesConfigReader does not remove whitespaces for testDirs #1288

Closed
HaukeRa opened this issue May 3, 2022 · 2 comments · Fixed by #1537
Closed

RulesConfigReader does not remove whitespaces for testDirs #1288

HaukeRa opened this issue May 3, 2022 · 2 comments · Fixed by #1537
Assignees
Labels
bug Something isn't working

Comments

@HaukeRa
Copy link

HaukeRa commented May 3, 2022

Describe the bug

When reading the rules configuration from YAML, whitespaces around entries of testDirs are not removed.
https://github.com/analysis-dev/diktat/blob/759c26500de9c86c58af875f750017f14e3d2208/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt#L111-L112

Expected behavior

Whitespaces are removed, as it is done for sourceDirectories:https://github.com/analysis-dev/diktat/blob/759c26500de9c86c58af875f750017f14e3d2208/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt#L148-L149

Environment information

  • diktat version: 1.1.0
  • build tool (gradle): 7.4.2
  • how is diktat run (CLI, plugin, etc.): spotless
  • kotlin version: 1.6.20
  • operating system: windows/ubuntu
@HaukeRa HaukeRa added the bug Something isn't working label May 3, 2022
@orchestr7
Copy link
Member

orchestr7 commented May 3, 2022

Could you please provide an example of such yml config?

@HaukeRa
Copy link
Author

HaukeRa commented May 3, 2022

Sure:

- name: DIKTAT_COMMON
  configuration:
    domainName: com.example
    testDirs: "test, androidUnitTest"
    # expected values:  disabledChapters: "Naming, Comments, General, Variables, Functions, Classes"
    # or: "1, 2, 3, 4, 5, 6"
    disabledChapters: ""
    kotlinVersion: 1.6
    srcDirectories: "main, commonMain, iosMain, jvmMain, androidMain"

the androidUnitTest directory does not get its whitespace removed and is handled as ⎵androidUnitTest, effectively causing many problems in the corresponding inspections.

Of course the list could be defined without the space, but as it is often used for readability and also the srcDirectories entries get potential whitespaces removed, both lists should behave the same.

Cheshiriks added a commit that referenced this issue Oct 28, 2022
### What's done:
* added trim() for testDirs value
Closes #1288
Cheshiriks added a commit that referenced this issue Oct 28, 2022
### What's done:
* Added trim() for list of string test directories
Closes #1288
Cheshiriks added a commit that referenced this issue Oct 28, 2022
* Added trim() for testDirs value

### What's done:
* added trim() for testDirs value
Closes #1288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants