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
Is your feature request related to a problem? Please describe.
The java rule Avoid using global variables with id cnumr-java:D4 isn't really "good" for our society for different reasons :
java IDE generates automatically a global variable with serialID for classes implementing "Serializable" interface : we have a lot this kind of modification : please see capture
it's a good practice in java language to have a common global variable representing a constant used in one or several classes : please see capture
it's a good practice in java language to have a common global variable with pre-compiled regex Pattern to avoid compiling this pattern each time a local method is called. This rule is against native SaonrQube rule Regex patterns should not be created needlessly (id : java:S4248) : please see capture
please check also rule Avoid using Pattern.compile() in a non-static context. (id cnumr-java:S77) because it's quite against the rule Avoid using global variables (id cnumr-java:D4)
Describe the solution you'd like
for the moment, this rule is disabled in our SonarQube
I totally agree with you concerning constant, I do not know why this rule have been merged without change, I was highlighting it in the PR: cnumr/ecoCode#93
In Java we could consider that this code could be bad practice:
dedece35
changed the title
Java Rule "Avoid using global variables" discussion
[EC4] [Java] Rule "Avoid using global variables" discussion
Aug 25, 2023
Is your feature request related to a problem? Please describe.
The java rule
Avoid using global variables
with idcnumr-java:D4
isn't really "good" for our society for different reasons :Regex patterns should not be created needlessly
(id :java:S4248
) : please see captureplease check also rule
Avoid using Pattern.compile() in a non-static context.
(idcnumr-java:S77
) because it's quite against the ruleAvoid using global variables
(idcnumr-java:D4
)Describe the solution you'd like
what is your point of view @glalloue, @jules-delecour-dav, @jhertout, @olegoaer, @mdubois81 ?
The text was updated successfully, but these errors were encountered: