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

Have Calls to Extension Functions Respect maxCallsInOneLine #1705

Closed
adamsmd opened this issue Jul 10, 2023 · 1 comment · Fixed by #1858
Closed

Have Calls to Extension Functions Respect maxCallsInOneLine #1705

adamsmd opened this issue Jul 10, 2023 · 1 comment · Fixed by #1858
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@adamsmd
Copy link

adamsmd commented Jul 10, 2023

Describe the bug

The number of allowed extension function calls on a line does not seem to respect [WRONG_NEWLINES].maxCallsInOneLine.

Steps to Reproduce

In diktat.kt:

- name: WRONG_NEWLINES
  configuration:
    maxParametersInOneLine: 100
    maxCallsInOneLine: 100

Somewhere in your Kotlin code:

3.toInt().toInt().toInt().toInt()

(Granted, using toInt() repeatedly this way is dumb. This is just to make the example simple.)

Expected behavior

No warning from DiKTat.

Observed behavior

DiKTat produces the following warning:

[WRONG_NEWLINES] incorrect line breaking: wrong split long `dot qualified expression` or `safe access expression` (diktat-ruleset:newlines)

Notes

This issue seems to be related to the use of a magic number instead of a configuration variable at the following, but I don't understand enough of the code to know if that number controls other things:

Environment information

  • diktat version: 1.2.5
  • build tool (maven/gradle): gradle
  • how is diktat run (CLI, plugin, etc.): plugin
  • kotlin version: 1.8
  • operating system: Linux
  • link to a project (if your project is public): Project not public yet
@adamsmd adamsmd added the bug Something isn't working label Jul 10, 2023
@nulls
Copy link
Member

nulls commented Jul 10, 2023

hi @adamsmd, thanks for raising the issue.
We will look into it

@nulls nulls added this to the 2.0.0 milestone Jul 11, 2023
@nulls nulls modified the milestones: 2.0.0, 2.1.0 Nov 21, 2023
@DrAlexD DrAlexD self-assigned this Dec 12, 2023
DrAlexD added a commit that referenced this issue Dec 12, 2023
### What's done:
- Fixed bug related to case when the number of allowed extension function calls in one line did not match `maxCallsInOneLine` configuration.
- Fixed several warning tests.
- Added new warning test.

Closes #1705
@DrAlexD DrAlexD modified the milestones: 2.1.0, 2.0.0 Dec 12, 2023
DrAlexD added a commit that referenced this issue Dec 12, 2023
…1858)

### What's done:
- Fixed bug related to case when the number of allowed extension function calls in one line did not match `maxCallsInOneLine` configuration.
- Fixed several warning tests.
- Added new warning test.

Closes #1705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants