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

MaxChainedCallsOnSameLine: don't count package references as chained calls #5036

Merged
merged 2 commits into from Jul 5, 2022

Conversation

t-kameyama
Copy link
Contributor

@t-kameyama t-kameyama commented Jul 4, 2022

Fixes #5028

Copy link
Collaborator

@BraisGabin BraisGabin left a comment

Thanks!

@Test
fun `does not report 2 calls on a single line with a max of 3`() {
val rule = MaxChainedCallsOnSameLine(TestConfig(mapOf("maxChainedCalls" to 3)))
val code = "val a = 0.plus(0)"

assertThat(rule.compileAndLint(code)).isEmpty()
assertThat(rule.lintWithContext(env, code)).isEmpty()
Copy link
Collaborator

@BraisGabin BraisGabin Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use compileLintWithContext in all this cases?

Copy link
Contributor Author

@t-kameyama t-kameyama Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BraisGabin BraisGabin added this to the 1.21.0 milestone Jul 5, 2022
@BraisGabin BraisGabin merged commit aa2a1bf into detekt:main Jul 5, 2022
19 checks passed
@t-kameyama t-kameyama deleted the issue_5028 branch Jul 5, 2022
@TWiStErRob
Copy link
Contributor

TWiStErRob commented Jul 9, 2022

Does this also fix import statements?

Chained calls beyond the maximum should be wrapped to a new line.

@BraisGabin
Copy link
Collaborator

BraisGabin commented Jul 9, 2022

That was fixed on other pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaxChainedCallsOnSameLine reports fully-qualified class names
4 participants