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

[EC63] UnnecessarilyAssignValuesToVariables rule on caught exception #230

Conversation

natixis-caen
Copy link
Contributor

Stop to mark unused exception variables as code smell.

@natixis-caen
Copy link
Contributor Author

Hi @dedece35 , I checked the list and this PR should be ok regarding the criteria.

Copy link
Member

@utarwyn utarwyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👌 Can you update the CHANGELOG?

utarwyn
utarwyn previously approved these changes Oct 20, 2023
…rilyAssignValuesToVariables_rule_on_caught_exception

# Conflicts:
#	CHANGELOG.md

public void testCompliantCatchException() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for me, but, please remove "throws Exception" because no Exception really thrown.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natixis-caen : last modification , then I will approve this PR :p

@dedece35
Copy link
Member

dedece35 commented Dec 1, 2023

To discuss in core-team : deprecation of this rule only for Java

Copy link

sonarqubecloud bot commented Dec 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

80.0% 80.0% Coverage
0.0% 0.0% Duplication

@utarwyn
Copy link
Member

utarwyn commented Dec 6, 2023

@dedece35
To discuss in core-team : deprecation of this rule only for Java

Why this rule should be deprecated? Already in SonarQube? In fact, there are already 22 Java rules in SonarQube about not using variables/code. https://rules.sonarsource.com/java/tag/unused/RSPEC-1481/ Perhaps EC63 is a kind of duplicate? to be discussed.

@dedece35
Copy link
Member

dedece35 commented Dec 9, 2023

Hi @utarwyn, @glalloue, @jhertout,

after checking completyly this rule (currently, only implemented in JAVA), you're right @utarwyn, there is already 2 native SonarQube rules for 2 subjects "unused variable" and "return directly instead of creation of temporary variable" implemented in our ecoCode rule EC63 :

Second thing, all implemented tests show that our EC63 rule is a duplication of 3 previous native Sonarqube rules : in each line of test files that we check if we have an issue reported by our rule, there is also a native Sonarqube rule that reports also an issue.

maybe we can use "ecocode" tag to native SaonrQube rules with our tool : https://github.com/green-code-initiative/ecoCode-common/tree/main/tools/rules_config#tagging-scripts
please see issue green-code-initiative/creedengo-common#26

for me, we can deprecate this rule, now. OK with me ?
if we are ok to deprecate it, 3 issues and the current PR will be closed :p and a new PR will be created to depreciate this EC63 rule.

@dedece35
Copy link
Member

draft : waiting for #258

@dedece35
Copy link
Member

Hi @natixis-caen and @utarwyn,
as #258 has been merged to deprecate rule EC63, this PR is closed without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java 👀 👀 review done 👀 👀 review done - waiting for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EC63] UnnecessarilyAssignValuesToVariables rule on caught exception
3 participants