Skip to content

#5014 Fix MaxChainedCallsOnSameLine false positives - #5020

Merged
BraisGabin merged 1 commit into
detekt:mainfrom
dzirbel:maxChainedCallsImport
Jul 2, 2022
Merged

BraisGabin merged 1 commit into
detekt:mainfrom
dzirbel:maxChainedCallsImport

Conversation

@dzirbel

@dzirbel dzirbel commented Jun 30, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Fix issues where MaxChainedCallsOnSameLine would report long import and package directives, where a warning certainly isn't necessary.
@dzirbel dzirbel changed the title #5014 Fix MaxChainedCallsOnSameLine false positives for imports #5014 Fix MaxChainedCallsOnSameLine false positives Jun 30, 2022
@dzirbel

dzirbel commented Jun 30, 2022

Copy link
Copy Markdown
Contributor Author

I've now run on the detekt codebase (with a max of 7 since there are some violations longer than 5) to verify that there aren't any more obvious false positives.

There are still interesting cases (example) with fully-qualified class names which still violate this rule; thoughts on what to do there? I haven't looked into it yet, but I'm not certain whether it will be possible to differentiate those from normal qualified expressions.

@BraisGabin

Copy link
Copy Markdown
Member

I think that we will need to use type solving.

@schalkms

schalkms commented Jul 1, 2022

Copy link
Copy Markdown
Member

I think that we will need to use type solving.

How would that rule benefit from type solving? Could you please highlight an example?

@dzirbel

dzirbel commented Jul 1, 2022

Copy link
Copy Markdown
Contributor Author

I think that we will need to use type solving.

How would that rule benefit from type solving? Could you please highlight an example?

This was in response to this example of a fully-qualified class name which this rule currently flags. Probably this rule should ignore such cases (although this one can just be imported), but I agree that type resolution is probably necessary to determine whether a chained calls are from a fully qualified class name. I'll open a separate issue to track/discuss that.

@BraisGabin
BraisGabin merged commit 6edf6bb into detekt:main Jul 2, 2022
@dzirbel
dzirbel deleted the maxChainedCallsImport branch July 2, 2022 21:04
@cortinico cortinico added this to the 1.21.0 milestone Jul 5, 2022

This branch was successfully deployed

1 active deployment
Preview — 5e7ba7d0 Deployed Jun 30, 2022 by vercel[bot]
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.

5 participants