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
Add configuration to add alternate trimming methods #6063
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Codecov Report
@@ Coverage Diff @@
## main #6063 +/- ##
=========================================
Coverage 84.86% 84.86%
- Complexity 3975 3977 +2
=========================================
Files 564 564
Lines 13300 13304 +4
Branches 2325 2327 +2
=========================================
+ Hits 11287 11291 +4
Misses 870 870
Partials 1143 1143
|
@@ -62,10 +62,13 @@ class MultilineRawStringIndentation(config: Config) : Rule(config) { | |||
@Configuration("indentation size") | |||
private val indentSize by config(4) | |||
|
|||
@Configuration("allows to provide a list of multiline string trimming methods") | |||
private val trimmingMethods: List<String> by config(listOf("trimIndent", "trimMargin")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the method matcher that we have on forbidden method call? I assume it is not needed. If someone really needs it we could add it later without any breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @BraisGabin this will change the old behaviour, initially, we used to allow any multiline sting with any method with name trimMargin
method at the end. Now since we are asking for the FunctionMatcher
that would mean that we are checking for function signature and hence the above-mentioned usage will be reported by the rule.
Also adding FunctionMatcher
will need bindingContext
to get the FqName
of trimming method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't necessarily add bindingcontext
here. IMHO, it doesn't add much value over using the current approach in this PR.
Waiting to ensure that at least one of the windows job work to merge it. We should work on the flakiness that we have on our rule set on windows. |
Fixes #5415