Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SONARJAVA-5383 Lookup Spring-web dependency version to filter out visitors #5053

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

Conversation

romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Mar 11, 2025

SONARJAVA-5383

Minimal example of what can be achieved by looking at dependency versions.
Improves the SpringComposedRequestMappingCheck

@romainbrenguier romainbrenguier force-pushed the romain/SONARJAVA-5383-MPV branch 6 times, most recently from 8d299c6 to 70d7cd8 Compare March 12, 2025 11:57
@@ -120,7 +120,7 @@ public void javaCheckTestSources() throws Exception {
.setProjectName(PROJECT_NAME)
.setProjectVersion("0.1.0-SNAPSHOT")
.setSourceEncoding("UTF-8")
.setSourceDirs("aws/src/main/java/,default/src/main/java/,java-17/src/main/java/,spring-3.2/src/main/java/")
.setSourceDirs("aws/src/main/java/,default/src/main/java/,java-17/src/main/java/,spring-3.2/src/main/java/,spring-web-4.0/src/main/java/")

Choose a reason for hiding this comment

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

In the root folder of sonar-java we have the .cirrus.yml file where in some parts we exclude test source modules to avoid FPs on Mend for instance, at line 89 of this yml file for instance

We will need to add this new module in such places as well

Choose a reason for hiding this comment

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

I think it's just at line 89 and 121

@@ -23,4 +23,6 @@ private Constants() {

public static final String SPRING_3_2 = "../java-checks-test-sources/spring-3.2";
public static final String SPRING_3_2_CLASSPATH = SPRING_3_2 + "/target/test-classpath.txt";
public static final String SPRING_WEB_4_0 = "../java-checks-test-sources/spring-web-4.0";

Choose a reason for hiding this comment

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

Not a strong opinion on this one, I let you decide

We should probably name this/these constants differently, as their usages will look like Constants.SPRING_WEB_4_0 which is not clear what it represents, to something like SPRING_WEB_4_0_PROJECT or SPRING_WEB_4_0_ROOT. I don't know if we want to change also the SPRING_3_2 right now for consistency, or skip it for the sake of smaller scope possible of the PR

private static final Pattern VERSION_PATTERN = Pattern.compile(VERSION_REGEX);

/**
* matcher must come from a match again a pattern that contains {@link #VERSION_REGEX} and no other groups.

Choose a reason for hiding this comment

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

Suggested change
* matcher must come from a match again a pattern that contains {@link #VERSION_REGEX} and no other groups.
* matcher must come from a match against a pattern that contains {@link #VERSION_REGEX} and no other groups.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@romainbrenguier romainbrenguier marked this pull request as ready for review March 12, 2025 14:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants