You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be a new rule, not an improvement to an existing rule.
This rule would be generally useful, not specific to my code or setup.
Suggested rule title
Should use 'LeftStr' instead of 'Copy' from start
Rule description
Using Copy(Text, 1, Count) is the equivalent of using LeftStr(Text, Count) but impacts readability and making the intention harder to understand. Using LeftStr conveys intention better.
Rationale
Seeing many Copy used in different context makes it harder to understand the intention of its usage. By removing a sizeable chunk of generic Copy(Text, 1, Count), it makes it easier to focus on where other usage of Copy does matter.
The text was updated successfully, but these errors were encountered:
Skarvion
changed the title
Should use LeftStr(Text, Count) instead of Copy(Text, 1, Count)
New rule: Should use LeftStr(Text, Count) instead of Copy(Text, 1, Count)Aug 12, 2024
Sounds more like a StrUtils should be preferred over 'Copy' rule, given that there are multiple StrUtils routines that just use Copy under the hood.
Those routines are:
LeftStr
RightStr
MidStr
MidStr is a bit funny, it's a braindead wrapper around Copy that just directly forwards the arguments.
I think this rule has some value for consistency purposes primarily, but it's on the nitpicky side. I wouldn't want it to be included in the default quality profile.
Cirras
changed the title
New rule: Should use LeftStr(Text, Count) instead of Copy(Text, 1, Count)
New rule: StrUtils should be preferred over 'Copy'
Aug 12, 2024
Prerequisites
Suggested rule title
Should use 'LeftStr' instead of 'Copy' from start
Rule description
Using
Copy(Text, 1, Count)
is the equivalent of usingLeftStr(Text, Count)
but impacts readability and making the intention harder to understand. UsingLeftStr
conveys intention better.Rationale
Seeing many
Copy
used in different context makes it harder to understand the intention of its usage. By removing a sizeable chunk of genericCopy(Text, 1, Count)
, it makes it easier to focus on where other usage ofCopy
does matter.The text was updated successfully, but these errors were encountered: