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

Add new rule EC31: Prefer lighter formats for image files #52

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

salah-dev-inp
Copy link

No description provided.

@salah-dev-inp salah-dev-inp force-pushed the EC31-prefer-lighter-formats-for-image-file branch from 4a61b04 to b69c5f3 Compare May 30, 2024 12:06

### Deleted
## [1.6.2] - 2024-05-30
Copy link
Member

Choose a reason for hiding this comment

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

why do you add this section title ?
please remove it and let your new line added under "Unreleased" section

import org.sonar.api.utils.log.Loggers;

@Rule(key = "EC31")
@DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "EC31")
Copy link
Member

Choose a reason for hiding this comment

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

why do you add this line ?

if (tree.is(Tree.Kind.STRING_LITERAL)) {
LiteralTree literalTree = (LiteralTree) tree;
String value = literalTree.value();

Copy link
Member

Choose a reason for hiding this comment

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

her, you can "return" empty if your string length is not > 6 (because the minimum length is 7 for your image name is : "a.png"
thus no need to execute the next if and the next for of the algorithm, for nothing.

public PreferLighterImageFormatsCheck(PreferLighterImageFormatsCheck checker) {
}


Copy link
Member

Choose a reason for hiding this comment

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

add a use case test with my review feedback above => no need to check if string length isn't > 6

Copy link

This PR has been automatically marked as stale because it has no activity for 30 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants