-
Notifications
You must be signed in to change notification settings - Fork 207
build(#4884): upgrade qulice to version 0.25.1 in eo-maven-plugin #4897
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,12 @@ | |||||||||||||||||
| * Concurrent cache wrapper for Cache. | ||||||||||||||||||
| * Wrap {@link Cache} to make it thread-safe. | ||||||||||||||||||
| * @since 0.60 | ||||||||||||||||||
| * @todo #4884:30min Use ReentrantLock instead of synchronized block. | ||||||||||||||||||
| * This is the suggestion from qulice. | ||||||||||||||||||
| * Dont' forget to remove the PMD suppression for AvoidSynchronizedStatement | ||||||||||||||||||
| * after that. | ||||||||||||||||||
|
Comment on lines
+15
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo in TODO Javadoc text. Line 17 has a typo ( ✍️ Suggested edit- * Dont' forget to remove the PMD suppression for AvoidSynchronizedStatement
+ * Don't forget to remove the PMD suppression for `AvoidSynchronizedStatement`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| */ | ||||||||||||||||||
| @SuppressWarnings("PMD.AvoidSynchronizedStatement") | ||||||||||||||||||
| final class ConcurrentCache { | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| * List of dependencies. | ||
| * @since 0.54 | ||
| */ | ||
| @FunctionalInterface | ||
| interface Dependencies extends Iterable<Dep> { | ||
|
Comment on lines
+20
to
21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let me find the exact file and read it to understand the context
cat -n eo-maven-plugin/src/main/java/org/eolang/maven/Dependencies.javaRepository: objectionary/eo Length of output: 4656 🏁 Script executed: # Check if Dependencies is ever instantiated via lambda or method reference
rg -n --type java 'Dependencies\s+[a-zA-Z_$][a-zA-Z0-9_$]*\s*=' eo-maven-plugin/src/main/java/org/eolang/maven/ -A 2 -B 2Repository: objectionary/eo Length of output: 578 🏁 Script executed: # Also check for direct lambda instantiation patterns
rg -n --type java '\(\)\s*->\s*' eo-maven-plugin/src/main/java/org/eolang/maven/Dependencies.java -A 2 -B 2Repository: objectionary/eo Length of output: 41 🏁 Script executed: # Find all classes implementing Dependencies
rg -n --type java 'implements\s+Dependencies' eo-maven-plugin/src/main/java/org/eolang/maven/Repository: objectionary/eo Length of output: 1189 🏁 Script executed: # Check if there are any lambda assignments to Dependencies anywhere
rg -n --type java 'Dependencies\s+\w+\s*=\s*\(' eo-maven-plugin/src/main/java/org/eolang/maven/ -A 1Repository: objectionary/eo Length of output: 41 Remove
Additionally, extract the magic number at line 114: The hardcoded 🤖 Prompt for AI Agents |
||
| /** | ||
| * Fake dependencies. | ||
|
|
@@ -106,14 +107,11 @@ static Dep runtimeDep() { | |
| */ | ||
| private static Dep randDep() { | ||
| final Random rand = new SecureRandom(); | ||
| final String scope = new String[] { | ||
| "test", "compiled", "runtime", | ||
| }[rand.nextInt(3)]; | ||
| return Dependencies.Fake.dep( | ||
| UUID.randomUUID().toString(), | ||
| UUID.randomUUID().toString(), | ||
| String.valueOf(rand.nextInt(Integer.MAX_VALUE)), | ||
| scope | ||
| new String[]{"test", "compiled", "runtime"}[rand.nextInt(3)] | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -126,7 +124,6 @@ private static Dep randDep() { | |
| * @return Dependency. | ||
| * @checkstyle ParameterNumberCheck (5 lines) | ||
| */ | ||
| @SuppressWarnings("PMD.UseObjectForClearerAPI") | ||
| private static Dep dep( | ||
| final String group, | ||
| final String artifact, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,10 +77,11 @@ void exec() throws IOException { | |||||
| * Lint. | ||||||
| * @throws IOException If fails | ||||||
| */ | ||||||
| @SuppressWarnings("PMD.UnnecessaryLocalRule") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the MjLint.java file around line 80 for full context
sed -n '70,120p' eo-maven-plugin/src/main/java/org/eolang/maven/MjLint.javaRepository: objectionary/eo Length of output: 2065 🏁 Script executed: # Search for "UnnecessaryLocalRule" in the entire codebase to check if it's a custom rule
rg "UnnecessaryLocalRule" --type java --type xmlRepository: objectionary/eo Length of output: 6419 🏁 Script executed: # Look for PMD configuration files
fd -e xml -e pom | xargs grep -l "PMD\|pmd\|ruleset" 2>/dev/null | head -10Repository: objectionary/eo Length of output: 82 🏁 Script executed: # Check the main pom.xml for PMD configuration
head -200 eo-maven-plugin/pom.xml | grep -A 20 -B 5 "pmd\|qulice"Repository: objectionary/eo Length of output: 41 🏁 Script executed: # Look for ruleset or PMD configuration files
find . -name "*.xml" | xargs grep -l "UnnecessaryLocalRule\|qulice" | head -5Repository: objectionary/eo Length of output: 166 🏁 Script executed: # Check pom.xml more broadly for PMD plugin configuration
cat eo-maven-plugin/pom.xml | grep -A 30 "qulice\|pmd" | head -80Repository: objectionary/eo Length of output: 936 🏁 Script executed: # Look for PMD ruleset XML files in the project
find . -name "*.xml" -type f | xargs grep -l "ruleset\|rule" 2>/dev/null | grep -E "(pmd|qulice|config)" | head -10Repository: objectionary/eo Length of output: 41 🏁 Script executed: # Check if there's a custom PMD ruleset or configuration file
find . -name "*ruleset*" -o -name "*pmd*config*" 2>/dev/nullRepository: objectionary/eo Length of output: 41 🏁 Script executed: # Let's check the root pom.xml for any PMD or qulice rule configuration
cat pom.xml | grep -A 50 "qulice\|pmd" | head -100Repository: objectionary/eo Length of output: 2048 🏁 Script executed: # Check qulice documentation or look for rule definitions in dependencies
# Let's search for any mention of how UnnecessaryLocalRule is used in context
grep -r "UnnecessaryLocalRule" --include="*.md" --include="*.txt" --include="*.html" 2>/dev/nullRepository: objectionary/eo Length of output: 41 🏁 Script executed: # Let's examine one of the other files that use this annotation to see if it makes sense
sed -n '1,30p' eo-parser/src/main/java/org/eolang/parser/OnDefault.javaRepository: objectionary/eo Length of output: 806 🌐 Web query:
💡 Result: Qulice’s Maven plugin doesn’t expose “use my PMD ruleset / add my PMD rules” configuration. With Qulice you basically have only these PMD-related options:
`@SuppressWarnings`("PMD.UnnecessaryLocalBeforeReturn") // or the rule you need
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.24.3</version>
<configuration>
<excludes>
<exclude>pmd:.*/generated/.*</exclude>
</excludes>
</configuration>
</plugin>About
|
||||||
| @SuppressWarnings("PMD.UnnecessaryLocalRule") | |
| private void lint() throws IOException { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@eo-maven-plugin/src/main/java/org/eolang/maven/MjLint.java` at line 80,
Remove the ineffective suppression annotation
`@SuppressWarnings`("PMD.UnnecessaryLocalRule") from the MjLint class (and
similarly from other files where it was added); locate the annotation near the
lint() method and delete it entirely since the rule name is invalid and the
applicable PMD rule UnnecessaryLocalBeforeReturn cannot apply to a void method
like lint(), so no suppression is needed.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ public void exec() throws IOException { | |
| /** | ||
| * Probe objects. | ||
| */ | ||
| @SuppressWarnings("PMD.UnnecessaryLocalRule") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Test 1: Search for any definition or declaration of UnnecessaryLocalRule in the repo
echo "=== Test 1: Searching for UnnecessaryLocalRule definition ==="
rg -rn "UnnecessaryLocalRule" --type java --type xml -A 2 2>/dev/null || echo "(no results)"
# Test 2: Check for other `@SuppressWarnings` usages with PMD rules
echo -e "\n=== Test 2: Other `@SuppressWarnings` with PMD rules ==="
rg -rn 'SuppressWarnings.*PMD\.Unnecessary' --type java -C 1 2>/dev/null || echo "(no results)"
# Test 3: List all `@SuppressWarnings` in the file to see usage patterns
echo -e "\n=== Test 3: All `@SuppressWarnings` in MjProbe.java ==="
rg -n '@SuppressWarnings' eo-maven-plugin/src/main/java/org/eolang/maven/MjProbe.java 2>/dev/null || echo "(not found)"Repository: objectionary/eo Length of output: 33366 🏁 Script executed: #!/bin/bash
# Test 4: Get the full context of the probe() method to verify locals usage
echo "=== Test 4: probe() method context (lines 55-82) ==="
sed -n '55,82p' eo-maven-plugin/src/main/java/org/eolang/maven/MjProbe.javaRepository: objectionary/eo Length of output: 1260 🏁 Script executed: #!/bin/bash
# Test 5: Check Qulice/Maven configuration files for custom rule definitions
echo "=== Test 5: Qulice configuration and custom rule definitions ==="
find . -name "pom.xml" -o -name "qulice.xml" -o -name "*rule*.xml" 2>/dev/null | head -20
echo -e "\n=== Checking pom.xml for Qulice dependency version ==="
rg -n "qulice-maven-plugin|qulice" pom.xml -A 2 2>/dev/null | head -30Repository: objectionary/eo Length of output: 585 🏁 Script executed: #!/bin/bash
# Additional verification: Check if there's any Qulice/PMD configuration that might define this rule
echo "=== Searching for qulice or PMD rule configuration files ==="
find . -type f \( -name "*.xml" -o -name "*.properties" -o -name "qulice*" \) | xargs grep -l "UnnecessaryLocal" 2>/dev/null || echo "(no match found)"
# Check if there's a checkstyle or PMD config that mentions this rule
echo -e "\n=== Checking for Qulice/PMD config files ==="
find . -type f \( -name "checkstyle*.xml" -o -name "pmd*.xml" -o -name "*qulice*.xml" \) 2>/dev/null | head -10Repository: objectionary/eo Length of output: 182 🏁 Script executed: #!/bin/bash
# Verify the exact annotation by examining the actual file
echo "=== Exact context of line 55 in MjProbe.java ==="
sed -n '54,60p' eo-maven-plugin/src/main/java/org/eolang/maven/MjProbe.javaRepository: objectionary/eo Length of output: 432 Replace or remove the unrecognized PMD rule name The rule Furthermore, the Either correct the rule name to 🤖 Prompt for AI Agents |
||
| private void probe() { | ||
| final Collection<TjForeign> tojos = this.scopedTojos().unprobed(); | ||
| if (tojos.isEmpty()) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
ReentranLock→ReentrantLockThe TODO references the wrong class name; it's missing the second
t.📝 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents