Skip to content

Commit a7a756a

Browse files
committed
Fix #124: If an abstract rule is changed, run all rules (#141)
2 parents 2e66537 + a47f669 commit a7a756a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

History.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
## Enhancements
66

77
## Fixed Issues
8+
* [#124](https://github.com/pmd/pmd-regression-tester/issues/124): With `--auto-gen-config` invalid rule references might be generated
89
* [#139](https://github.com/pmd/pmd-regression-tester/pull/139): chore: CI Improvements
910

10-
## Dependency Updates
11+
## Merge pull requests
12+
* [#141](https://github.com/pmd/pmd-regression-tester/pull/141): Fix #124: If an abstract rule is changed, run all rules - [UncleOwen](https://github.com/UncleOwen) (@UncleOwen)
1113

12-
## External Contributions
14+
## Dependency Updates
1315

1416
# 1.6.0 / 2025-07-25
1517

lib/pmdtester/builders/rule_set_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def check_single_filename?(filename, categories, rules)
146146

147147
# matches Java-based rule implementations
148148
match_data = %r{.+/src/main/java/.+/lang/([^/]+)/rule/([^/]+)/([^/]+)Rule.java}.match(filename)
149-
unless match_data.nil?
149+
unless match_data.nil? || match_data[3].start_with?('Abstract')
150150
logger.debug "Matches: #{match_data.inspect}"
151151
rules.add("#{match_data[1]}/#{match_data[2]}.xml/#{match_data[3]}")
152152
return true

test/test_rule_set_builder.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ def test_build_design_codestyle_config
4646
assert_equal(expected, actual)
4747
end
4848

49+
def test_build_all_rulesets_config_abstract_rule_changed
50+
diff_filenames = <<~DOC
51+
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/AbstractJavaRulechainRule.java
52+
DOC
53+
mock_build?(diff_filenames, nil, "#{PATH_TO_TEST_RESOURCES}/patch-ruleset.xml")
54+
55+
assert(!File.exist?(RuleSetBuilder::PATH_TO_DYNAMIC_CONFIG),
56+
"File #{RuleSetBuilder::PATH_TO_DYNAMIC_CONFIG} must not exist")
57+
end
58+
4959
def test_build_all_rulesets_config
5060
diff_filenames = <<~DOC
5161
pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java

0 commit comments

Comments
 (0)