Add StringShouldBeRawString.kt rule - #5705
Conversation
3f0c9fa to
dbc255b
Compare
Codecov Report
@@ Coverage Diff @@
## main #5705 +/- ##
===========================================
+ Coverage 0 84.46% +84.46%
- Complexity 0 3753 +3753
===========================================
Files 0 544 +544
Lines 0 12763 +12763
Branches 0 2236 +2236
===========================================
+ Hits 0 10780 +10780
- Misses 0 865 +865
- Partials 0 1118 +1118
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
Couple of notes:
|
The second example on the issue doesn't talk about multi-line. A regex is a good example of a single line raw string that is better than a normal string. |
|
Good point. I only looked at this very quickly, but the issue being fixed is "Rule for encouraging MultilineRawString". The proposed rule is a bit different. Agree that this proposal makes sense as is, so ignore my comment :) |
Rename fun to getStringSequenceExcludingRawString
| if (maxEscapedCharacterCount == Int.MAX_VALUE) { | ||
| return | ||
| } |
There was a problem hiding this comment.
If the user doesn't want this rule s/he should disable it. We don't need to have two different ways to disable it.
There was a problem hiding this comment.
Sure. But currently if we set Int.MAX_VALUE in the detekt.yml the working of rule breaks. BTW @BraisGabin is there any sanitisation on user input through detekt.yml?
There was a problem hiding this comment.
Int.MAX_VALUE doesn't seems like a sane value. We shouldn't care about that. If they would like the max value of a long it wouldn't work either 🤷.
There was a problem hiding this comment.
And there is little sanitation on that regard as far as I know.
Remove corresponding Int tests Make extension parameter non null
|
Hi @BraisGabin is this PR good for merge? Or some changes are required? cc @cortinico @TWiStErRob for their inputs as well |
|
This is good to go! Sorry for the delay :) |
Fixes #5697