Compare commits

...

377 Commits

Author SHA1 Message Date
Andreas Dangel
4f766035a4
[java] Fix #5263 - UnnecessaryFullyQualifiedName FP with forward references (#5353)
Merge pull request #5353 from oowekyala:issue5263-ufqn-forward-ref
2024-11-22 09:48:25 +01:00
Andreas Dangel
9da17877ac
[doc] Update release notes (#5263, #5353) 2024-11-22 09:47:53 +01:00
Andreas Dangel
3e9e128aa7
[java] UnnecessaryFullyQualifiedName - improve test case 2024-11-22 09:46:35 +01:00
Clément Fournier
918684c154
Fix static methods being whitelisted 2024-11-21 16:51:24 +01:00
Clément Fournier
e63edf358e
[java] Fix #5263 - UnnecessaryFullyQualifiedName FP with forward reference. 2024-11-21 15:26:54 +01:00
Clément Fournier
0d11f151bd
[java] Add more details to parse failures in signatures 2024-11-21 14:55:51 +01:00
Juan Martín Sotuyo Dodero
28b4139cd4
Bump rouge from 4.5.0 to 4.5.1 in the all-gems group across 1 directory (#5348) 2024-11-18 15:44:10 -03:00
Juan Martín Sotuyo Dodero
d61f691559
Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 (#5350) 2024-11-18 15:43:55 -03:00
Clément Fournier
12f7f98803
Fix junit 5 warning
return type of factory method must be a collection
or array or stream
2024-11-18 11:43:51 +01:00
dependabot[bot]
2e4f16d516
Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0
Bumps org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 04:05:13 +00:00
dependabot[bot]
46ef55c9a9
Bump rouge from 4.5.0 to 4.5.1 in the all-gems group across 1 directory
Bumps the all-gems group with 1 update in the / directory: [rouge](https://github.com/rouge-ruby/rouge).


Updates `rouge` from 4.5.0 to 4.5.1
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 03:46:56 +00:00
Andreas Dangel
79c0ce0415
[julia] Ignore generated code in Julia module (#5342)
Merge pull request #5342 from Monits:fix-generated-code-julia
2024-11-17 16:16:51 +01:00
Andreas Dangel
8fdfd369b0
[doc] Update release notes (#5342) 2024-11-17 16:15:55 +01:00
Andreas Dangel
80b8bc47df
[gherkin] Remove generated gherkin code from coverage report (#5336)
Merge pull request #5336 from Monits:fix-generated-code-gherkin
2024-11-17 16:13:13 +01:00
Andreas Dangel
a9b6c946b4
[doc] Update release notes (#5336) 2024-11-17 16:12:46 +01:00
Andreas Dangel
2910ab0403
[kotlin] Prevent auxiliary grammars from generating lexers (#5335)
Merge pull request #5335 from Monits:fix-generated-code-kotlin
2024-11-17 15:58:54 +01:00
Andreas Dangel
5a0220da2e
[doc] Update release notes (#5335) 2024-11-17 15:58:05 +01:00
Andreas Dangel
bc4a49deac
[doc] Update docs/pages/pmd/projectdocs/credits.md [skip ci] 2024-11-17 15:49:32 +01:00
Andreas Dangel
a40c30c8c1
[apex] New Rule: Queueable Should Attach Finalizer (#5303)
Merge pull request #5303 from mitchspano:Require_Finalizer
2024-11-17 15:46:05 +01:00
Andreas Dangel
44c15aae6d
[doc] Update release notes (#5303, #5302) 2024-11-17 15:30:59 +01:00
Andreas Dangel
85aeebbab0
Merge branch 'main' into pr-5303 2024-11-17 15:25:24 +01:00
Andreas Dangel
a5925eb5ea
[doc] Fix typo in release notes 2024-11-17 15:24:49 +01:00
mitchspano
c456396931 Reset credits.md to pmd main HEAD. 2024-11-15 22:14:20 +00:00
mitchspano
1ee0f53608 Update @mitchspano as a contributor 2024-11-15 22:07:44 +00:00
Juan Martín Sotuyo Dodero
e60f460e02 Merge branch 'pr-5340' 2024-11-15 18:40:37 -03:00
Juan Martín Sotuyo Dodero
ee1ab976bc update changelog, refs #5097 2024-11-15 18:39:39 -03:00
Juan Martín Sotuyo Dodero
15cab177d2 Remove added test 2024-11-15 18:30:03 -03:00
Juan Martín Sotuyo Dodero
b6f45ed618 Ensure types don't match 2024-11-15 17:55:07 -03:00
Juan Martín Sotuyo Dodero
1ceae38880
[java] TooFewBranchesForSwitch - allow list of case constants (#5289) 2024-11-15 13:48:50 -06:00
Juan Martín Sotuyo Dodero
f7de8d3e7e Merge branch 'pr-5331' 2024-11-15 16:47:09 -03:00
Juan Martín Sotuyo Dodero
59864a7c6c Merge branch 'pr-5341' 2024-11-15 16:15:19 -03:00
Juan Martín Sotuyo Dodero
a6746fcffa Update changelog, refs #5083 2024-11-15 16:14:53 -03:00
Juan Martín Sotuyo Dodero
aad8e93a2f Add test case ensuring we don't incur in FNs 2024-11-15 16:13:44 -03:00
Juan Martín Sotuyo Dodero
3bb943e0e5 Add deprecated code for backwards compatibility 2024-11-15 16:01:45 -03:00
Juan Martín Sotuyo Dodero
3356dd949d Ignore generated code in Julia module 2024-11-15 15:42:35 -03:00
Clément Fournier
b264fa14e1
Fix #5083 - mref without target type but with exact method
has compile time decl
2024-11-15 16:36:52 +01:00
Clément Fournier
c1aa4e0381
Merge branch 'main' into typeres-problem-with-unchecked-conversion 2024-11-15 16:18:22 +01:00
Clément Fournier
a72ac5845b
Add test for #5113 2024-11-15 16:16:08 +01:00
Juan Martín Sotuyo Dodero
4e1f4be009
Merge branch 'main' into issue-5287 2024-11-15 08:51:52 -06:00
Juan Martín Sotuyo Dodero
c73e5cb8b1
[html] Test for a closing tag when determining node positions (#5328) 2024-11-15 08:50:53 -06:00
Clément Fournier
5931b6601c
[java] Fix #5097 - problem with unchecked conversion 2024-11-15 15:27:55 +01:00
Juan Martín Sotuyo Dodero
9d15c900db Pass linters in generated code 2024-11-15 11:27:07 -03:00
mitchspano
69a24126f7 Fix formatting and static code analysis findings. 2024-11-14 23:29:44 +00:00
Juan Martín Sotuyo Dodero
ef3a4cc15e Remove generated gherkin code from coverage report
- Take the chance to remove / deprecate autogenerated classes that are
   not needed and were not used.
2024-11-14 18:10:59 -03:00
Juan Martín Sotuyo Dodero
4ef8fb21a9
Merge branch 'main' into issue-5322 2024-11-14 14:38:45 -06:00
Juan Martín Sotuyo Dodero
f803aa36dc
[java] InsufficientStringBufferDeclaration: Fix CCE for Character (#5332) 2024-11-14 13:57:49 -06:00
Juan Martín Sotuyo Dodero
0cf8f2c18b Suppress style warnings on generated file 2024-11-14 16:55:55 -03:00
Juan Martín Sotuyo Dodero
178f9541e2 Add since to deprecation notice 2024-11-14 16:51:04 -03:00
Juan Martín Sotuyo Dodero
79026f98c9 Add licence header 2024-11-14 16:49:45 -03:00
Juan Martín Sotuyo Dodero
0e0f347f51 Rename parser before annotating to ensure files are found 2024-11-14 16:47:20 -03:00
Juan Martín Sotuyo Dodero
0d606a7122 Prevent auxiliary grammars from generating lexers
- A misconfiguration of Antlr4 produced an auxiliary gramma
   (UnicodeClasses), that was imported into the main kotlin grammar,
   to produce it's own Lexer, which was never used.
 - We no longer produce that Lexer, properly moving imports to the
   standard directory for that.
 - We manually copy a generated version for API compatibility, flagging
   it as both Generated and Deprecated for removal in PMD 8
2024-11-14 16:39:09 -03:00
Andreas Dangel
d60b234a47
Merge branch 'main' into issue-5314 2024-11-14 19:47:41 +01:00
Andreas Dangel
b050ce353e
[java] Propagate unknown type better when mref is unresolved (#5330)
Merge pull request #5330 from oowekyala:typeres-fix-inference-issue-mref
2024-11-14 19:18:43 +01:00
Andreas Dangel
32f55e22e3
[doc] Update release notes (#5329, #5330) 2024-11-14 19:18:11 +01:00
Andreas Dangel
206ed8bbd3
[apex] Use case-insensitive input stream to avoid choking on Unicode escape sequences (#5284)
Merge pull request #5284 from wahajenius:main
2024-11-14 18:23:26 +01:00
Andreas Dangel
e1d4f27e19
Add @wahajenius as a contributor 2024-11-14 18:18:06 +01:00
Andreas Dangel
093683bc59
[doc] Update release notes (#5284, #5333) 2024-11-14 18:17:49 +01:00
Andreas Dangel
509452577d
[apex] Add test case for #5333 2024-11-14 18:16:06 +01:00
Andreas Dangel
991bc2c41d
[apex] Report LexException when extracting comments 2024-11-14 18:12:13 +01:00
Andreas Dangel
8c58a0b3f5
Merge branch 'main' into pr-5284 2024-11-14 18:01:56 +01:00
Andreas Dangel
01b8ca765b
Add @chenguangqi as a contributor 2024-11-14 17:48:26 +01:00
Andreas Dangel
3fdbf7d6cb
[java] InsufficientStringBufferDeclaration: Fix CCE for Character
Fixes #5314
2024-11-14 17:48:08 +01:00
Andreas Dangel
bb729e02f4
Add @VitaliiIevtushenko as a contributor 2024-11-14 17:39:32 +01:00
Clément Fournier
bf388d7fd0
Propagate unknown type better when mref is unresolved 2024-11-14 17:39:31 +01:00
Andreas Dangel
61eb116833
[java] PreserveStackTrace - consider instance type patterns
Fixes #5318
2024-11-14 17:39:07 +01:00
Andreas Dangel
634a525286
[html] Test for a closing tag when determining node positions
Fixes #5322
2024-11-14 17:07:37 +01:00
Clément Fournier
2df68ed168
Disable type inf logging by default 2024-11-14 16:32:09 +01:00
Clément Fournier
04dfb782f0
Merge branch 'typeres-fix-inference-issue' 2024-11-14 16:14:50 +01:00
Clément Fournier
a79d3e6557
Add unit tests 2024-11-14 16:13:30 +01:00
Andreas Dangel
bb2782241e
[java] Fix inference dependency issue with nested lambdas (#5325)
Merge pull request #5325 from oowekyala:typeres-fix-inference-issue
2024-11-14 15:51:08 +01:00
Andreas Dangel
2340168421
[doc] Update release notes (#5324) 2024-11-14 15:50:35 +01:00
Andreas Dangel
e5a1236981
Update pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml 2024-11-14 15:48:47 +01:00
dependabot[bot]
ed5e862aa3
Bump rouge from 4.4.0 to 4.5.0 in the all-gems group across 1 directory (#5316)
Bumps the all-gems group with 1 update in the / directory: [rouge](https://github.com/rouge-ruby/rouge).


Updates `rouge` from 4.4.0 to 4.5.0
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-14 15:14:44 +01:00
Clément Fournier
529693c916
[java] fix inference dependency issue
Reported in #5324

I improved the verbose logging output a bit so
some of the changes are not directly relevant.
2024-11-13 22:39:34 +01:00
mitchspano
1a9e721fb6 Implements the RuleChain within the QueueableWithoutFinalizerRule.
Implements the [`RuleChain`](https://docs.pmd-code.org/latest/pmd_userdocs_extending_writing_java_rules.html#economic-traversal-the-rulechain) to traverse all classes within the file.
2024-11-12 21:59:02 +00:00
mitchspano
4e4ca6bb70 Incorporate code review feedback.
- Renames the rule to `QueueableWithoutFinalizer` to be more neutral.
- Provides a more robust description.
- Provides a more succinct error message.
- Provides a positive sample for the documentation .
2024-11-12 19:46:58 +00:00
Juan Martín Sotuyo Dodero
3659a2cb7d
Bump org.apache.commons:commons-compress from 1.26.0 to 1.27.1 (#5317) 2024-11-10 22:55:15 -06:00
dependabot[bot]
07de5559bc
Bump org.apache.commons:commons-compress from 1.26.0 to 1.27.1
Bumps org.apache.commons:commons-compress from 1.26.0 to 1.27.1.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-compress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 03:35:46 +00:00
Andreas Dangel
b05b8240a7
Merge branch 'main' into issue-5287 2024-11-07 19:51:00 +01:00
Andreas Dangel
ee7d6fed3e
[java] TooFewBranchesForSwitch - add test case from comment on #5311 2024-11-07 19:50:29 +01:00
Juan Martín Sotuyo Dodero
fe88498ee8
[java] Fix #5293: Parse number of type parameters eagerly (#5309) 2024-11-07 06:19:16 -06:00
Juan Martín Sotuyo Dodero
944e1e8f7a
Bump maven-pmd-plugin from 3.24.0 to 3.26.0 (#5312) 2024-11-07 06:17:30 -06:00
Andreas Dangel
ca208d2241
Bump maven-pmd-plugin from 3.24.0 to 3.26.0 2024-11-07 12:40:18 +01:00
Andreas Dangel
9dcb697f13
Improve DeadlockTest 2024-11-07 12:38:11 +01:00
Andreas Dangel
733ac4bba0
[doc] Update release notes (#5293) 2024-11-04 11:23:49 +01:00
Andreas Dangel
1ee6494429
[java] Fix #5293: Parse number of type parameters eagerly
When creating a LazyClassSignature or LazyMethodType, make sure
to parse the number of type parameters eagerly, so that AstDisambiguationPass
can get this number without triggering additional parsing.
2024-11-04 11:23:49 +01:00
Andreas Dangel
a1996554d8
[java] Add DeadlockTest for verifying #5293
- Improve logging for Parselock

Refs #5293
2024-11-04 11:23:48 +01:00
dependabot[bot]
e15c05721e
Bump webrick from 1.8.2 to 1.9.0 in /docs in the all-gems group across 1 directory (#5308)
Bump webrick in /docs in the all-gems group across 1 directory

Bumps the all-gems group with 1 update in the /docs directory: [webrick](https://github.com/ruby/webrick).


Updates `webrick` from 1.8.2 to 1.9.0
- [Release notes](https://github.com/ruby/webrick/releases)
- [Commits](https://github.com/ruby/webrick/compare/v1.8.2...v1.9.0)

---
updated-dependencies:
- dependency-name: webrick
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 09:23:58 +01:00
Juan Martín Sotuyo Dodero
f0daed5874
Bump org.apache.maven.plugins:maven-clean-plugin from 3.3.2 to 3.4.0 (#5307) 2024-11-03 21:54:00 -06:00
dependabot[bot]
36dfcf8211
Bump org.apache.maven.plugins:maven-clean-plugin from 3.3.2 to 3.4.0
Bumps [org.apache.maven.plugins:maven-clean-plugin](https://github.com/apache/maven-clean-plugin) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/apache/maven-clean-plugin/releases)
- [Commits](https://github.com/apache/maven-clean-plugin/compare/maven-clean-plugin-3.3.2...maven-clean-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-clean-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 03:08:41 +00:00
mitchspano
83d8ca0169 Fix bestPractices.xml formatting and priority definition. 2024-11-01 21:59:13 +00:00
mitchspano
be3c34fe1a Add priority definition. 2024-11-01 21:29:30 +00:00
mitchspano
52fb6c814b Queueable Should Attach Finalizer 2024-11-01 21:17:53 +00:00
mitchspano
93929deef6 Update @mitchspano as a contributor 2024-11-01 17:09:51 +00:00
Andreas Dangel
3ed370f61d
Bump gems and bundler (#5301)
- Bump bundler from 2.5.3 to 2.5.22
- Bump activesupport from 7.2.1 to 7.2.2
- Bump execjs from 2.9.1 to 2.10.0
- Bump faraday from 2.11.0 to 2.12.0
- Bump i18n from 1.14.5 to 1.14.6
- Bump json from 2.7.2 to 2.7.5
- Bump logger from 1.6.0 to 1.6.1
- Bump rexml from 3.3.6/3.3.8 to 3.3.9
- Bump rufus-scheduler from 3.9.2 to 3.9.2

- Fixes https://github.com/pmd/pmd/security/dependabot/69
- Fixes https://github.com/pmd/pmd/security/dependabot/70
2024-10-31 15:07:25 +01:00
Andreas Dangel
5eaefd2841
[doc] Update release notes (#1860) 2024-10-31 15:06:32 +01:00
Andreas Dangel
a709be1dcb
[xml] Have pmd-xml Lexer in line with other antlr grammars (#5296)
Merge pull request #5296 from Monits:align-xml-antlr
2024-10-31 12:27:11 +01:00
Andreas Dangel
c079d8c544
[doc] Update release notes (#5296) 2024-10-31 12:25:59 +01:00
Andreas Dangel
7bfa581511
Merge branch 'main' into pr-5296 2024-10-31 12:17:57 +01:00
Andreas Dangel
6ae7404941
[xml] XMLLexer - Update deprecation notice 2024-10-31 12:17:27 +01:00
Juan Martín Sotuyo Dodero
94095df872 Fix style issues 2024-10-29 17:21:24 -03:00
Juan Martín Sotuyo Dodero
7119424d96 Add license header 2024-10-29 16:56:30 -03:00
Juan Martín Sotuyo Dodero
69a92de52d Have pmd-xml Lexer in line with other antlr grammars
- The package is no longer antlr4, but ast, as is in all other modules
 - We keep a deprecated proxy for backwards compatibility
 - We annotate the generated classes as such to ignore them from
   coverage reports
2024-10-28 22:10:21 -03:00
Juan Martín Sotuyo Dodero
73dbc7a67f
Bump org.apache.maven.plugins:maven-assembly-plugin from 3.6.0 to 3.7.1 (#5290) 2024-10-28 14:06:52 -03:00
dependabot[bot]
c81cd1d520
Bump org.apache.maven.plugins:maven-assembly-plugin from 3.6.0 to 3.7.1
Bumps [org.apache.maven.plugins:maven-assembly-plugin](https://github.com/apache/maven-assembly-plugin) from 3.6.0 to 3.7.1.
- [Release notes](https://github.com/apache/maven-assembly-plugin/releases)
- [Commits](https://github.com/apache/maven-assembly-plugin/compare/maven-assembly-plugin-3.6.0...maven-assembly-plugin-3.7.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-assembly-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 03:31:36 +00:00
Juan Martín Sotuyo Dodero
4473aa6667
[ant] Formatter: avoid reflective access to determine console encoding (#5286) 2024-10-27 15:40:04 -03:00
Juan Martín Sotuyo Dodero
97d68e331c
Bump asm from 9.7 to 9.7.1 (#5288) 2024-10-27 12:38:42 -03:00
Andreas Dangel
16eafc89c2
[java] TooFewBranchesForSwitch - allow list of case constants
Fixes #5287
2024-10-27 16:24:05 +01:00
Andreas Dangel
d68d6c57ef
Bump asm from 9.7 to 9.7.1
This enables support for Java 24
Refs #5154
2024-10-27 15:53:00 +01:00
Andreas Dangel
9c098b2531
Bump pmd from 7.5.0 to 7.7.0 (#5285)
* Bump pmd from 7.5.0 to 7.7.0

* Bump build-tools from 27 to 28-SNAPSHOT

Needed to remove deprecation warnings
about old rule names
2024-10-27 15:20:28 +01:00
Andreas Dangel
3f697aff35
[ant] Formatter: avoid reflective access to determine console encoding
- for java 17+, there is public API to get the console encoding
  -> no problem
- for older java versions, try to use system property
  sun.jnu.encoding if it exists
- only then use the fall-backs with illegal reflective access
  to private fields/methods on java.io.Console
- Also avoid using reflection utils from apache commons, instead
  use reflection directly. The illegal access warnings are then
  properly reported against our class
  net.sourceforge.pmd.ant.Formatter.

Fixes #1860
2024-10-25 18:33:36 +02:00
Andreas Dangel
74ec6f45ee
[doc] Fix release notes for 7.7.0
Old rule name was actually DefaultLabelNotLastInSwitchStmt
2024-10-25 10:35:02 +02:00
Andreas Dangel
c179834288
[release] Prepare next development version [skip ci] 2024-10-25 09:28:54 +02:00
Andreas Dangel
7739f2b840
[release] prepare release pmd_releases/7.7.0 2024-10-25 09:07:54 +02:00
Andreas Dangel
919e73f6b0
Prepare pmd release 7.7.0 2024-10-25 08:47:38 +02:00
Andreas Dangel
e2d59c0e64
Fix #5244: [java] UselessOperationOnImmutable: consider java.time.* types (#5279)
Merge pull request #5279 from adangel:issue-5244
2024-10-24 14:24:16 +02:00
Andreas Dangel
8f2d47dfb7
Fix #5270: [apex] AvoidNonRestrictiveQueries: Fix regex for detecting LIMIT clause (#5273)
Merge pull request #5273 from adangel:issue-5270
2024-10-24 14:22:25 +02:00
Andreas Dangel
e6097d6090
[java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch (#5267)
Merge pull request #5267 from adangel:issue-4286
2024-10-24 14:21:04 +02:00
Andreas Dangel
5e83246469
[doc] Update release notes (#5267) 2024-10-24 14:16:43 +02:00
Andreas Dangel
62c2858f70
Fix #5257: [java] NonCaseLabelInSwitch - support switch expressions (#5256)
Merge pull request #5256 from adangel:rename-nocaselabelswitch
2024-10-24 14:15:06 +02:00
Andreas Dangel
0d8878d58e
[java] Rename rule DefaultLabelNotLastInSwitch (#5255)
Merge pull request #5255 from adangel:rename-defaultlabelswitch
2024-10-24 14:10:16 +02:00
Andreas Dangel
4b23718aac
Fix #4813: [java] SwitchStmtsShouldHaveDefault false positive with pattern matching (#5252)
Merge pull request #5252 from adangel:issue-4813
2024-10-24 14:08:12 +02:00
Andreas Dangel
3a501a0f6b
Fix #5249 and #5250: [java] TooFewBranchesForSwitch ignore pattern matching and support switch expressions (#5251)
Merge pull request #5251 from adangel:issue-5249-5250
2024-10-24 14:06:03 +02:00
Andreas Dangel
36654ed52e
[java] UselessOperationOnImmutable: false positive on void results 2024-10-24 13:08:09 +02:00
Andreas Dangel
45b1217485
[java] TooFewBranchesForSwitch: don't report empty switch
Empty switch statements are already reported
by EmptyControlStatement
2024-10-24 12:51:42 +02:00
Andreas Dangel
662759755d
[java] SwitchStmtsShouldHaveDefault.xml: don't report empty switch
Empty switch statements are already reported
by EmptyControlStatement
2024-10-24 12:47:53 +02:00
Andreas Dangel
d9d6b57f2a
[java] TooFewBranchesForSwitch: report empty switch
This fixes a false negative
2024-10-24 12:38:45 +02:00
Andreas Dangel
6c35c73919
[java] SwitchStmtsShouldHaveDefault: use new PatternLabel attribute 2024-10-24 11:29:40 +02:00
Andreas Dangel
e37f82b62d
Merge branch 'main' into issue-4813 2024-10-24 11:24:17 +02:00
Andreas Dangel
6f5af6e585
[java] TooFewBranchesForSwitch: use new PatternLabel attribute 2024-10-24 11:22:47 +02:00
Andreas Dangel
66d879f707
Merge branch 'main' into issue-5249-5250 2024-10-24 11:20:39 +02:00
Andreas Dangel
93f6279ea7
Fix #3362: [java] ImplicitSwitchFallThrough should consider switch expressions (#5248) 2024-10-24 10:46:59 +02:00
Andreas Dangel
156f293ef3
Fix #5030: [java] SwitchDensity false positive with pattern matching (#5247) 2024-10-24 10:45:56 +02:00
Andreas Dangel
40ed4590be
[java] Improve UnitTestShouldUse{After,Before}Annotation rules to support JUnit5 and TestNG (#5245) 2024-10-24 10:43:48 +02:00
Andreas Dangel
7358289bbe
[cpp] Ignore literals and ignore identifiers capability to C++ CPD (#5040)
Merge pull request #5040 from jdupak:master
2024-10-24 10:18:39 +02:00
Andreas Dangel
a180258033
[doc] Update release notes (#5040) 2024-10-24 10:17:51 +02:00
Andreas Dangel
63675eaa18
[doc] Update release notes (#5279) 2024-10-22 21:03:22 +02:00
Andreas Dangel
49f2c15b83
[doc] Update release notes (#5273) 2024-10-22 21:01:42 +02:00
Andreas Dangel
15520211b5
Merge branch 'main' into issue-5270 2024-10-22 21:01:00 +02:00
Andreas Dangel
c4b8f18a36
[doc] Update release notes (#5252) 2024-10-22 20:58:37 +02:00
Andreas Dangel
c95817a75d
Merge branch 'main' into issue-4813 2024-10-22 20:55:38 +02:00
Andreas Dangel
09b0864eff
Apply suggestions from code review
Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
2024-10-22 20:50:10 +02:00
dependabot[bot]
1517a18956
Bump org.scala-lang:scala-reflect from 2.13.13 to 2.13.15 (#5281)
Bumps [org.scala-lang:scala-reflect](https://github.com/scala/scala) from 2.13.13 to 2.13.15.
- [Release notes](https://github.com/scala/scala/releases)
- [Commits](https://github.com/scala/scala/compare/v2.13.13...v2.13.15)

---
updated-dependencies:
- dependency-name: org.scala-lang:scala-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 20:23:50 +02:00
Willem Hajenius
61b1c372cd [apex] Must use case-insensitive input stream to avoid choking on Unicode escape sequences 2024-10-22 12:27:28 +02:00
Juan Martín Sotuyo Dodero
97fe389dcc
Bump danger from 9.5.0 to 9.5.1 in the all-gems group across 1 directory (#5280) 2024-10-21 11:28:12 -03:00
dependabot[bot]
7df70ea7c1
Bump danger from 9.5.0 to 9.5.1 in the all-gems group across 1 directory
Bumps the all-gems group with 1 update in the / directory: [danger](https://github.com/danger/danger).


Updates `danger` from 9.5.0 to 9.5.1
- [Release notes](https://github.com/danger/danger/releases)
- [Changelog](https://github.com/danger/danger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/danger/danger/compare/v9.5.0...v9.5.1)

---
updated-dependencies:
- dependency-name: danger
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 03:18:38 +00:00
Jakub Dupak
7ad4e0f0fc Add @jdupak as a contributor 2024-10-20 21:57:48 +02:00
Jakub Dupak
c47f5a6062 [cpd] Add ignore literals and identifiers capability to C++ 2024-10-20 21:57:48 +02:00
Andreas Dangel
6d55f6f053
[java] UselessOperationOnImmutable: consider java.time.* types
Fixes #5244
2024-10-18 17:42:44 +02:00
dependabot[bot]
b60b4d8a68
Bump com.google.protobuf:protobuf-java from 3.25.3 to 4.28.2 (#5234)
* Bump com.google.protobuf:protobuf-java from 3.25.3 to 4.28.2

Bumps [com.google.protobuf:protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.25.3 to 4.28.2.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Cleanup comment about protobuf dependency

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andreas Dangel <andreas.dangel@pmd-code.org>
2024-10-18 16:42:52 +02:00
Andreas Dangel
5df7dccfb6
[doc] Update release notes (#5255) 2024-10-18 16:40:27 +02:00
Andreas Dangel
f4941433ce
Merge branch 'main' into rename-defaultlabelswitch 2024-10-18 16:39:12 +02:00
Andreas Dangel
665504decc
[doc] Update release notes (#5251) 2024-10-18 16:30:41 +02:00
Andreas Dangel
ef0db9a166
Merge branch 'main' into issue-5249-5250 2024-10-18 16:30:01 +02:00
Andreas Dangel
fd8fcd67d6
[doc] Update release notes (#5248) 2024-10-18 16:23:17 +02:00
Andreas Dangel
dafdc964a5
Merge branch 'main' into issue-3362 2024-10-18 16:22:17 +02:00
Andreas Dangel
81429a4628
[doc] Update release notes (#5247) 2024-10-18 16:21:02 +02:00
Andreas Dangel
fb94e2493c
Merge branch 'main' into issue-5030 2024-10-18 16:20:11 +02:00
Andreas Dangel
a0d4b38b53
[doc] Update release notes (#5245) 2024-10-18 16:16:54 +02:00
Andreas Dangel
f317e8bee5
Merge branch 'main' into java-unit-test-rules 2024-10-18 16:15:51 +02:00
dependabot[bot]
99f4c9c044
Bump org.checkerframework:checker-qual from 2.11.1 to 3.48.1 (#5276)
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 2.11.1 to 3.48.1.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-2.11.1...checker-framework-3.48.1)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-18 16:04:35 +02:00
Andreas Dangel
656b9052ad
[java] CouplingBetweenObjects: improve violation message (#5278)
Merge pull request #5278 from adangel:coupling-between-objects-message
2024-10-18 15:40:54 +02:00
Andreas Dangel
f0375d61dd
[doc] Update release notes (#5278) 2024-10-18 15:39:52 +02:00
Andreas Dangel
a24c8aa002
[doc] Update release notes 2024-10-18 15:36:28 +02:00
Andreas Dangel
5ffb953191
[java] CouplingBetweenObjects: improve violation message
When we add the actual count to the message,
we can more easily verify that the rule works
as expected.
2024-10-18 10:42:42 +02:00
Juan Martín Sotuyo Dodero
d5faa1c74a
Merge pull request #5275 from adangel/javacc-wrapper-improvement
Use plugin-classpath to simplify javacc-wrapper.xml
2024-10-13 23:54:54 -03:00
Andreas Dangel
867b142ee4
Use plugin-classpath to simplify javacc-wrapper.xml
javacc is on the antrun plugin's classpath.
The javacc jar file doesn't need to be copied
explicitly.
2024-10-13 12:28:16 +02:00
Andreas Dangel
0ea42b94e0
Ignore generated antlr classes in coverage reports (#5258)
Merge pull request #5258 from Monits:ignore-generated-antlr
2024-10-13 12:27:30 +02:00
Andreas Dangel
f834b8744d
[doc] Update release notes (#5258) 2024-10-13 12:26:31 +02:00
Juan Martín Sotuyo Dodero
ab1976382a Remove ant.contrib.jar property 2024-10-12 17:28:18 -03:00
Andreas Dangel
08bcf29190
[java] Fix #5253: Support Boolean wrapper class for BooleanGetMethodName rule (#5269)
Merge pull request #5269 from Aryant-Tripathi:5253/feature/support-boolean-wrapper-in-get-method-rule
2024-10-12 18:04:14 +02:00
Andreas Dangel
85e0695ca6
Add @Aryant-Tripathi as a contributor 2024-10-12 18:02:07 +02:00
Andreas Dangel
47a59b1810
Add @phansys as a contributor 2024-10-12 18:01:45 +02:00
Andreas Dangel
e50234563e
[doc] Update release notes (#5253, #5269) 2024-10-12 18:01:21 +02:00
Aryant Tripathi
9a123bff94 Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:37:01 +05:30
Aryant Tripathi
9077c6a71f Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:34:07 +05:30
Aryant Tripathi
36f713b4c7
Merge branch 'pmd:main' into 5253/feature/support-boolean-wrapper-in-get-method-rule 2024-10-11 22:30:29 +05:30
Aryant Tripathi
ed6312e3ba Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:29:42 +05:30
Andreas Dangel
8ac55e7ad7
Bump org.junit from 5.8.2 to 5.11.2 (#5274)
Also update junit-platform from 1.10.2 to 1.11.2

- Supersedes and closes #5260
- Supersedes and closes #5259
2024-10-11 16:42:42 +02:00
Andreas Dangel
6bd7a9db8e
[java] Fix NPE with empty pattern list (#5264)
Merge pull request #5264 from oowekyala:issue5261-npe-record-empty-components
2024-10-11 12:36:26 +02:00
Andreas Dangel
7655cfc63b
Add @gudzpoz as a contributor 2024-10-11 12:35:45 +02:00
Andreas Dangel
fbde9b967f
[doc] Update release notes (#5261, #5264) 2024-10-11 12:35:19 +02:00
Andreas Dangel
7ae3155325
Add @thesunlover as a contributor 2024-10-11 11:57:39 +02:00
Andreas Dangel
c595fea83f
[apex] AvoidNonRestrictiveQueries: Fix regex for detecting LIMIT clause
Fixes #5270
2024-10-11 11:57:10 +02:00
Aryant Tripathi
8b2af2db8a Support wrapper class in BooleanGetMethodName rule (#5253)
- Updated XPath rule to include both  primitive and  wrapper class:
                  (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])
                - Added test cases to ensure that methods returning  are also flagged correctly.
                - Ensured the rule enforces consistent method naming for both primitive and wrapper types.
2024-10-10 20:44:06 +05:30
Aryant Tripathi
54dfabea9b Support Boolean wrapper class for BooleanGetMethodName rule (#5253) 2024-10-09 10:00:02 +05:30
Andreas Dangel
07840cace2
[java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch
Fixes #4286
2024-10-08 17:33:32 +02:00
Andreas Dangel
ff1b9b2cdd
[java] SwitchStmtsShouldHaveDefault - test for multiple case constants 2024-10-08 17:15:18 +02:00
Clément Fournier
b724b4dd33
Fix DataflowPassTest 2024-10-07 18:18:32 +02:00
Clément Fournier
2c1a7f026e
Fix NPE with empty pattern list 2024-10-07 16:51:50 +02:00
Juan Martín Sotuyo Dodero
f68130eaf9 Annotate Antlr generated classes for PMD languages 2024-10-06 20:07:47 -03:00
Juan Martín Sotuyo Dodero
31018611c6 Add missing lexer properties 2024-10-06 20:07:37 -03:00
Juan Martín Sotuyo Dodero
e3cd599da2 Add @Generated annotations to cpd Antlr languages 2024-10-06 19:58:43 -03:00
Juan Martín Sotuyo Dodero
ca71d76553 Include up-to-date-check to Antlr4 cpd
- Prevent unnecessary re-runs
2024-10-06 19:48:30 -03:00
Juan Martín Sotuyo Dodero
93a019765d Fix incorrect properties 2024-10-06 17:24:42 -03:00
Juan Martín Sotuyo Dodero
00bf6fe2f7 Fix @since for @Generated 2024-10-06 17:21:30 -03:00
Andreas Dangel
377670f267
[doc] Update release notes (#5257) 2024-10-06 18:48:47 +02:00
Andreas Dangel
5ecc29245b
Fix externalInfoUrl after rename 2024-10-05 11:37:45 +02:00
Andreas Dangel
079eb238b9
[java] NonCaseLabelInSwitch - support switch expressions
Rename rule from NonCaseLabelInSwitchStatement

- as it applies to both switch statements and switch expressions
- extend the test cases to cover new java syntax
2024-10-05 11:19:53 +02:00
Andreas Dangel
b3157825d8
[java] Rename rule DefaultLabelNotLastInSwitch
- as it applies to both switch statements and switch expressions
- extend the test cases to cover new java syntax

Note: For patterns in switch, the java compiler already makes sure, that
default is the last case.
2024-10-05 11:00:13 +02:00
Andreas Dangel
6f081e111a
Update pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/TooFewBranchesForSwitch.xml 2024-10-05 10:41:10 +02:00
Andreas Dangel
59403fc9e1
[java] SwitchStmtsShouldHaveDefault - also ignore record pattern 2024-10-05 10:39:55 +02:00
Andreas Dangel
13cc79af62
[java] TooFewBranchesForSwitch - also ignore record pattern 2024-10-05 10:36:39 +02:00
Andreas Dangel
1f31f771ad
[java] SwitchDensity - more tests with (record) patterns 2024-10-05 10:31:40 +02:00
Andreas Dangel
d9db4dbcab
[java] Rename TooFewBranchesForSwitch in quickstart.xml 2024-10-05 10:19:03 +02:00
Andreas Dangel
855e5175d4
[java] Renamed rule TooFewBranchesForSwitch
as it consider Switch Expressions now
additionally to Switch Statements.
2024-10-04 17:48:56 +02:00
Andreas Dangel
b87944a565
[java] TooFewBranchesForSwitch should consider Switch Expressions
Fixes #5250
2024-10-04 17:48:49 +02:00
Andreas Dangel
90f436fd28
[java] TooFewBranchesForSwitch should ignore Pattern Matching
Fixes #5249
2024-10-04 17:47:21 +02:00
Andreas Dangel
375fb72f3c
[java] Fix tree dump test
New SwitchLabel#PatternLabel flag
2024-10-04 17:32:46 +02:00
Andreas Dangel
49deb8d4a0
[java] SwitchDensity false positive with pattern matching
Fixes #5030
2024-10-04 17:12:29 +02:00
Andreas Dangel
312d8e46ae
[java] ImplicitSwitchFallThrough should consider switch expressions
Fixes #3362
2024-10-04 16:45:29 +02:00
Andreas Dangel
e5ff5532d4
Update @emouty as a contributor 2024-10-04 16:05:46 +02:00
Andreas Dangel
0c858b0a7b
[java] SwitchStmtsShouldHaveDefault should ignore patterns
Fixes #4813
2024-10-04 16:05:45 +02:00
Andreas Dangel
a0818d5ab2
[doc] Document renamed/old rule names 2024-10-04 15:54:21 +02:00
Andreas Dangel
5ce4d292fa
[java] Fix #5067: CloseResource: False positive for FileSystems.getDefault() (#5225)
Merge pull request #5225 from lukasgraef:issue5067
2024-10-04 10:06:18 +02:00
Andreas Dangel
d2c42d2426
[doc] Update release notes (#5067, #5225) 2024-10-04 10:05:48 +02:00
Andreas Dangel
c6fd064054
Merge branch 'main' into pr-5225 2024-10-04 10:02:40 +02:00
Andreas Dangel
07cd250a74
Fix release_notes.md 2024-10-04 10:00:53 +02:00
Andreas Dangel
c0023dd942
[java] Rename UnitTestShouldIncludeAssert again
to make it consistent and always use singular "UnitTest"
Follow-up on #4532 and #4965
2024-10-04 09:32:55 +02:00
Andreas Dangel
9fbaa4fbfb
[java] Update quickstart.xml with renamed UnitTest* rules 2024-10-04 09:25:21 +02:00
Juan Martín Sotuyo Dodero
7d4961f303
Update README.md
Point coveralls to main branch
2024-10-03 17:47:01 -03:00
Andreas Dangel
9337e5a7a2
[java] UnitTestShouldUseAfterAnnotation: Consider JUnit 5 and TestNG 2024-10-03 20:55:11 +02:00
Andreas Dangel
33c737718c
[java] UnitTestShouldUseBeforeAnnotation: Consider JUnit 5 and TestNG 2024-10-03 20:55:10 +02:00
Andreas Dangel
b7c4a5e492
Ignore javacc code in coverage report (#5241)
Merge pull request #5241 from Monits:ignore-javacc-code
2024-10-03 20:30:41 +02:00
Andreas Dangel
d77a63da95
[doc] Update release notes (#5241) 2024-10-03 20:29:53 +02:00
Andreas Dangel
463ca964dc
[java] Rename JUnit rules with overly restrictive names (#4965)
Merge pull request #4965 from Monits:issue-4532
2024-10-03 20:07:50 +02:00
Andreas Dangel
57497738c1
[doc] Update release notes (#4532, #4965) 2024-10-03 20:06:21 +02:00
Andreas Dangel
525435bd68
[java] Keep bestpractices.xml sorted alphabetically 2024-10-03 19:59:29 +02:00
Andreas Dangel
c5246eca46
Renamed JUnit4TestShouldUseAfterAnnotation
- call it UnitTest... to be agnostic to the testing framework
2024-10-03 19:52:56 +02:00
Andreas Dangel
4796da0fb2
Renamed JUnit4TestShouldUseBeforeAnnotation
- call it UnitTest... to be agnostic to the testing framework
2024-10-03 19:51:13 +02:00
lukasgraef
7dcab3f189 Fix static analysis findings 2024-09-30 20:48:20 +02:00
lukasgraef
39b8bdf171 Review Finding: Check for type java.nio.FileSystems 2024-09-30 20:13:01 +02:00
Andreas Dangel
5fe19b2096
[release] Prepare next development version [skip ci] 2024-09-27 11:43:22 +02:00
Andreas Dangel
d8d4d3d061
[release] prepare release pmd_releases/7.6.0 2024-09-27 11:08:53 +02:00
Andreas Dangel
6d48907259
Prepare pmd release 7.6.0 2024-09-27 10:49:57 +02:00
Andreas Dangel
5261a6d60e
[doc] Update contributors
- Add @kratoon as a contributor
- Add @mattr9124 as a contributor
2024-09-27 09:35:58 +02:00
Andreas Dangel
ac8c873168
[apex] Support convertCurrency() in SOQL/SOSL (#5237)
Merge pull request #5237 from adangel:issue-5228-apex-convertCurrency
2024-09-27 09:03:32 +02:00
Andreas Dangel
c2445c7bb5
[doc] Documentation update for --show-suppressed flag (#5230)
Merge pull request #5230 from dschach:master
2024-09-27 09:02:35 +02:00
David Schach
03fba2443a
[doc] Update @dschach as a contributor 2024-09-27 08:58:36 +02:00
David Schach
6f518c8304
[doc] Improve doc for --show-suppressed
- it's only supported for specific formats
- currently: xml, html, summaryhtml

Fixes #5229
2024-09-27 08:58:36 +02:00
Andreas Dangel
c84ffb8e0b
[apex] Bump apex-parser from 4.2.0 to 4.3.0 2024-09-26 18:50:00 +02:00
Andreas Dangel
74f9d75897
[apex] Support convertCurrency() in SOQL/SOSL
Fixes #5228
2024-09-26 18:49:24 +02:00
Andreas Dangel
a2b5ae64a7
Bump build-tools from 27-SNAPSHOT to 27 2024-09-26 17:01:00 +02:00
dependabot[bot]
242b45a180
Bump webrick from 1.8.1 to 1.8.2 in /docs (#5233)
Bumps [webrick](https://github.com/ruby/webrick) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/ruby/webrick/releases)
- [Commits](https://github.com/ruby/webrick/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: webrick
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 16:36:16 +02:00
dependabot[bot]
083e296c1e
Bump com.google.protobuf:protobuf-java from 3.25.3 to 3.25.5 (#5232)
Bumps [com.google.protobuf:protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.25.3 to 3.25.5.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.25.3...v3.25.5)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 16:36:02 +02:00
Andreas Dangel
e4107ccaaa
[doc] README: Fix PMD logo 2024-09-26 16:26:26 +02:00
Andreas Dangel
028444453d
Change branch master to main (#5211)
Merge pull request #5211 from adangel:switch-to-main-branch
2024-09-26 15:54:55 +02:00
Andreas Dangel
29ed91795b
[doc] README: Fix build status badge 2024-09-26 15:54:08 +02:00
Andreas Dangel
4930e98706
[java] Fix #5046 - FPs in LocalVariableCouldBeFinal (#5191)
Merge pull request #5191 from oowekyala:issue5046-localVariableCouldBeFinal-fp-catch
2024-09-26 15:21:51 +02:00
Andreas Dangel
7b5ef10093
[doc] Update release notes (#5046, #5191) 2024-09-26 15:20:28 +02:00
dependabot[bot]
1acaedc158
Bump com.google.code.gson:gson from 2.10.1 to 2.11.0 (#5227)
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.10.1...gson-parent-2.11.0)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 12:10:04 +02:00
dependabot[bot]
b03a46fa8c
Bump rouge from 4.3.0 to 4.4.0 in the all-gems group across 1 directory (#5226)
Bumps the all-gems group with 1 update in the / directory: [rouge](https://github.com/rouge-ruby/rouge).


Updates `rouge` from 4.3.0 to 4.4.0
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-26 12:08:39 +02:00
Andreas Dangel
ae080786bd
[java] Fix #5068: Class incorrectly identified as non-instantiatable (#5224)
Merge pull request #5224 from lukasgraef:issue5068
2024-09-22 14:53:33 +02:00
Andreas Dangel
687f7f89e4
[doc] Update release notes (#5068, #5224) 2024-09-22 14:53:00 +02:00
Andreas Dangel
cd50d392d1
Add @SaschaRiemer as a contributor 2024-09-22 14:51:26 +02:00
Andreas Dangel
2bdeadb094
Add @lukasgraef as a contributor 2024-09-22 14:51:07 +02:00
lukasgraef
ddb1eb8dd8 [java] Fix #5067: CloseResource: False positive for FileSystems.getDefault() 2024-09-21 16:03:36 +02:00
lukasgraef
8ea3f32f5f [java] Fix #5068: Class incorrectly identified as non-instantiatable 2024-09-21 14:12:12 +02:00
Juan Martín Sotuyo Dodero
2c48dc0644
Merge pull request #5223 from adangel/issue-5222-overridden-property-values
[core] Fix RuleReference / RuleSetWriter handling of properties
2024-09-20 11:45:24 -03:00
Andreas Dangel
df1a6797c6
[core] RuleSetWriter - write property value as attribute 2024-09-20 16:10:51 +02:00
Andreas Dangel
802decbbcf
[core] Fix RuleReference / RuleSetWriter handling of properties
RuleReference#getOverriddenPropertyDescriptors should behave
consistent to #getOverriddenPropertiesByPropertyDescriptor.
RuleSetWriter needs to make sure to
export only the values for properties
of rule references.

Fixes #5222
2024-09-20 15:14:06 +02:00
Andreas Dangel
9490dc0043
Add @imax-erik as a contributor 2024-09-19 17:27:19 +02:00
Andreas Dangel
909e86ca99
[apex] Verify nested subqueries work (#5218)
Fixes #5218
2024-09-19 17:27:13 +02:00
Andreas Dangel
36c1738135
[core] Sarif format: refer to schemastore.org (#5202)
Merge pull request #5202 from dschach:master
2024-09-19 17:19:53 +02:00
Andreas Dangel
d2d9ddff4a
[doc] Update release notes (#5201, #5202) 2024-09-19 16:47:12 +02:00
Andreas Dangel
ac2e476e4c
[doc] Update Sarif Json Schema location 2024-09-19 16:47:12 +02:00
Andreas Dangel
6e65c2b3ab
Update @dschach as a contributor 2024-09-19 16:47:12 +02:00
David Schach
dd6e64a94d
fix(sarif): refer to existent $schema location 2024-09-19 16:46:08 +02:00
Andreas Dangel
dff06c9b4d
Update release notes 2024-09-19 11:22:43 +02:00
Juan Martín Sotuyo Dodero
cae71e7a5e Be consistent in how we replace tokens 2024-09-17 17:09:29 -03:00
Juan Martín Sotuyo Dodero
029130a478 Use a custom annotation to ignore javacc generated code 2024-09-17 17:00:42 -03:00
Juan Martín Sotuyo Dodero
e18336a581
Merge pull request #5216 from pmd/dependabot/maven/com.github.siom79.japicmp-japicmp-maven-plugin-0.23.0
Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.20.0 to 0.23.0
2024-09-17 15:40:31 -03:00
dependabot[bot]
4ab926209e
Bump com.github.siom79.japicmp:japicmp-maven-plugin
Bumps [com.github.siom79.japicmp:japicmp-maven-plugin](https://github.com/siom79/japicmp) from 0.20.0 to 0.23.0.
- [Release notes](https://github.com/siom79/japicmp/releases)
- [Changelog](https://github.com/siom79/japicmp/blob/master/release.py)
- [Commits](https://github.com/siom79/japicmp/compare/japicmp-base-0.20.0...japicmp-base-0.23.0)

---
updated-dependencies:
- dependency-name: com.github.siom79.japicmp:japicmp-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:56:04 +00:00
Juan Martín Sotuyo Dodero
5f42a45bbe
Merge pull request #5212 from Monits/issue-5207
[java] Adjust signature matching in CheckSkipResultRule
2024-09-14 14:31:26 -03:00
Juan Martín Sotuyo Dodero
0253b9d3cd Ignore generated-sources in coverage reports
- We don't test it directly, nor is it our job
 - A bad grammar won't be processed, or fail in subtle ways only
   detectable in specific tests on the AST (which is included)
2024-09-14 01:33:20 -03:00
Juan Martín Sotuyo Dodero
8a9aec831d Update changelog, refs #5207 2024-09-14 00:35:38 -03:00
Juan Martín Sotuyo Dodero
59c88e9bb0 Adjust skip signature to fix #5207 2024-09-14 00:34:23 -03:00
Juan Martín Sotuyo Dodero
31efceae4d Add failing test case for #5207 2024-09-14 00:34:10 -03:00
Andreas Dangel
0889e3d9dc
Fix release notes 2024-09-13 10:37:51 +02:00
Andreas Dangel
47f204cb19
Fix unit test 2024-09-13 10:37:37 +02:00
Andreas Dangel
91f17838d4
Change branch master to main
- Update documentation
- Update release scripts
- Update rule doc generation

GitHub Action is only triggered from "main" branch now.
2024-09-13 09:59:51 +02:00
Juan Martín Sotuyo Dodero
77b763e321
Merge pull request #5210 from adangel/issue-5059-core-xml-cdata
[core] Fix PMD's XMLRenderer to escape CDATA
2024-09-12 09:42:57 -03:00
Andreas Dangel
469b2a67ae
[doc] Added Codety to "Tools / Integrations" (#5208)
Merge pull request #5208 from random1223:patch-1
2024-09-12 10:31:13 +02:00
Andreas Dangel
b410199992
[doc] Update release notes (#5208) 2024-09-12 10:30:04 +02:00
Andreas Dangel
537148c90a
[doc] Reformatting tools.md and ci.md 2024-09-12 10:29:51 +02:00
Andreas Dangel
341e089a47
Add @random1223 as a contributor 2024-09-12 10:19:14 +02:00
Andreas Dangel
6d1fb3e4cd
[core] Fix PMD's XMLRenderer to escape CDATA
Processing errors might contain inside their details
message a CDATA section. This is output itself as
a CDATA section, but XMLStreamWriter#writeCData doesn't
escape it automatically - it just outputs the string
as is. This results in invalid XML.

Fixes #5059
2024-09-12 09:44:54 +02:00
Tony
aae54f4b33
Added Codety into the tool list.
Added Codety into the tool list, Codety Scanner uses PMD as Java code analyzer. 
Demo: 
GitHub issue review example: https://github.com/codetyio/codety-scanner/actions/runs/10786005219/job/29912188828
GitHub Pull Request automation example: https://github.com/codetyio/codety-scanner/pull/15#issuecomment-2320351633
2024-09-11 21:38:45 -07:00
Juan Martín Sotuyo Dodero
48c2e325dc Remove NBSP 2024-09-11 19:01:33 -03:00
dependabot[bot]
efa875727d
Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.3 (#5199)
Bumps [org.apache.maven.plugins:maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.1.1 to 3.1.3.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.1.1...maven-deploy-plugin-3.1.3)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-deploy-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 20:39:54 +02:00
Andreas Dangel
04b3361dec
[java] Fix #5190 - NPE in type inference caused by null type (#5192)
Merge pull request #5192 from oowekyala:issue5190-npe-infer
2024-09-09 20:38:36 +02:00
Andreas Dangel
e6346ab6b9
Add @vedantchokshi as a contributor 2024-09-09 20:38:19 +02:00
Andreas Dangel
402eed5073
[doc] Update release notes (#5190, #5192) 2024-09-09 20:12:12 +02:00
Juan Martín Sotuyo Dodero
6fddf06b49
Merge pull request #5195 from adangel/apex/trigger-fixes-5138
[apex] Fix various FNs when using triggers
2024-09-06 18:08:48 -03:00
Andreas Dangel
2cfbac30b1
[doc] Update release notes (#5138) 2024-09-06 20:09:53 +02:00
Andreas Dangel
5f1b13cadd
[apex] Verify StdCyclomaticComplexity with triggers 2024-09-06 19:51:52 +02:00
Andreas Dangel
1038eaa283
[apex] Verify EmptyIfStmt and EmptyStatementBlock with triggers 2024-09-06 19:43:07 +02:00
Andreas Dangel
fe0d05d8d5
[apex] Fix parsing of method decl. inside triggers 2024-09-06 18:42:52 +02:00
Andreas Dangel
97fe106724
[apex] Verify OperationWithLimitsInLoop for triggers 2024-09-06 18:42:22 +02:00
Andreas Dangel
9810bfc3cc
[apex] Verify CognitiveComplexity for triggers 2024-09-06 18:42:03 +02:00
Andreas Dangel
6b0a2a1ffa
[apex] Fix ApexCRUDViolation for triggers 2024-09-06 18:41:25 +02:00
Andreas Dangel
92bab6a38f
[apex] Fix AvoidDeeplyNestedIfStmts for triggers 2024-09-06 18:40:43 +02:00
Clément Fournier
9ecc8897be
Fix #5190 - NPE caused by null type 2024-09-04 13:39:41 +02:00
Clément Fournier
68820a4c77
Fix #5046 - FPs in LocalVariableCouldBeFinal
This adds FNs to UnusedAssignment
2024-09-03 11:35:33 +02:00
Clément Fournier
9d925b513d
Add test case for #5190 2024-09-03 11:16:56 +02:00
Juan Martín Sotuyo Dodero
7ba88e9eba
Merge pull request #5188 from adangel/bump-apex-parser
[apex] Use new apex-parser 4.2.0
2024-09-02 15:41:51 -03:00
Andreas Dangel
07ae01b4ea
[apex] Use new apex-parser 4.2.0
Verify that #5163 and #5182 are fixed.
2024-09-02 19:42:20 +02:00
Juan Martín Sotuyo Dodero
c46fe6e6aa
Merge pull request #5187 from pmd/dependabot/maven/org.apache.maven.plugins-maven-install-plugin-3.1.3
Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3
2024-09-02 11:27:06 -03:00
dependabot[bot]
eee22e0c17
Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3
Bumps [org.apache.maven.plugins:maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.1.1 to 3.1.3.
- [Release notes](https://github.com/apache/maven-install-plugin/releases)
- [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-3.1.1...maven-install-plugin-3.1.3)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-install-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-02 03:08:01 +00:00
Juan Martín Sotuyo Dodero
aa9a38de0e
Merge pull request #5186 from oowekyala/implicit-class-cleanup
[java] Cleanup things about implicit classes
2024-09-01 17:49:57 -03:00
Clément Fournier
fe341cf400
Cleanup things with implicit classes 2024-09-01 21:35:50 +02:00
Andreas Dangel
73d3c59205
Bump checkstyle from 10.14.0 to 10.18.1 (#5185)
Merge pull request #5185 from adangel/bump-checkstyle-10.18.1
2024-08-30 18:31:42 +02:00
Andreas Dangel
88596a2f5a
Bump build-tools from 26 to 27-SNAPSHOT 2024-08-30 17:42:08 +02:00
Andreas Dangel
025356dadc
Bump checkstyle from 10.14.0 to 10.18.1
Also bump maven-checkstyle-plugin from 3.4.0 to 3.5.0
2024-08-30 17:13:21 +02:00
Andreas Dangel
52c66e4dad
Use PMD 7.5.0 for checks 2024-08-30 11:21:01 +02:00
Andreas Dangel
2ed25964b8
[release] Prepare next development version [skip ci] 2024-08-30 10:52:17 +02:00
Andreas Dangel
74ada426af
[release] prepare release pmd_releases/7.5.0 2024-08-30 10:31:09 +02:00
Andreas Dangel
453f6690b0
Prepare pmd release 7.5.0 2024-08-30 10:10:53 +02:00
Andreas Dangel
bff14449b2
[doc] Update pmd_sidebar.yml 2024-08-29 18:08:08 +02:00
Andreas Dangel
8b44d2f374
[javascript] New rule AvoidConsoleStatements (#5126)
Merge pull request #5126 from adangel:js-rule-avoidconsolestatements
2024-08-29 17:42:24 +02:00
Andreas Dangel
537dab95e4
[java] Support Java 23 (#5112)
Merge pull request #5112 from issue-5062-support-java-23
2024-08-29 17:39:04 +02:00
Andreas Dangel
819b6bc5fb
[java] Fix #5084 - crash in LUB with raw types (#5179)
Merge pull request #5179 from oowekyala:issue5084-lub-crash
2024-08-29 17:32:49 +02:00
Andreas Dangel
ada303de83
[doc] Document new java language prop xStrictTypeRes 2024-08-29 17:30:45 +02:00
Andreas Dangel
a44a5ca4ef
[doc] Update release notes (#5048) 2024-08-29 16:58:57 +02:00
Andreas Dangel
c6ef54326c
Add @AB-xdev as a contributor 2024-08-29 16:58:42 +02:00
Andreas Dangel
488807ff90
[java] Add testcase for #5048 2024-08-29 16:58:16 +02:00
Andreas Dangel
20b667d7e4
Merge branch 'master' into pr-5179 2024-08-29 16:55:38 +02:00
Andreas Dangel
773f792dd6
[java] Fix #5162 SingularField FP with synchronized block (#5178)
Merge pull request #5178 from oowekyala:issue5162-singularfield-synchronized
2024-08-29 13:05:50 +02:00
Andreas Dangel
d7f564782a
[doc] Update release notes (#5162, #5178) 2024-08-29 13:04:41 +02:00
Andreas Dangel
610f937bc4
[java] Update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock, new rule AvoidSynchronizedStatement (#5175)
Merge pull request #5175 from chonton:ReentrantLock
2024-08-29 12:50:13 +02:00
Andreas Dangel
3c3be3c81d
[doc] Update release notes (#5175) 2024-08-29 12:48:14 +02:00
Andreas Dangel
a4cac6b74f
Update @chonton as a contributor 2024-08-29 12:46:30 +02:00
Andreas Dangel
93db59bea5
Apply suggestions from code review 2024-08-29 12:41:02 +02:00
Clément Fournier
672fd635c9
Improve error handling of semantic exceptions 2024-08-28 13:23:43 +02:00
Andreas Dangel
93bfe7df0f
Merge branch 'master' into issue-5062-support-java-23 2024-08-27 20:09:09 +02:00
Andreas Dangel
d7d8c9cb29
[java] Rename ASTImportDeclaration#isModuleImport 2024-08-27 19:58:07 +02:00
Clément Fournier
9c0c7f28e2
Throw typeres failures instead of catching them
They will be surfaced as processing errors
2024-08-26 13:21:41 +02:00
Clément Fournier
e597e21eda
Update pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SemanticErrorReporter.java 2024-08-25 22:07:43 +02:00
Clément Fournier
60e0109bbb
Update pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/LubTest.kt 2024-08-25 19:48:40 +02:00
Clément Fournier
d7a15d1854
Report typeres errors more transparently 2024-08-25 19:46:01 +02:00
Clément Fournier
08b68d7dd0
Fix #5084 - crash in LUB with raw types 2024-08-25 19:28:16 +02:00
Clément Fournier
d6736903f0
Fix #5162 SingularField FP with synchronized block 2024-08-25 00:46:45 +02:00
Charles Honton
8a39917fa2 added unit test 2024-08-22 13:54:17 -07:00
Charles Honton
3dd47a3b94 update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock
see https://openjdk.org/jeps/8337395
2024-08-22 08:20:06 -07:00
Andreas Dangel
b51be09795
[core] Cache moduleName to URLs in ClasspathClassLoader 2024-08-13 11:46:31 +01:00
Andreas Dangel
13b8556bf6
Fixup from review (#5112)
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
2024-08-13 11:22:43 +01:00
Andreas Dangel
21d499d5ef
[doc] Release Notes for Java 23 Support (#5062)
Also add some @since tags to new API methods
2024-08-01 11:53:04 +02:00
Andreas Dangel
17a4a487a6
[java] CommentRequired - add test for markdown comments 2024-08-01 11:53:04 +02:00
Andreas Dangel
c53462b3b6
Improve RuleTst performance
Reuse the classloader for auxclasspath
instead of creating a new one for every
single rule test case.
2024-08-01 11:46:45 +02:00
Andreas Dangel
d171bcbdb3
[java] Default Imports for simple compilation unit
Import by default module java.base
and java.io.IO.*
2024-08-01 11:46:45 +02:00
Andreas Dangel
cbc475ede3
[java] Add ImplicitClassDeclaration
JEP 477: Implicitly Declared Classes and Instance Main Methods
(Third Preview)
2024-08-01 11:46:41 +02:00
Andreas Dangel
55d57acc63
[java] Remove String Template Preview feature for Java 23 2024-08-01 11:44:46 +02:00
Andreas Dangel
0823c88cba
[java] Support primitive types in instanceof (Java 23 Preview)
Allow to use primitive types in patterns, instanceof, and
switch. This is a Java 23 Preview feature.
See JEP 455.
2024-08-01 11:44:45 +02:00
Andreas Dangel
47470b5d0c
[java] Support module import declarations (JEP 476)
- new JModuleSymbol
- UnnecessaryImportRule also supports module imports
- module-info.class can be loaded by ClasspathClassLoader
- Support annotations on modules
- Verify that exported packages are loaded
2024-08-01 11:44:37 +02:00
Andreas Dangel
176e522721
[java] UnnecessaryImportRule: Support Markdown comments 2024-08-01 10:28:31 +02:00
Andreas Dangel
7a6662fcda
[java] Support "Markdown documentation comments" (JEP 467) 2024-08-01 10:28:31 +02:00
Andreas Dangel
bb40b754a2
[java] Update impl for "Flexible Constructor Bodies" 2024-08-01 10:28:30 +02:00
Andreas Dangel
20750f9591
[java] Update implementation for "Implicitly Declared Classes...
... and Instance Main Methods" (JEP 477)

 - language feature is renamed
 - update symbol table resolver
2024-08-01 10:28:30 +02:00
Andreas Dangel
a7eab294b4
[java] Make UNNAMED_VARIABLES_AND_PATTERNS a regular language feature
This is now possible, since java 21 preview is gone.
2024-08-01 10:28:30 +02:00
Andreas Dangel
10681cd6a8
[java] Remove version 21-preview 2024-08-01 10:28:29 +02:00
Andreas Dangel
f13e886757
[java] Allow to build PMD with Java 23 2024-08-01 10:28:29 +02:00
Andreas Dangel
2a04d9858a
[java] Bump asm from 9.6 to 9.7 2024-08-01 10:15:09 +02:00
Andreas Dangel
568314bb89
[java] Add new language version 23 and 23-preview 2024-08-01 10:15:09 +02:00
Juan Martín Sotuyo Dodero
f7b5398a04
Update pmd-javascript/src/main/resources/category/ecmascript/performance.xml
Co-authored-by: Andreas Dangel <andreas.dangel@adangel.org>
2024-07-26 08:08:12 -03:00
Andreas Dangel
dbe5624a9e
[javascript] Simplify AvoidConsoleStatements
Now any usage of console is flagged.
2024-07-26 11:55:02 +02:00
Andreas Dangel
8b1da5d651
Add @dschach as a contributor 2024-07-26 11:53:27 +02:00
Andreas Dangel
838705c8da
[javascript] New rule AvoidConsoleStatements
Fixes #5105
2024-07-26 11:51:44 +02:00
Juan Martín Sotuyo Dodero
f24635b55c
Merge branch 'master' into issue-4532 2024-04-28 05:15:50 +02:00
Juan Martín Sotuyo Dodero
5b42381061 Reintroduce old class names
- Don't break API compatibility, and set everything for removal in PMD 8
2024-04-27 22:11:39 -03:00
Juan Martín Sotuyo Dodero
61a7459247 Update changelog 2024-04-17 17:00:05 -03:00
Juan Martín Sotuyo Dodero
bd89f9185b Typo 2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
7725897373 Rename JUnit4TestShouldUseTestAnnotation
- The rule is now called UnitTestShouldUseTestAnnotation as it applies
   to both JUnit and TestNG.
 - The doc is further improved to reflect this.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
9f1ab89d31 Rename JUnitTestsShouldIncludeAssertRule
- It's now called UnitTestsShouldIncludeAssertRule as it applies to
   JUnit and TestNG
 - The doc is updated to reflect this
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
ffec30f392 Rename JUnitTestContainsTooManyAssertsRule
- The rule is now called UnitTestContainsTooManyAssertsRule as it
   checks for JUnit and TestNG.
 - This is further cleared up in the documentation.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
5301a8e852 Rename JUnitAssertionsShouldIncludeMessageRule
- The rule is now called UnitTestAssertionsShouldIncludeMessageRule as
   it applies to JUnit and TestNG.
 - The doc is updated to reflect this.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
691731cdd4 Rename JUnit4TestShouldUseAfterAnnotation
- Call it JUnitTestShouldUseAfterAnnotation instead as it not only
   applies to JUnit4
 - Improve the doc to further clarify it's usages
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero
55686dbef4 Rename JUnit4TestShouldUseBeforeAnnotation
- Call it JUnitTestShouldUseBeforeAnnotation as it applies to JUnit 4
   and 5.
 - Improve the doc to clarify it's intended use.
2024-04-17 16:42:37 -03:00
431 changed files with 16619 additions and 4376 deletions

View File

@ -1929,7 +1929,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/1444125?v=4",
"profile": "http://www.linkedin.com/in/chonton",
"contributions": [
"bug"
"bug",
"code"
]
},
{
@ -7452,7 +7453,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/16755668?v=4",
"profile": "https://github.com/emouty",
"contributions": [
"code"
"code",
"bug"
]
},
{
@ -7515,6 +7517,7 @@
"avatar_url": "https://avatars.githubusercontent.com/u/18402464?v=4",
"profile": "https://github.com/mitchspano",
"contributions": [
"code",
"bug"
]
},
@ -7735,6 +7738,161 @@
"contributions": [
"bug"
]
},
{
"login": "AB-xdev",
"name": "Alex B",
"avatar_url": "https://avatars.githubusercontent.com/u/45384811?v=4",
"profile": "https://xdev.software/",
"contributions": [
"bug"
]
},
{
"login": "dschach",
"name": "David Schach",
"avatar_url": "https://avatars.githubusercontent.com/u/636977?v=4",
"profile": "https://github.com/dschach",
"contributions": [
"bug",
"code",
"doc"
]
},
{
"login": "vedantchokshi",
"name": "Vedant Chokshi",
"avatar_url": "https://avatars.githubusercontent.com/u/22137048?v=4",
"profile": "https://github.com/vedantchokshi",
"contributions": [
"bug"
]
},
{
"login": "random1223",
"name": "Tony",
"avatar_url": "https://avatars.githubusercontent.com/u/3987237?v=4",
"profile": "https://codety.io/",
"contributions": [
"doc"
]
},
{
"login": "imax-erik",
"name": "imax-erik",
"avatar_url": "https://avatars.githubusercontent.com/u/62863607?v=4",
"profile": "https://github.com/imax-erik",
"contributions": [
"bug"
]
},
{
"login": "lukasgraef",
"name": "Lukas Gräf",
"avatar_url": "https://avatars.githubusercontent.com/u/48957581?v=4",
"profile": "https://github.com/lukasgraef",
"contributions": [
"code"
]
},
{
"login": "SaschaRiemer",
"name": "Sascha Riemer",
"avatar_url": "https://avatars.githubusercontent.com/u/108794941?v=4",
"profile": "https://github.com/SaschaRiemer",
"contributions": [
"bug"
]
},
{
"login": "kratoon",
"name": "Ondrej Kratochvil",
"avatar_url": "https://avatars.githubusercontent.com/u/26163421?v=4",
"profile": "https://github.com/kratoon",
"contributions": [
"bug"
]
},
{
"login": "mattr9124",
"name": "Matthew Rossner",
"avatar_url": "https://avatars.githubusercontent.com/u/8940608?v=4",
"profile": "https://github.com/mattr9124",
"contributions": [
"bug"
]
},
{
"login": "thesunlover",
"name": "Iskren Stanislavov",
"avatar_url": "https://avatars.githubusercontent.com/u/6734600?v=4",
"profile": "https://interop.io/",
"contributions": [
"bug"
]
},
{
"login": "gudzpoz",
"name": "gudzpoz",
"avatar_url": "https://avatars.githubusercontent.com/u/14026120?v=4",
"profile": "https://kyo.iroiro.party/",
"contributions": [
"bug"
]
},
{
"login": "phansys",
"name": "Javier Spagnoletti",
"avatar_url": "https://avatars.githubusercontent.com/u/1231441?v=4",
"profile": "https://github.com/phansys",
"contributions": [
"bug"
]
},
{
"login": "Aryant-Tripathi",
"name": "Aryant Tripathi",
"avatar_url": "https://avatars.githubusercontent.com/u/60316716?v=4",
"profile": "https://github.com/Aryant-Tripathi",
"contributions": [
"code"
]
},
{
"login": "jdupak",
"name": "Jakub Dupak",
"avatar_url": "https://avatars.githubusercontent.com/u/22683640?v=4",
"profile": "https://github.com/jdupak",
"contributions": [
"code"
]
},
{
"login": "chenguangqi",
"name": "天热吃西瓜",
"avatar_url": "https://avatars.githubusercontent.com/u/6231010?v=4",
"profile": "http://chenguangqi.github.io/",
"contributions": [
"bug"
]
},
{
"login": "wahajenius",
"name": "Willem A. Hajenius",
"avatar_url": "https://avatars.githubusercontent.com/u/7836322?v=4",
"profile": "https://github.com/wahajenius",
"contributions": [
"code"
]
},
{
"login": "VitaliiIevtushenko",
"name": "Vitalii Yevtushenko",
"avatar_url": "https://avatars.githubusercontent.com/u/11145125?v=4",
"profile": "https://github.com/VitaliiIevtushenko",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7,

View File

@ -45,12 +45,12 @@ Start docker without binding to local directory, so that we can do a fresh check
```
export LANG=en_US.UTF-8
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
export PMD_CI_SECRET_PASSPHRASE="xyz"
export PMD_CI_DEBUG=true
MAIN_BRANCH="master"
MAIN_BRANCH="main"
eval $(~/create-gh-actions-env.sh push pmd/pmd $MAIN_BRANCH)
cd /workspaces/pmd
@ -108,7 +108,7 @@ $(~/create-gh-actions-env.sh push adangel/pmd $MAIN_BRANCH)
```
export LANG=en_US.UTF-8
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/master/scripts
export PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts
export PMD_CI_SECRET_PASSPHRASE="xyz"
export PMD_CI_DEBUG=true

View File

@ -280,9 +280,9 @@ function pmd_ci_deploy_build_artifacts() {
# Renders release notes and uploads them as ReadMe.md to sourceforge
#
function pmd_ci_build_and_upload_doc() {
# generate the site only for snapshots from master and for release builds for case a) (everything without cli/dist)
# generate the site only for snapshots from main and for release builds for case a) (everything without cli/dist)
# to avoid building it twice during a release...
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ] || [ "${BUILD_CLI_DIST_ONLY}" = "false" ]; then
pmd_doc_generate_jekyll_site
pmd_doc_create_archive
@ -312,8 +312,8 @@ function pmd_ci_build_and_upload_doc() {
pmd_ci_sourceforge_uploadReleaseNotes "pmd/${PMD_CI_MAVEN_PROJECT_VERSION}" "${rendered_release_notes}"
fi
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "master" ]; then
# only for snapshot builds from branch master: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
if pmd_ci_maven_isSnapshotBuild && [ "${PMD_CI_BRANCH}" = "main" ]; then
# only for snapshot builds from branch main: https://docs.pmd-code.org/snapshot -> pmd-doc-${PMD_CI_MAVEN_PROJECT_VERSION}
pmd_code_createSymlink "${PMD_CI_MAVEN_PROJECT_VERSION}" "snapshot"
# update github pages https://pmd.github.io/pmd/

View File

@ -4,7 +4,7 @@ function fetch_ci_scripts() {
local inc_dir
local inc_url
inc_dir="$(dirname "$0")/inc"
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/master/scripts}/inc"
inc_url="${PMD_CI_SCRIPTS_URL:-https://raw.githubusercontent.com/pmd/build-tools/main/scripts}/inc"
mkdir -p "${inc_dir}"

View File

@ -4,7 +4,6 @@ on:
push:
branches:
- main
- master
tags:
- '**'
pull_request:
@ -60,7 +59,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -4,7 +4,6 @@ on:
push:
branches:
- main
- master
tags:
- '**'
workflow_dispatch:
@ -24,7 +23,7 @@ jobs:
shell: bash
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
- name: Sync
run: .ci/git-repo-sync.sh
shell: bash

View File

@ -36,7 +36,7 @@ jobs:
run: |
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/26/scripts" >> $GITHUB_ENV
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/27/scripts" >> $GITHUB_ENV
- name: Check Environment
shell: bash
run: |

View File

@ -7,12 +7,12 @@ By participating in this project you agree to abide by its terms.
You can find the code of conduct in the file [code_of_conduct.md](code_of_conduct.md).
| NB: the rule designer is developed over at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Please refer to the specific [contributor documentation](https://github.com/pmd/pmd-designer/blob/master/CONTRIBUTING.md) if your issue, feature request or PR touches the designer. |
| --- |
| NB: the rule designer is developed over at [pmd/pmd-designer](https://github.com/pmd/pmd-designer). Please refer to the specific [contributor documentation](https://github.com/pmd/pmd-designer/blob/main/CONTRIBUTING.md) if your issue, feature request or PR touches the designer. |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
## Pull requests
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
* Please create your pull request against the `main` branch. We will rebase/merge it to the maintenance
branches, if necessary.
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
@ -36,7 +36,7 @@ When filing a bug report, please provide as much information as possible, so tha
There is some documentation available under <https://docs.pmd-code.org/latest>. Feel free to create a bug report if
documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports).
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/master/docs>. You can find build instructions there.
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/main/docs>. You can find build instructions there.
For more on contributing documentation check <https://docs.pmd-code.org/latest/pmd_devdocs_writing_documentation.html>
## Questions
@ -53,8 +53,8 @@ There are various channels, on which you can ask questions:
PMD uses [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
See [pmd-checkstyle-config.xml](https://github.com/pmd/build-tools/blob/master/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml) for the configuration and
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/master/eclipse) that can
See [pmd-checkstyle-config.xml](https://github.com/pmd/build-tools/blob/main/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml) for the configuration and
[the eclipse configuration files](https://github.com/pmd/build-tools/tree/main/eclipse) that can
be imported into a fresh workspace.
## Add yourself as contributor

View File

@ -39,9 +39,9 @@ def run_pmdtester
FileUtils.mv 'target/reports/diff', 'target/diff1'
message1 = create_message
# run against master branch (if the PR is not already against master)
unless ENV['PMD_CI_BRANCH'] == 'master'
@base_branch = 'master'
# run against main branch (if the PR is not already against main)
unless ENV['PMD_CI_BRANCH'] == 'main'
@base_branch = 'main'
@logger.info "\n\n--------------------------------------"
@logger.info "Run against #{@base_branch}"
@summary = PmdTester::Runner.new(get_args(@base_branch, false, 'target/diff1/patch_config.xml')).run

View File

@ -1,7 +1,7 @@
source 'https://rubygems.org/'
# bleeding edge from git
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'master'
#gem 'pmdtester', :git => 'https://github.com/pmd/pmd-regression-tester.git', branch: 'main'
gem 'pmdtester'
gem 'danger'

View File

@ -3,6 +3,7 @@ GEM
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
bigdecimal (3.1.8)
claide (1.1.0)
claide-plugins (0.9.2)
@ -13,7 +14,8 @@ GEM
concurrent-ruby (1.3.4)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.5.0)
danger (9.5.1)
base64 (~> 0.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@ -24,12 +26,14 @@ GEM
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
octokit (>= 4.0)
pstore (~> 0.1)
terminal-table (>= 1, < 4)
differ (0.1.2)
et-orbi (1.2.11)
tzinfo
faraday (2.11.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-http-cache (2.5.1)
faraday (>= 0.8)
@ -41,19 +45,20 @@ GEM
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
json (2.7.5)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (5.5.1)
logger (1.6.0)
logger (1.6.1)
logger-colors (1.0.0)
nap (1.1.0)
net-http (0.4.1)
uri
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
octokit (9.1.0)
octokit (9.2.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
@ -64,26 +69,25 @@ GEM
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.9)
pstore (0.1.3)
public_suffix (6.0.1)
raabro (1.4.0)
racc (1.8.1)
rchardet (1.8.0)
rexml (3.3.6)
strscan
rouge (4.3.0)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
rexml (3.3.9)
rouge (4.5.1)
rufus-scheduler (3.9.2)
fugit (~> 1.1, >= 1.11.1)
safe_yaml (1.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
slop (4.10.1)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
uri (0.13.1)
PLATFORMS
@ -98,4 +102,4 @@ DEPENDENCIES
safe_yaml
BUNDLED WITH
2.5.3
2.5.22

View File

@ -1,12 +1,12 @@
# PMD - source code analyzer
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/pmd/7.0.x/docs/images/logo/pmd-logo-300px.png)
![PMD Logo](https://raw.githubusercontent.com/pmd/pmd/main/docs/images/logo/pmd-logo-300px.png)
[![Join the chat](https://img.shields.io/gitter/room/pmd/pmd)](https://app.gitter.im/#/room/#pmd_pmd:gitter.im?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://github.com/pmd/pmd/workflows/build/badge.svg?branch=master)](https://github.com/pmd/pmd/actions)
[![Build Status](https://github.com/pmd/pmd/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/pmd/pmd/actions)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg?branch=main)](https://coveralls.io/github/pmd/pmd?branch=main)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca)](https://app.codacy.com/organizations/gh/pmd/dashboard)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
[![Documentation (latest)](https://img.shields.io/badge/docs-latest-green)](https://docs.pmd-code.org/latest/)

View File

@ -11,10 +11,11 @@
- root-node-name: name of the root node without prefix (eg "TopLevel"), will be made to implement RootNode
See AntlrGeneratedParserBase
-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<property name="target-package-dir" value="${antlr4.outputDirectory}/net/sourceforge/pmd/lang/${lang-id}/ast"/>
<property name="stamp-file" value="${project.build.directory}/last-generated-timestamp" />
<property name="lang-ast-package" value="net.sourceforge.pmd.lang.${lang-id}.ast" />
@ -32,14 +33,100 @@
<property name="base-visitor-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="listener-name" value="${lang-name}Listener"/>
<property name="listener-file" value="${target-package-dir}/${visitor-name}.java"/>
<property name="listener-file" value="${target-package-dir}/${listener-name}.java"/>
<property name="base-listener-name" value="${lang-name}BaseListener"/>
<property name="base-listener-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="base-listener-file" value="${target-package-dir}/${base-listener-name}.java"/>
<property name="node-itf-name" value="${lang-name}Node"/>
<property name="base-class-name" value="Abstract${lang-name}Node"/>
<property name="lexer-name" value="${lang-name}Lexer"/>
<property name="lexer-file" value="${target-package-dir}/${lexer-name}.java"/>
<target name="check-up-to-date"
description="Checks the input files are up to date">
<uptodate property="processing-not-required" targetfile="${stamp-file}">
<srcfiles dir="${target-package-dir}" includes="*.java" />
<srcfiles file="${ant.file}" />
</uptodate>
<echo message="Up-to-date check: processing-not-required=${processing-not-required}" />
</target>
<target name="update-stamp-file" unless="processing-not-required">
<touch file="${stamp-file}" />
</target>
<target name="annotate-classes" description="Adds the @Generated annotation to all classes"
unless="processing-not-required">
<if>
<available file="${parser-file}"/>
<then>
<replace file="${parser-file}"
token="public class ${parser-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${parser-name}'/>
<!-- Parse tree classes for each element -->
<replace file="${parser-file}"
token="public static class "
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public static class '/>
</then>
</if>
<if>
<available file="${visitor-file}"/>
<then>
<replace file="${visitor-file}"
token="public interface ${visitor-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public interface ${visitor-name}'/>
</then>
</if>
<if>
<available file="${base-visitor-file}"/>
<then>
<replace file="${base-visitor-file}"
token="public class ${base-visitor-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${base-visitor-name}'/>
</then>
</if>
<if>
<available file="${listener-file}"/>
<then>
<replace file="${listener-file}"
token="public interface ${listener-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public interface ${listener-name}'/>
</then>
</if>
<if>
<available file="${base-listener-file}"/>
<then>
<replace file="${base-listener-file}"
token="public class ${base-listener-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${base-listener-name}'/>
</then>
</if>
<if>
<available file="${lexer-file}"/>
<then>
<replace file="${lexer-file}"
token="public class ${lexer-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${lexer-name}'/>
</then>
</if>
</target>
<condition property="rename-parser">
<and>
<not>
@ -72,7 +159,9 @@
tofile="${parser-file}"/>
</target>
<target name="cpd-language" description="Adapt Antlr sources for CPD-only languages">
<target name="cpd-language" depends="check-up-to-date, annotate-classes, cpd-language-processing, update-stamp-file"/>
<target name="cpd-language-processing" description="Adapt Antlr sources for CPD-only languages"
unless="processing-not-required">
<!-- We only need the Lexer file. -->
<delete file="${parser-file}"/>
<delete>
@ -83,7 +172,9 @@
</delete>
</target>
<target name="pmd-language" description="Adapt Antlr sources for PMD languages" depends="rename-parser">
<target name="pmd-language" depends="check-up-to-date, rename-parser, annotate-classes, pmd-language-processing, update-stamp-file"/>
<target name="pmd-language-processing" description="Adapt Antlr sources for PMD languages"
unless="processing-not-required">
<!-- Adapt parser. -->
<replace file="${parser-file}">

View File

@ -311,7 +311,7 @@ echo " <https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd/maven-me
echo
echo
echo "Then proceed with releasing pmd-designer..."
echo "<https://github.com/pmd/pmd-designer/blob/master/releasing.md>"
echo "<https://github.com/pmd/pmd-designer/blob/main/releasing.md>"
echo
echo "Press enter to continue when pmd-designer is available in maven-central..."
echo "<https://repo.maven.apache.org/maven2/net/sourceforge/pmd/pmd-designer/maven-metadata.xml>."

View File

@ -1,8 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.1)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
@ -15,6 +16,7 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.8)
coffee-script (2.4.1)
coffee-script-source
@ -34,9 +36,10 @@ GEM
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.9.1)
faraday (2.11.0)
execjs (2.10.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-net_http (3.3.0)
net-http
@ -99,7 +102,7 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jekyll (3.10.0)
addressable (~> 2.4)
@ -211,6 +214,7 @@ GEM
gemoji (>= 3, < 5)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
json (2.7.5)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
@ -219,7 +223,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
logger (1.6.1)
mercenary (0.3.6)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
@ -240,8 +244,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
rubyzip (2.3.2)
safe_yaml (1.0.5)
@ -255,7 +258,6 @@ GEM
faraday (>= 0.17.3, < 3)
securerandom (0.3.1)
simpleidn (0.2.3)
strscan (3.1.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.1)
@ -264,7 +266,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (1.8.0)
uri (0.13.1)
webrick (1.8.1)
webrick (1.9.0)
PLATFORMS
x86_64-linux
@ -276,4 +278,4 @@ DEPENDENCIES
webrick
BUNDLED WITH
2.5.3
2.5.22

View File

@ -1,9 +1,9 @@
repository: pmd/pmd
pmd:
version: 7.5.0-SNAPSHOT
previous_version: 7.4.0
date: 2024-08-30
version: 7.8.0-SNAPSHOT
previous_version: 7.7.0
date: 2024-11-29
# release types: major, minor, bugfix
release_type: minor
@ -21,7 +21,7 @@ site_title: PMD Source Code Analyzer
company_name: PMD Open Source Project
# this appears in the footer
github_editme_path: pmd/pmd/blob/master/docs/
github_editme_path: pmd/pmd/blob/main/docs/
# if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank.
host: 127.0.0.1

View File

@ -260,6 +260,9 @@ entries:
- title: Error Prone
output: web, pdf
url: /pmd_rules_ecmascript_errorprone.html
- title: Performance
output: web, pdf
url: /pmd_rules_ecmascript_performance.html
- title: null
output: web, pdf
subfolders:
@ -521,7 +524,7 @@ entries:
url: /pmd_devdocs_building.html
output: web, pdf
- title: Contributing
external_url: https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md
external_url: https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md
output: web, pdf
- title: Writing documentation
url: /pmd_devdocs_writing_documentation.html

View File

@ -45,9 +45,9 @@ See also
## Git branches/tags policy
* Main development happens on the main branch (currently called `master`).
* Main development happens on the main branch (currently called `main`).
* PR and enhancements are done on the main branch.
* Release are usually done directly from the main branch, we don't create release branches.
* Releases are usually done directly from the main branch, we don't create release branches.
* Each release has its own tag named `pmd_releases/MAJOR.MINOR.PATCH`.
* In case of a patch release, we either do it from the main branch (if there was no development ongoing)
or create a separate branch off the last release tag.

View File

@ -36,5 +36,5 @@ The latest release documentation is always available under [docs.pmd-code.org/la
First off, thanks for taking the time to contribute!
Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/master/CONTRIBUTING.md) and
[BUILDING.md](https://github.com/pmd/pmd/blob/master/BUILDING.md).
Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md) and
[BUILDING.md](https://github.com/pmd/pmd/blob/main/BUILDING.md).

View File

@ -64,7 +64,7 @@ definitely don't come for free. It is much effort and requires perseverance to i
### 2. Implement an AST parser for your language
* ANTLR will generate the parser for you based on the grammar file. The grammar file needs to be placed in the
folder `src/main/antlr4` in the appropriate sub package `ast` of the language. E.g. for swift, the grammar
file is [Swift.g4](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4)
file is [Swift.g4](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4)
and is placed in the package `net.sourceforge.pmd.lang.swift.ast`.
* Configure the options "superClass" and "contextSuperClass". These are the base classes for the generated
classes.
@ -72,39 +72,39 @@ definitely don't come for free. It is much effort and requires perseverance to i
### 3. Create AST node classes
* The individual AST nodes are generated, but you need to define the common interface for them.
* You need to define the supertype interface for all nodes of the language. For that, we provide
[`AntlrNode`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java).
* See [`SwiftNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
[`AntlrNode`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java).
* See [`SwiftNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNode.java)
as an example.
* Additionally, you need several base classes:
* a language specific inner node - these nodes represent the production rules from the grammar.
In Antlr, they are called "ParserRuleContext". We call them "InnerNode". Use the
base class from pmd-core
[`BaseAntlrInnerNode`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/BaseAntlrInnerNode.java)
. And example is [`SwiftInnerNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftInnerNode.java).
[`BaseAntlrInnerNode`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/BaseAntlrInnerNode.java)
. And example is [`SwiftInnerNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftInnerNode.java).
Note that this language specific inner node is package-private, as it is only the base class for the concrete
nodes generated by ANLTR.
* a language specific root node - this provides the root of the AST and our parser will return
subtypes of this node. The root node itself is a "InnerNode".
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftRootNode.java).
See [`SwiftRootNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftRootNode.java).
Note that this language specific root node is package-private, as it is only the base class for the concrete
node generated by ANLTR.
* a language specific terminal node.
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
See [`SwiftTerminalNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftTerminalNode.java).
* a language specific error node.
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftErrorNode.java).
See [`SwiftErrorNode`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftErrorNode.java).
* a language name dictionary. This is used to convert ANTLR node names to useful XPath node names.
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNameDictionary.java).
See [`SwiftNameDictionary'](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftNameDictionary.java).
* Once these base classes exist, you need to change the ANTLR grammar to add additional members via `@parser::members`
* Define a package private field `DICO` which creates a new instance of your language name dictionary using the
vocabulary from the generated parser (`VOCABULARY`).
* Define two additional methods to help converting the ANTLR context objects into PMD AST nodes.
The methods are abstract in [`AntlrGeneratedParserBase`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrGeneratedParserBase.java)
The methods are abstract in [`AntlrGeneratedParserBase`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrGeneratedParserBase.java)
and need to be implemented here for the concrete language: `createPmdTerminal()` and `createPmdError()`.
* In order for the generated code to match and use our custom classes, we have a common ant script, that fiddles with
the generated code. The ant script is [`antlr4-wrapper.xml`](https://github.com/pmd/pmd/blob/master/antlr4-wrapper.xml)
the generated code. The ant script is [`antlr4-wrapper.xml`](https://github.com/pmd/pmd/blob/main/antlr4-wrapper.xml)
and does not need to be adjusted - it has plenty of parameters that can be configured.
The ant script is added in the language module's `pom.xml` where the parameters are set (e.g. name of root name
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
class). Have a look at Swift's example: [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
* You can add additional methods in your "InnerNode" (e.g. `SwiftInnerNode`) that are available on all nodes.
But on most cases you won't need to do anything.
@ -115,31 +115,31 @@ definitely don't come for free. It is much effort and requires perseverance to i
have the parser generated.
* The generated code will be placed under `target/generated-sources/antlr4` and will not be committed to
source control.
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/pom.xml).
* You should review [`pmd-swift/pom.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/pom.xml).
### 5. Create a TokenManager
* This is needed to support CPD (copy paste detection)
* We provide a default implementation using [`AntlrTokenManager`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java).
* We provide a default implementation using [`AntlrTokenManager`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java).
* You must create your own "AntlrCpdLexer" such as we do with
[`SwiftCpdLexer`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/cpd/SwiftCpdLexer.java).
[`SwiftCpdLexer`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/cpd/SwiftCpdLexer.java).
* If you wish to filter specific tokens (e.g. comments to support CPD suppression via "CPD-OFF" and "CPD-ON")
you can create your own implementation of
[`AntlrTokenFilter`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenFilter.java).
[`AntlrTokenFilter`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/cpd/impl/AntlrTokenFilter.java).
You'll need to override then the protected method `getTokenFilter(AntlrTokenManager)`
and return your custom filter. See the CpdLexer for C# as an exmaple:
[`CsCpdLexer`](https://github.com/pmd/pmd/blob/master/pmd-cs/src/main/java/net/sourceforge/pmd/lang/cs/cpd/CsCpdLexer.java).
[`CsCpdLexer`](https://github.com/pmd/pmd/blob/main/pmd-cs/src/main/java/net/sourceforge/pmd/lang/cs/cpd/CsCpdLexer.java).
If you don't need a custom token filter, you don't need to override the method. It returns the default
`AntlrTokenFilter` which doesn't filter anything.
### 6. Create a PMD parser “adapter”
* Create your own parser, that adapts the ANLTR interface to PMD's parser interface.
* We provide a [`AntlrBaseParser`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java)
* We provide a [`AntlrBaseParser`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java)
implementation that you need to extend to create your own adapter as we do with
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
[`PmdSwiftParser`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/PmdSwiftParser.java).
### 7. Create a language version handler
* Now you need to create your version handler, as we did with [`SwiftHandler`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java).
* Now you need to create your version handler, as we did with [`SwiftHandler`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java).
* This class is sort of a gateway between PMD and all parsing logic specific to your language.
* For a minimal implementation, it just needs to return a parser *(see step #6)*.
* It can be used to provide other features for your language like
@ -154,15 +154,15 @@ definitely don't come for free. It is much effort and requires perseverance to i
* A parser visitor adapter is not needed anymore with PMD 7. The visitor interface now provides a default
implementation.
* The visitor for ANTLR based AST is generated along the parser from the ANTLR grammar file. The
base interface for a visitor is [`AstVisitor`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstVisitor.java).
base interface for a visitor is [`AstVisitor`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AstVisitor.java).
* The generated visitor class for Swift is called `SwiftVisitor`.
* In order to help use this visitor later on, a base visitor class should be created.
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
See [`SwiftVisitorBase`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/ast/SwiftVisitorBase.java)
as an example.
### 9. Make PMD recognize your language
* Create your own subclass of `net.sourceforge.pmd.lang.impl.SimpleLanguageModuleBase`, see Swift as an example:
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java).
[`SwiftLanguageModule`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java).
* Add for each version of your language a call to `addVersion` in your language modules constructor.
Use `addDefaultVersion` for defining the default version.
* Youll need to refer the language version handler created in step #7.
@ -172,9 +172,9 @@ definitely don't come for free. It is much effort and requires perseverance to i
### 10. Create an abstract rule class for the language
* You need to create your own abstract rule class in order to interface your language with PMD's generic rule
execution.
* See [`AbstractSwiftRule`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/AbstractSwiftRule.java) as an example.
* See [`AbstractSwiftRule`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/AbstractSwiftRule.java) as an example.
* The rule basically just extends
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractVisitorRule.java)
[`AbstractVisitorRule`](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractVisitorRule.java)
and only redefines the abstract `buildVisitor()` method to return our own type of visitor.
In this case our `SwiftVisitor` is used.
While there is no real functionality added, every language should have its own base class for rules.
@ -192,7 +192,7 @@ definitely don't come for free. It is much effort and requires perseverance to i
* PMD supports 2 types of rules, through visitors or XPath.
* To add a visitor rule:
* You need to extend the abstract rule you created on the previous step, you can use the swift
rule [UnavailableFunctionRule](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java)
rule [UnavailableFunctionRule](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java)
as an example. Note, that all rule classes should be suffixed with `Rule` and should be placed
in a package the corresponds to their category.
* To add an XPath rule you can follow our guide [Writing XPath Rules](pmd_userdocs_extending_writing_xpath_rules.html).
@ -213,16 +213,16 @@ definitely don't come for free. It is much effort and requires perseverance to i
* Testing rules is described in depth in [Testing your rules](pmd_userdocs_extending_testing.html).
* Each rule has its own test class: Create a test class for your rule extending `PmdRuleTst`
*(see
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
[`UnavailableFunctionTest`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionTest.java)
for example)*
* Create a category rule set for your language *(see
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
[`pmd-swift/src/main/resources/bestpractices.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/main/resources/category/swift/bestpractices.xml)
for example)*
* Place the test XML file with the test cases in the correct location
* When executing the test class
* this triggers the unit test to read the corresponding XML file with the rule test data
*(see
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/master/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
[`UnavailableFunction.xml`](https://github.com/pmd/pmd/blob/main/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/rule/bestpractices/xml/UnavailableFunction.xml)
for example)*
* This test XML file contains sample pieces of code which should trigger a specified number of
violations of this rule. The unit test will execute the rule on this piece of code, and verify

View File

@ -20,7 +20,7 @@ easy to implement the Tokenizer interface.
Use the following guide to set up a new language module that supports CPD.
1. Create a new Maven module for your language. You can take [the Golang module](https://github.com/pmd/pmd/tree/master/pmd-go/pom.xml) as an example.
1. Create a new Maven module for your language. You can take [the Golang module](https://github.com/pmd/pmd/tree/main/pmd-go/pom.xml) as an example.
- Make sure to add your new module to the parent pom as `<module>` entry, so that it is built alongside the
other languages.
- Also add your new module to the dependencies list in "pmd-languages-deps/pom.xml", so that the new language
@ -28,7 +28,7 @@ Use the following guide to set up a new language module that supports CPD.
2. Implement a {% jdoc core::cpd.CpdLexer %}.
- For Antlr grammars you can take the grammar from [antlr/grammars-v4](https://github.com/antlr/grammars-v4) and place it in `src/main/antlr4` followed by the package name of the language. You then need to call the appropriate ant wrapper to generate
the lexer from the grammar. To do so, edit `pom.xml` (eg like [the Golang module](https://github.com/pmd/pmd/tree/master/pmd-go/pom.xml)).
the lexer from the grammar. To do so, edit `pom.xml` (eg like [the Golang module](https://github.com/pmd/pmd/tree/main/pmd-go/pom.xml)).
Once that is done, `mvn generate-sources` should generate the lexer sources for you.
You can now implement a CpdLexer, for instance by extending {% jdoc core::cpd.impl.AntlrCpdLexer %}. The following reproduces the Go implementation:
@ -49,7 +49,7 @@ Use the following guide to set up a new language module that supports CPD.
change each token e.g. into uppercase, so that CPD sees the same strings and can find duplicates even when
the casing differs. See {% jdoc tsql::lang.tsql.cpd.TSqlCpdLexer %} for an example. You will also need a
"CaseChangingCharStream", so that antlr itself is case-insensitive.
- For JavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/master/pmd-python/pom.xml) does.
- For JavaCC grammars, place your grammar in `etc/grammar` and edit the `pom.xml` like the [Python implementation](https://github.com/pmd/pmd/blob/main/pmd-python/pom.xml) does.
You can then subclass {% jdoc core::cpd.impl.JavaccCpdLexer %} instead of AntlrCpdLexer.
- If your JavaCC based language is case-insensitive (option `IGNORE_CASE=true`), then you need to implement
{%jdoc core::lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior %}, which can change each token
@ -82,7 +82,7 @@ If your language only supports CPD, then you can subclass {% jdoc core::lang.imp
At this point the new language module should be available in {% jdoc core::lang.LanguageRegistry#CPD %} and usable by CPD like any other language.
4. Update the test that asserts the list of supported languages by updating the `SUPPORTED_LANGUAGES` constant in [BinaryDistributionIT](https://github.com/pmd/pmd/blob/master/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java).
4. Update the test that asserts the list of supported languages by updating the `SUPPORTED_LANGUAGES` constant in [BinaryDistributionIT](https://github.com/pmd/pmd/blob/main/pmd-dist/src/test/java/net/sourceforge/pmd/dist/BinaryDistributionIT.java).
5. Add some tests for your CpdLexer by following the [section below](#testing-your-implementation).
@ -119,7 +119,7 @@ of {% jdoc core::cpd.CpdCapableLanguage#createCpdTokenizer(core::lang.LanguagePr
To implement simple token filtering, you can use {% jdoc core::cpd.impl.BaseTokenFilter %}
as a base class, or another base class in {% jdoc_package core::cpd.impl %}.
Take a look at the [Kotlin token filter implementation](https://github.com/pmd/pmd/blob/master/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/cpd/KotlinCpdLexer.java), or the [Java one](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java).
Take a look at the [Kotlin token filter implementation](https://github.com/pmd/pmd/blob/main/pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/cpd/KotlinCpdLexer.java), or the [Java one](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/cpd/JavaCpdLexer.java).
### Testing your implementation

View File

@ -17,8 +17,8 @@ Regression difference reports are commented back to the PR for the reviewer's in
**Verifying your local changes and generate a diff-report locally**
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b master -p YOUR_DEVELOPMENT_BRANCH`
`pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b main -p YOUR_DEVELOPMENT_BRANCH`
The regression difference report is placed in the `YOUR_WORKING_DIR/target/reports/diff` directory.
For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/master/README.rdoc)
For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/main/README.rdoc)

View File

@ -33,7 +33,7 @@ This makes it easy to view the documentation also offline.
The categories for a language `%lang%` are located in
`pmd-%lang%/src/main/resources/category/%lang% `. So for Java the categories
can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/master/pmd-java/src/main/resources/category/java).
can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/main/pmd-java/src/main/resources/category/java).
The XML category files in this directory are transformed during build into markdown pages
describing the rules they contain. These pages are placed under `docs/` like the handwritten
documentation, and are then rendered with Jekyll like the rest of them. The rule documentation
@ -83,7 +83,7 @@ Here's a short overview:
For the javadoc tags, the standard PMD maven modules are already defined as namespaces, e.g. `core`, `java`, `apex`, ....
For the implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/master/docs/_plugins) folder.
For the implementation of these tags, see the [_plugins](https://github.com/pmd/pmd/tree/main/docs/_plugins) folder.
## Building

View File

@ -2,7 +2,7 @@
title: Java support
permalink: pmd_languages_java.html
author: Clément Fournier
last_updated: December 2023 (7.0.0)
last_updated: July 2024 (7.5.0)
tags: [languages, PmdCapableLanguage, CpdCapableLanguage]
summary: "Java-specific features and guidance"
---
@ -15,9 +15,10 @@ Usually the latest non-preview Java Version is the default version.
| Java Version | Alias | Supported by PMD since |
|--------------|-------|------------------------|
| 23-preview | | 7.5.0 |
| 23 (default) | | 7.5.0 |
| 22-preview | | 7.0.0 |
| 22 (default) | | 7.0.0 |
| 21-preview | | 7.0.0 |
| 22 | | 7.0.0 |
| 21 | | 7.0.0 |
| 20 | | 6.55.0 |
| 19 | | 6.48.0 |
@ -198,4 +199,4 @@ You can access these via {% jdoc core::reporting.RuleViolation#getAdditionalInfo
There is no API yet for dataflow analysis. However, some rules such as {% rule java/bestpractices/UnusedAssignment %}
or {% rule java/design/ImmutableField %} are using an internal implementation of an additional
AST pass that adds dataflow information. The implementation can be found in
[net.sourceforge.pmd.lang.java.rule.internal.DataflowPass](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java).
[net.sourceforge.pmd.lang.java.rule.internal.DataflowPass](https://github.com/pmd/pmd/blob/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java).

View File

@ -2,7 +2,7 @@
title: Language configuration
permalink: pmd_languages_configuration.html
author: Clément Fournier
last_updated: February 2024 (7.0.0)
last_updated: August 2024 (7.5.0)
tags: [languages]
keywords: [pmd, cpd, options, command, auxclasspath, language, properties]
summary: "Summary of language configuration options and properties"
@ -98,6 +98,11 @@ The Java language can be configured with the following properties:
Environment variable: `PMD_JAVA_X_TYPE_INFERENCE_LOGGING`
- `xStrictTypeRes`: Whether to perform type resolution strictly at the start of execution or not (default: "true")
Since: 7.5.0
Environment variable: `PMD_JAVA_X_STRICT_TYPE_RES`
## Apex language properties
- `rootDirectory`: With this property the root directory of the Salesforce metadata, where `sfdx-project.json`

View File

@ -18,15 +18,15 @@ It usually takes 15 minutes.
## Contents
* Main page - aka "Landing page": <https://pmd.github.io>
* Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/master/_layouts/default.html).
It includes all the sub section, which can be found in the includes directory [_includes/](https://github.com/pmd/pmd.github.io/tree/master/_includes)
* Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/default.html).
It includes all the sub section, which can be found in the includes directory [_includes/](https://github.com/pmd/pmd.github.io/tree/main/_includes)
* The latest PMD version is configured in `_config.yml` and the variables `site.pmd.latestVersion` are used
e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/master/_includes/home.html).
e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/home.html).
* Blog - aka "News": <https://pmd.github.io/news/>
* This is a section on main page. It shows the 5 latest news. See [_includes/news.html](https://github.com/pmd/pmd.github.io/blob/master/_includes/news.html).
* This is a section on main page. It shows the 5 latest news. See [_includes/news.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/news.html).
* There is also a sub page "news" which lists all news.
* Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/master/_layouts/news.html)
* Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/master/news.html)
* Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/news.html)
* Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/main/news.html)
## Building the page locally

View File

@ -5,7 +5,7 @@ last_updated: October 2021
author: Andreas Dangel <andreas.dangel@adangel.org>
---
## Example 1: Merging PR #123 into master
## Example 1: Merging PR #123 into main
1. Review the pull request
@ -20,15 +20,15 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
2. The actual merge commands:
We assume, that the PR has been created from the master branch. If this is not the case,
We assume, that the PR has been created from the main branch. If this is not the case,
then we'll either need to rebase or ask for rebasing before merging.
```
git checkout master && git pull origin master # make sure, you have the latest code
git checkout main && git pull origin main # make sure, you have the latest code
git fetch origin pull/123/head:pr-123 && git checkout pr-123 # creates a new temporary branch "pr-123"
```
3. Update the [release notes](https://github.com/pmd/pmd/blob/master/docs/pages/release_notes.md):
3. Update the [release notes](https://github.com/pmd/pmd/blob/main/docs/pages/release_notes.md):
* Are there any API changes, that need to be documented? (Section "API Changes")
* Are there any significant changes to existing rules, that should be mentioned?
@ -61,13 +61,13 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
And follow the instructions. This will create a new commit into to the current branch (pr-123) updating both
the file `.all-contributorsrc` and `docs/pages/pmd/projectdocs/credits.md`.
5. Now merge the pull request into the master branch:
5. Now merge the pull request into the main branch:
```
git checkout master
git merge --no-ff pr-123 -m "Merge pull request #123 from xyz:branch
git checkout main
git merge --no-ff pr-123 -m "Full-title-of-the-pr (#123)
Full-title-of-the-pr #123" --log
Merge pull request #123 from xyz:branch" --log
```
{%include note.html content="If there are merge conflicts, you'll need to deal with them here." %}
@ -75,7 +75,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
6. Run the complete build: `./mvnw clean verify -Pgenerate-rule-docs`
{% include note.html content="This will execute all the unit tests and the checkstyle tests. It ensures,
that the complete project can be build and is functioning on top of the current master." %}
that the complete project can be build and is functioning on top of the current main." %}
{% include note.html content="The profile `generate-rule-docs` will run the doc checks, that would
otherwise only run on github actions and fail the build, if e.g. a jdoc or rule reference is wrong." %}
@ -83,7 +83,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
7. If the build was successful, you are ready to push:
```
git push origin master
git push origin main
```
Since the temporary branch is now not needed anymore, you can delete it:
@ -92,7 +92,7 @@ author: Andreas Dangel <andreas.dangel@adangel.org>
## Example 2: Merging PR #124 into a maintenance branch
We ask, to create every pull request against master, to make it easier to contribute.
We ask, to create every pull request against main, to make it easier to contribute.
But if a pull request is intended to fix a bug in an older version of PMD, then we need to backport this pull request.
### Creating a maintenance branch
@ -124,7 +124,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
```
git fetch origin pull/124/head:pr-124 && git checkout pr-124 # creates a new temporary branch
git rebase master --onto pmd/5.8.x
git rebase main --onto pmd/5.8.x
./mvnw clean verify # make sure, everything works after the rebase
```
@ -154,7 +154,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
You need to manually close the pull request. Leave a comment, that it has been
rebased onto the maintenance branch.
### Merging into master
### Merging into main
Now the PR has been merged into the maintenance branch, but it is missing in any later version of PMD.
Therefore, we merge first into the next minor version maintenance branch (if existing):
@ -162,17 +162,17 @@ Therefore, we merge first into the next minor version maintenance branch (if exi
git checkout pmd/5.9.x
git merge pmd/5.8.x
After that, we merge the changes into the master branch:
After that, we merge the changes into the main branch:
git checkout master
git checkout main
git merge pmd/5.9.x
{%include note.html content="This ensures, that every change on the maintenance branch eventually ends
up in the master branch and therefore in any future version of PMD.<br>
up in the main branch and therefore in any future version of PMD.<br>
The downside is however, that there are inevitable merge conflicts for the maven `pom.xml` files, since
every branch changed the version number differently.<br>
We could avoid this by merging only the temporary branch \"pr-124\" into each maintenance branch and
eventually into master, with the risk of missing single commits in a maintenance branch, that have been
eventually into main, with the risk of missing single commits in a maintenance branch, that have been
done outside the temporary branch." %}
### Merging vs. Cherry-Picking
@ -181,4 +181,4 @@ We are not using cherry-picking, so that each fix is represented by a single com
Cherry-picking would duplicate the commit and you can't see in the log, on which branches the fix has been
integrated (e.g. gitk and github show the branches, from which the specific commit is reachable).
The downside is a more complex history - the maintenance branches and master branch are "connected" and not separate.
The downside is a more complex history - the maintenance branches and main branch are "connected" and not separate.

View File

@ -140,7 +140,7 @@ echo "* Days since last release: $(( ( $(date +%s) - $(git log --max-count=1 --f
Note: both shell snippets are also integrated into `do-release.sh`.
Check in all (version) changes to branch master or any other branch, from which the release takes place:
Check in all (version) changes to branch main or any other branch, from which the release takes place:
$ git commit -a -m "Prepare pmd release <version>"
$ git push
@ -180,7 +180,7 @@ NEW_RELEASE_NOTES=$(bundle exec docs/render_release_notes.rb docs/pages/release_
cat > "../pmd.github.io/${RELEASE_NOTES_POST}" <<EOF
```
Check in all (version, blog post) changes to branch master:
Check in all (version, blog post) changes to branch main:
$ git commit -a -m "Prepare pmd release <version>"
$ git push
@ -259,7 +259,7 @@ Here is, what happens:
under <https://pmd.sourceforge.io/archive.phtml>.
The release on GitHub Actions currently takes about 30-45 minutes. Once this is done, you
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/master/releasing.md>.
can proceed with releasing pmd designer, see <https://github.com/pmd/pmd-designer/blob/main/releasing.md>.
Make sure to release the version, you have used earlier for the property `pmd-designer.version`.
Once the pmd-designer release is done, you can proceed with part 2. This is simply triggering manually
@ -374,7 +374,7 @@ This is a {{ site.pmd.release_type }} release.
Finally, commit and push the changes:
$ git commit -m "Prepare next development version"
$ git push origin master
$ git push origin main
## Branches
@ -382,7 +382,7 @@ Finally, commit and push the changes:
### Merging
If the release was done on a maintenance branch, such as `pmd/5.4.x`, then this branch should be
merged into the next "higher" branches, such as `pmd/5.5.x` and `master`.
merged into the next "higher" branches, such as `pmd/5.5.x` and `main`.
This ensures, that all fixes done on the maintenance branch, finally end up in the other branches.
In theory, the fixes should already be there, but you never now.
@ -392,7 +392,7 @@ In theory, the fixes should already be there, but you never now.
If releases from multiple branches are being done, the order matters. You should start from the "oldest" branch,
e.g. `pmd/5.4.x`, release from there. Then merge (see above) into the next branch, e.g. `pmd/5.5.x` and release
from there. Then merge into the `master` branch and release from there. This way, the last release done, becomes
from there. Then merge into the `main` branch and release from there. This way, the last release done, becomes
automatically the latest release on <https://docs.pmd-code.org/latest/> and on sourceforge.

File diff suppressed because it is too large Load Diff

View File

@ -159,7 +159,7 @@ The tool comes with a rather extensive help text, simply running with `--help`!
description="Path to a file to which report output is written. The file is created if it does not exist. If this option is not specified, the report is rendered to standard output."
%}
{% include custom/cli_option_row.html options="--show-suppressed"
description="Causes the suppressed rule violations to be added to the report."
description="Causes the suppressed rule violations to be added to the report if supported by the report format. See [PMD Report formats](pmd_userdocs_report_formats.html) for details."
%}
{% include custom/cli_option_row.html options="--suppress-marker"
option_arg="marker"

Some files were not shown because too many files have changed in this diff Show More