Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions SONAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ Auto scan not triggering

With manual scan, scan runs, but no pr decoration

There was a permission request on the solubris github org for sonarcloud,
but it was not accepted so sonarcloud did not have access to the repos.
This is a manual step that needs to be done by someone with admin access to the github org.

Can probably go back to auto scan now.

12 changes: 6 additions & 6 deletions src/main/java/com/solubris/enforcer/VersionPropertyRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ protected Stream<String> scan() {
.filter(Artifact::hasImplicitVersion)
.count();
if (artifacts.size() > 1) {
if (propertyCount == 0) return missingPropertyViolation(effectiveVersion, artifacts);
if (propertyCount < artifacts.size()) return unusedPropertyViolation(effectiveVersion, artifacts);
if (propertyCount == 0) return missingProperty(effectiveVersion, artifacts);
if (propertyCount < artifacts.size()) return unusedProperty(effectiveVersion, artifacts);
} else if (artifacts.size() == 1) {
if (propertyCount == 1) return redundantPropertyViolation(artifacts.get(0));
if (propertyCount == 1) return redundantProperty(artifacts.get(0));
}
return null;
}).filter(Objects::nonNull);
Expand All @@ -96,7 +96,7 @@ private String fetchVersion(Artifact a, Map<String, List<Artifact>> byKey) {
return null;
}

private String redundantPropertyViolation(Artifact artifact) {
private String redundantProperty(Artifact artifact) {
if (allowSingleUseOfProperty) return null;

return String.format(
Expand All @@ -113,7 +113,7 @@ private String redundantPropertyViolation(Artifact artifact) {
* <p>Could the artifacts refer to different properties that have the same value?
* That's possible due to coincidental properties - another edge case to consider.
*/
private static String unusedPropertyViolation(String effectiveVersion, List<Artifact> artifacts) {
private static String unusedProperty(String effectiveVersion, List<Artifact> artifacts) {
String unused = artifacts.stream()
.filter(Artifact::hasExplicitVersion)
.map(Artifact::key)
Expand All @@ -128,7 +128,7 @@ private static String unusedPropertyViolation(String effectiveVersion, List<Arti
propertyName, effectiveVersion, unused);
}

private String missingPropertyViolation(String version, List<Artifact> artifacts) {
private String missingProperty(String version, List<Artifact> artifacts) {
if (!requirePropertiesForDuplicates) return null;

String unused = artifacts.stream()
Expand Down
Loading