Skip to content

SONARJAVA-6592 Use ruling-update action for automatic PR creation#5762

Draft
romainbrenguier wants to merge 4 commits into
masterfrom
romain/test-ruling-sync-action
Draft

SONARJAVA-6592 Use ruling-update action for automatic PR creation#5762
romainbrenguier wants to merge 4 commits into
masterfrom
romain/test-ruling-sync-action

Conversation

@romainbrenguier

@romainbrenguier romainbrenguier commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Part of


Summary by Gitar

  • CI/CD workflows:
    • Added ruling-update-notify job to .github/workflows/build.yml to automate ruling synchronization and failure notifications.
  • Ruling configuration:
    • Updated java-S1448.json within its/ruling/src/test/resources/commons-beanutils/.
    • Added java-S1234.json to its/ruling/src/test/resources/test-project/ and removed its/ruling/src/test/resources/commons-beanutils/java-S1488.json.

This will update automatically on new commits.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Test ruling sync action SONARJAVA-6592 Test ruling sync action Jul 9, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

SONARJAVA-6592

Comment thread its/ruling/src/test/resources/commons-beanutils/java-S1448.json Outdated
@gitar-bot

gitar-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Integrates automated ruling diff and notification workflows while optimizing test execution. The malformed JSON in java-S1448.json has been corrected, and no further issues were found.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Ruling Diff Summary

Detected changes in 1 rule files: 12 issues removed, 0 issues added.

S1488 (java) on commons-beanutils - 12 issues removed, 0 issues added - deleted ruling file

Removed src/main/java/org/apache/commons/beanutils2/BeanMap.java (line 766)

       761 |                     if ( ! paramType.isAssignableFrom( value.getClass() ) ) {
       762 |                         value = convertType( paramType, value );
       763 |                     }
       764 |                 }
       765 |             }
>>>    766 |             final Object[] answer = { value };
       767 |             return answer;
       768 |         }
       769 |         catch ( final InvocationTargetException e ) {
       770 |             final IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
       771 |             if (BeanUtils.initCause(iae, e) == false) {

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1265)

      1260 |             throw new NoSuchMethodException("Property '" + name +
      1261 |                     "' has no getter method in class '" + bean.getClass() + "'");
      1262 |         }
      1263 | 
      1264 |         // Call the property getter and return the value
>>>   1265 |         final Object value = invokeMethod(readMethod, bean, EMPTY_OBJECT_ARRAY);
      1266 |         return value;
      1267 | 
      1268 |     }
      1269 | 
      1270 | 

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 528)

       523 |     private Calendar parse(final Class<?> sourceType, final Class<?> targetType, final String value) throws Exception {
       524 |         Exception firstEx = null;
       525 |         for (final String pattern : patterns) {
       526 |             try {
       527 |                 final DateFormat format = getFormat(pattern);
>>>    528 |                 final Calendar calendar = parse(sourceType, targetType, value, format);
       529 |                 return calendar;
       530 |             } catch (final Exception ex) {
       531 |                 if (firstEx == null) {
       532 |                     firstEx = ex;
       533 |                 }

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 570)

       565 |             if (log().isDebugEnabled()) {
       566 |                 log().debug("    " + msg);
       567 |             }
       568 |             throw new ConversionException(msg);
       569 |         }
>>>    570 |         final Calendar calendar = format.getCalendar();
       571 |         return calendar;
       572 |     }
       573 | 
       574 |     /**
       575 |      * Provide a String representation of this date/time converter.

Removed src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTestCase.java (line 986)

       981 |     protected DynaClass createDynaClass() {
       982 | 
       983 |         final int intArray[] = new int[0];
       984 |         final String stringArray[] = new String[0];
       985 | 
>>>    986 |         final DynaClass dynaClass = new BasicDynaClass
       987 |                 ("TestDynaClass", null,
       988 |                         new DynaProperty[]{
       989 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
       990 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
       991 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 181)

       176 |     //
       177 |     // Then, I manually added the "class" key, which is a property that exists for
       178 |     // all beans (and all objects for that matter.
       179 |     @Override
       180 |     public Object[] getSampleKeys() {
>>>    181 |         final Object[] keys = new Object[] {
       182 |             "someIntValue",
       183 |             "someLongValue",
       184 |             "someDoubleValue",
       185 |             "someFloatValue",
       186 |             "someShortValue",

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 208)

       203 |     private final Object objectInFullMap = new Object();
       204 | 
       205 |     // note to self: the sample values were created manually
       206 |     @Override
       207 |     public Object[] getSampleValues() {
>>>    208 |         final Object[] values = new Object[] {
       209 |             new Integer(1234),
       210 |             new Long(1298341928234L),
       211 |             new Double(123423.34),
       212 |             new Float(1213332.12f),
       213 |             new Short((short)134),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 226)

       221 |         return values;
       222 |     }
       223 | 
       224 |     @Override
       225 |     public Object[] getNewSampleValues() {
>>>    226 |         final Object[] values = new Object[] {
       227 |             new Integer(223),
       228 |             new Long(23341928234L),
       229 |             new Double(23423.34),
       230 |             new Float(213332.12f),
       231 |             new Short((short)234),

Removed src/test/java/org/apache/commons/beanutils2/DynaBeanUtilsTestCase.java (line 1237)

      1232 |     protected static DynaClass createDynaClass() {
      1233 | 
      1234 |         final int intArray[] = new int[0];
      1235 |         final String stringArray[] = new String[0];
      1236 | 
>>>   1237 |         final DynaClass dynaClass = new BasicDynaClass
      1238 |                 ("TestDynaClass", null,
      1239 |                         new DynaProperty[]{
      1240 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      1241 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      1242 |                             new DynaProperty("byteProperty", Byte.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/DynaPropertyUtilsTestCase.java (line 2614)

      2609 |     protected DynaClass createDynaClass() {
      2610 | 
      2611 |         final int intArray[] = new int[0];
      2612 |         final String stringArray[] = new String[0];
      2613 | 
>>>   2614 |         final DynaClass dynaClass = new BasicDynaClass
      2615 |                 ("TestDynaClass", null,
      2616 |                         new DynaProperty[]{
      2617 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      2618 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      2619 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java (line 150)

       145 |             }
       146 |         }
       147 |         final String classLocation = newString.toString();
       148 |         //System.out.println("classlocation: " + classLocation);
       149 | 
>>>    150 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       151 |         return theLoader;
       152 |     }
       153 | }

Removed src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java (line 528)

       523 |             }
       524 |         }
       525 |         final String classLocation = newString.toString();
       526 |         //System.out.println("classlocation: " + classLocation);
       527 | 
>>>    528 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       529 |         return theLoader;
       530 |     }
       531 | 
       532 |     /**
       533 |      * Produces a profiler report about where the leaks are.

@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch 2 times, most recently from 08cf3c9 to 87da5e4 Compare July 10, 2026 15:35
@github-actions

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5773

Please review and merge it into your branch.

@github-actions

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5773

Please review and merge it into your branch.

@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch from 6ba94f6 to de666fc Compare July 14, 2026 08:28
@github-actions

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5773

Please review and merge it into your branch.

@romainbrenguier romainbrenguier changed the title SONARJAVA-6592 Test ruling sync action SONARJAVA-6592 Use ruling-update action for automatic PR creation Jul 14, 2026
Integrates the ruling-update-and-notify action to respond to Ruling QA
failures. This job:
- Runs after all ruling-qa matrix jobs complete
- Only runs on pull requests
- Posts ruling diff comments to PRs
- Prepares for future fix PR creation (currently disabled)

The sync-command needs to be implemented to download actual results from
the ruling-qa job artifacts before enabling fix PR creation.

Fix ruling-qa failure detection for matrix jobs

Changed from checking contains(needs.ruling-qa.result, 'failure') to checking
if needs.ruling-qa.result != 'success'. For matrix jobs, the result is only
'success' if ALL matrix jobs succeeded, otherwise it's 'failure'.

Simplify ruling-update-notify workflow integration

Removed complex sync-command - the action now handles artifact download
automatically. The workflow just needs to specify the basic parameters.

This makes integration much cleaner and easier to maintain.

Simplify Ruling QA matrix to single job for testing

Temporarily keep only one matrix item (without-sonarqube-project on
sonar-m-public) to make testing of the ruling-update-notify action
faster and simpler.
Delete workflow that duplicates what's done in build

Fix malformed JSON in ruling file

The file was missing the opening brace '{', causing JSON parse errors.

Fixed format:
- Before: "key": [values]...
- After: {"key": [values]...}
@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch from de666fc to df079a0 Compare July 14, 2026 12:12
@github-actions

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5773

Please review and merge it into your branch.

romainbrenguier and others added 2 commits July 14, 2026 14:31
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Automates ruling synchronization and test notifications via a new CI job and optimizes CI cycles with updated test ignore annotations. The invalid JSON format in java-S1448.json has been resolved.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant