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

Sonar Cloud miscellaneous fixes 2 #10062

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

CDellaGiusta
Copy link
Contributor

What does this PR change?

Fixes the following SonarCloud issues, where the fixes are straightforward
After review and approval, they will be squashed into one commit only

SonarCloud fix: java:S1858 toString() should never be called on a String object
SonarCloud fix: java:S1158 Use static primitive wrapper class toString() method
SonarCloud fix: java:S1185 Overriding methods should do more than simply call the same method in the super class
SonarCloud fix: java:S1656 Remove or correct useless self-assignment
SonarCloud fix: java:S1157 Replace toUpperCase()/toLowerCase() and equals() calls with a single equalsIgnoreCase() call
SonarCloud fix: java:S1130 Remove the declaration of thrown exception as it cannot be thrown from method body
SonarCloud fix: java:S2209 Static members should be accessed statically
SonarCloud fix: java:S2097 equals(Object obj) should test the argument type

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed: only internal and user invisible changes
  • DONE

Test coverage

  • No tests: already covered
  • DONE

Links

Issue(s):
Port(s):

  • DONE

Changelogs

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@CDellaGiusta CDellaGiusta self-assigned this Mar 26, 2025
@CDellaGiusta CDellaGiusta added the sonar-cloud-error-reduction all items related to reduce the number of errors in SonarCloud label Mar 26, 2025
Copy link
Contributor

👋 Hello! Thanks for contributing to our project.
Acceptance tests will take some time (aprox. 1h), please be patient ☕

You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/10062/checks
Once tests finish, if they fail, you can check 👀 the cucumber report. See the link at the output of the action.
You can also check the artifacts section, which contains the logs at https://github.com/uyuni-project/uyuni/pull/10062/checks.

If you are unsure the failing tests are related to your code, you can check the "reference jobs". These are jobs that run on a scheduled time with code from master. If they fail for the same reason as your build, it means the tests or the infrastructure are broken. If they do not fail, but yours do, it means it is related to your code.

Reference tests:

KNOWN ISSUES

Sometimes the build can fail when pulling new jar files from download.opensuse.org . This is a known limitation. Given this happens rarely, when it does, all you need to do is rerun the test. Sorry for the inconvenience.

For more tips on troubleshooting, see the troubleshooting guide.

Happy hacking!
⚠️ You should not merge if acceptance tests fail to pass. ⚠️

@CDellaGiusta CDellaGiusta force-pushed the sonar-miscellaneous-fixes-2 branch from 33966a4 to a703ab3 Compare March 26, 2025 14:22
@CDellaGiusta CDellaGiusta marked this pull request as ready for review March 26, 2025 14:50
@CDellaGiusta CDellaGiusta requested a review from a team as a code owner March 26, 2025 14:50
@CDellaGiusta CDellaGiusta requested review from nadvornik, cbosdo, mcalmer, mackdk, rjmateus, Serp1co, mbussolotto and cbbayburt and removed request for a team March 26, 2025 14:50
@CDellaGiusta CDellaGiusta force-pushed the sonar-miscellaneous-fixes-2 branch from a703ab3 to fb90883 Compare March 27, 2025 08:21
@@ -70,7 +70,7 @@ public String getMinionId() {
* @param minionIdIn the new id
*/
public void setMinionId(String minionIdIn) {
this.minionId = minionId;
this.minionId = minionIdIn;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ouch, this was pretty bad. I would guess this setter was never used, otherwise it would have been a problem.

I would evaluate if it's possible to remove all the setters and turn this pojo into an immutable object.

Comment on lines +40 to +44
this.id = idIn;
this.identifier = identifierIn;
this.version = versionIn;
this.releaseType = releaseTypeIn;
this.arch = archIn;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this constructor was never used either luckily, maybe we can just remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants