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

#5014 Fix MaxChainedCallsOnSameLine false positives #5020

Merged
merged 1 commit into from Jul 2, 2022

Conversation

dzirbel
Copy link
Contributor

@dzirbel dzirbel commented Jun 30, 2022

No description provided.

Fix issues where MaxChainedCallsOnSameLine would report long import and package directives, where a warning certainly isn't necessary.
@dzirbel dzirbel force-pushed the maxChainedCallsImport branch from 3ca38be to 5e7ba7d Compare Jun 30, 2022
@dzirbel dzirbel changed the title #5014 Fix MaxChainedCallsOnSameLine false positives for imports #5014 Fix MaxChainedCallsOnSameLine false positives Jun 30, 2022
@dzirbel
Copy link
Contributor Author

dzirbel commented Jun 30, 2022

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
Collaborator

BraisGabin commented Jun 30, 2022

I think that we will need to use type solving.

@schalkms
Copy link
Member

schalkms commented Jul 1, 2022

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
Copy link
Contributor Author

dzirbel commented Jul 1, 2022

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
18 of 19 checks passed
@dzirbel dzirbel deleted the maxChainedCallsImport branch Jul 2, 2022
@cortinico cortinico added this to the 1.21.0 milestone Jul 5, 2022
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.

None yet

5 participants