Skip to content

refactoring/536_Resolve_Sonar_cloud_findings#539

Open
redcatbear wants to merge 17 commits into
mainfrom
refactoring/536_Resolve_Sonar_cloud_findings
Open

refactoring/536_Resolve_Sonar_cloud_findings#539
redcatbear wants to merge 17 commits into
mainfrom
refactoring/536_Resolve_Sonar_cloud_findings

Conversation

@redcatbear
Copy link
Copy Markdown
Collaborator

@redcatbear redcatbear commented Jun 3, 2026

This is part 2 of the solution for #536. After the local Sonar findings are addressed, we now work on the SonarCloud findings.

Contributes to #536.

@redcatbear redcatbear self-assigned this Jun 3, 2026
@redcatbear redcatbear added the refactoring Code improvement without behavior change label Jun 3, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
60.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

result = prime * result + (this.withoutTags ? 1231 : 1237);
result = prime * result + ((this.tags == null) ? 0 : this.tags.hashCode());
return result;
return Objects.hash(this.artifactTypes, this.tags, this.withoutTags);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only mentioned once: check if a Test with equalsverifier exists

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Junie says:

No classes were found that override equals and/or hashCode but lack a matching EqualsVerifier unit test. All identified classes that implement these methods are already covered by EqualsVerifier.

*/
public Set<String> getArtifactTypes()
{
return this.artifactTypes;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this necessary when the builder already makes the list unmodifiable?
Only mentioned once.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You are right. Should only be done once in the builder.

public Builder artifactTypes(final Set<String> artifactTypes)
{
this.artifactTypes = artifactTypes;
this.artifactTypes = Collections.unmodifiableSet(artifactTypes);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better create a defensive copy. Only mentioned once.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

public Map<LinkStatus, List<LinkedSpecificationItem>> getLinks()
{
return this.links;
return new EnumMap<>(this.links);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make immutable

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This one is tricky, since there is a bidirectional linking mechanism in the way.
Create issue #540.

Comment thread core/src/main/java/org/itsallcode/openfasttrace/core/report/ReportService.java Outdated
}
catch (final ClassNotFoundException ignore)
{
LOGGER.log(Level.FINEST, () -> "Unable to find class " + name + " with child logger."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Classloader, not logger.
Add classloader names to log Message

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.


final SpecificationListBuilder builder = this.builderArg.getValue();
assertThat(result, sameInstance(builder.build()));
assertThat(result, equalTo(builder.build()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ensure that model class is tested with equalsverifier

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

SpecificationItem has that test.

@@ -49,7 +50,7 @@ private void processLine(final LineConsumer consumer, final int currentLineNumbe
catch (final Exception exception)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe catching runtimeexception is enough here? Then you can avoid the suppression.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea.

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

Labels

refactoring Code improvement without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants