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

Benni testing code rabbit AI (please ignore) #507

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
logger.debug("Searching jar file {} for a single git.properties", file);
try {
List<T> data = dataExtractor.extractData(file, isJarFile, recursiveSearch);
if (data.isEmpty()) {

Check failure on line 65 in agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java#L65

The variable `data` may contain a null value at this point and is dereferenced https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=benni-test-code-rabbit%3AHEAD&id=2825773AA24CF85D03469876CF0F0D15
logger.debug("No git.properties files found in {}", file.toString());
return;
}
Expand All @@ -73,6 +73,13 @@
}
T dataEntry = data.get(0);

// Some unrelated comment. Let's see if the AI finds this.
if (data == null) {
// TODO: This should actually not be possible, as we accessed methods of data above

Check warning on line 78 in agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java#L78

TODO: This should actually not be possible, as we accessed methods of data above https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=benni-test-code-rabbit%3AHEAD&id=9CB8B7208BF1AE71894B5AA8C41DE689
logger.warn("No git.properties files found in {}", file.toString());
System.err.println("Let's also print to stderr for a bit. PS: Teamscale flags this.");

Check warning on line 80 in agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java

View check run for this annotation

cqse.teamscale.io / teamscale-findings

agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java#L80

Method `System.err.println` should not be called https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=benni-test-code-rabbit%3AHEAD&id=10EC6EAB18EFA91A9AF86F924B991BC4
}
Comment on lines +77 to +81
Copy link

Choose a reason for hiding this comment

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

Remove redundant null check and associated log messages.

The null check for data is redundant as methods of data were accessed earlier, indicating it cannot be null at this point. The associated log messages and the System.err.println call should also be removed.

-			if (data == null) {
-				// TODO: This should actually not be possible, as we accessed methods of data above
-				logger.warn("No git.properties files found in {}", file.toString());
-				System.err.println("Let's also print to stderr for a bit. PS: Teamscale flags this.");
-			}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (data == null) {
// TODO: This should actually not be possible, as we accessed methods of data above
logger.warn("No git.properties files found in {}", file.toString());
System.err.println("Let's also print to stderr for a bit. PS: Teamscale flags this.");
}
Tools
GitHub Check: teamscale-findings

[warning] 80-80: agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java#L80
[New] Method System.err.println should not be called
https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=benni-test-code-rabbit%3AHEAD&id=10EC6EAB18EFA91A9AF86F924B991BC4


[warning] 78-78: agent/src/main/java/com/teamscale/jacoco/agent/commit_resolution/git_properties/GitSingleProjectPropertiesLocator.java#L78
[New] TODO: This should actually not be possible, as we accessed methods of data above
https://cqse.teamscale.io/findings/details/teamscale-jacoco-agent?t=benni-test-code-rabbit%3AHEAD&id=9CB8B7208BF1AE71894B5AA8C41DE689


if (foundData != null) {
if (!foundData.equals(dataEntry)) {
logger.warn(
Expand Down
Loading