1083 Commits

Author SHA1 Message Date
Clément Fournier
412d39f513 Replace createFactory methods with a builder
Deprecate compatibility filter

Deprecate methods in RulesetsFactUtils
2020-10-26 19:26:47 +01:00
Andreas Dangel
4837c8dbc8 [maven-release-plugin] prepare for next development iteration 2020-10-24 10:17:24 +02:00
Andreas Dangel
81f12d3e5d [maven-release-plugin] prepare release pmd_releases/6.29.0 2020-10-24 10:17:15 +02:00
Andreas Dangel
e7738e2b4c [apex] Add support and test for parsing SafeNavigationOperator
Refs #2839
2020-10-22 20:02:51 +02:00
Andreas Dangel
9eeea472ac [apex] Update apex-jorje to 2020-09-10-5a5192 (Winter 21, Version 50)
Fixes #2839
2020-10-22 19:13:35 +02:00
Andreas Dangel
0745789bb7 [apex] Remove deprecated rules from quickstart.xml, restore Test 2020-10-22 17:58:06 +02:00
Jeff Bartolotta
98d0f0f38f Changes based on initial PR feedback
- Rename AvoidDatabaseMethodCallsInLoopsRule to OperationWithLimitsInLoop.
- Add AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule checks into OperationWithLimitsInLoop.
- Deprecate AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule in favor of OperationWithLimitsInLoop.
2020-10-21 11:25:20 -07:00
Jeff Bartolotta
8fb69b24db Add Apex AvoidDatabaseMethodCallsInLoopsRule
Fixes https://github.com/pmd/pmd/issues/1713, Database statements aren't detected in for loops.

- Added new AvoidDatabaseMethodCallsInLoopsRule that adds a violation if any methods from the System Database class are invoked from within a loop.

- Refactored AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule to derive from AbstractAvoidNodeInLoopsRule.
2020-10-05 19:02:21 -07:00
Andreas Dangel
aa245c6e1b [maven-release-plugin] prepare for next development iteration 2020-09-26 10:25:16 +02:00
Andreas Dangel
722f3ca997 [maven-release-plugin] prepare release pmd_releases/6.28.0 2020-09-26 10:25:05 +02:00
Jeff Bartolotta
5429cebf38 Add issue reproducers as standard rule tests
Added false negative and false positive test cases that were logged with
the original issue.
2020-09-21 20:11:07 -07:00
Jeff Bartolotta
c6b7a723be Analyze inner classes for sharing violations
Fixes https://github.com/pmd/pmd/issues/2774, false positives and false
negatives for ApexSharingViolationsRule.

Sharing settings are not inherited by inner classes. Sharing settings
need to be declared on the class that contains the Database method, DML,
SOQL, or SOSL.

The change inverts the direction from which nodes are found and
analyzed. The previous code visited the ASTUserClass and then searched
for descendant nodes that met a certain criteria. It did not visit inner
ASTUserClass nodes because it didn't use rule chains or call the super's
visit moethod for ASTUserClassi.

The new implementation visits all nodes that correspond to Database
method, DML, SOQL, or SOSL nodes and then finds the nearest ASTUserClass
parent node. This ASTUserClass is examined to determine if it has
declared a sharing setting as required.
2020-09-17 08:36:45 -07:00
Andreas Dangel
c59af0aee6 [maven-release-plugin] prepare for next development iteration 2020-08-31 18:30:18 +02:00
Andreas Dangel
856950f0d2 [maven-release-plugin] prepare release pmd_releases/6.27.0 2020-08-31 18:30:09 +02:00
XenoAmess
244a39db0f fix typos. 2020-08-27 11:47:11 +08:00
Andreas Dangel
0b92a768da [apex] Deprecate ApexParserVisitorReducedAdapter
See also #2661
2020-08-22 18:30:42 +02:00
Andreas Dangel
89140d86ce Merge branch 'master' into pr-2656 2020-08-20 09:47:16 +02:00
Andreas Dangel
40f954f81a Merge branch 'pr-2675'
[core] Deprecate parser options #2675
2020-08-02 16:53:24 +02:00
Andreas Dangel
eb683569af Merge branch 'pr-2617'
[core] Deprecate missing language attribute on rule definition #2617
2020-07-30 10:19:03 +02:00
Clément Fournier
25d59beb37 Revert changes to apex rules
Someone may be using those properties, this would
be a breaking change
2020-07-28 14:26:06 +02:00
Clément Fournier
190addc1a9 Replace usages of ApexXPathRule 2020-07-28 14:26:05 +02:00
Clément Fournier
9a37ab4962 Deprecate parser options in some places
There is no way to introduce the new API
in a binary compatible change, so LVHandler::getDefaultParserOptions,
LVHandler::getParser and Parser::parse
will remain like this until 7.0 and be
broken.
2020-07-28 14:25:51 +02:00
Andreas Dangel
fe82f6a448 Dogfood - update PMD to 6.26.0, update build-tools 2020-07-25 15:27:24 +02:00
Andreas Dangel
49ab75aeb7 [maven-release-plugin] prepare for next development iteration 2020-07-25 13:45:36 +02:00
Andreas Dangel
a9632e2a06 [maven-release-plugin] prepare release pmd_releases/6.26.0 2020-07-25 13:45:27 +02:00
Andreas Dangel
8a6975f8ec [apex] Improve AST for try-catch-finally statements 2020-07-24 16:55:48 +02:00
Clément Fournier
6f9aedfaeb Merge branch 'master' into issue-2598 2020-07-23 15:51:13 +02:00
Maikel Steneker
6fb5ac59b9 Ensure CPD uses tab width of 1 for tabs consistently
The columns that are reported by CPD were inconsistent across languages
before. A language like Java (using a JavaCC-based tokenizer) would use
a width of 8 for tabs, whereas a language like C# (using an Antlr-based
tokenizer) would use 1 instead.

This includes unit tests for most languages to ensure a tab character is
counted as 1. The configuration for JavaCC has been adjusted to respect
this as well.
2020-07-20 10:42:21 +02:00
Andreas Dangel
7b3d31246e Merge branch 'master' into pr-2624 2020-07-17 15:16:24 +02:00
Andreas Dangel
7ae424a35b Add deprecation javadocs 2020-07-17 14:43:43 +02:00
Andreas Dangel
e24a26e211 Merge branch 'pr-2629'
[all] Dependencies cleanup #2629
2020-07-17 12:07:03 +02:00
Andreas Dangel
94afdb117d Add test engines as surefire plugin dependencies
This removes junit-vintage-engine as a test dependency
as well as kotlintest-runner-junit5.
The engines are only needed during test execution, but should
not be available for test compilation.

For this to work, the latest surefire plugin is required.
2020-07-17 12:03:45 +02:00
Andreas Dangel
05933c646e [apex] AvoidSoqlInLoops false positive for SOQL with in For-Loop
Fixes #2598
2020-07-16 20:13:53 +02:00
Andreas Dangel
17e57633b5 Merge branch 'master' into pr-2597 2020-07-16 18:25:59 +02:00
Andreas Dangel
9180b479cb [apex] Remove profile designer, which started the deprecated designer
Users are encouraged to use https://github.com/pmd/pmd-designer instead.
2020-07-16 18:20:43 +02:00
Andreas Dangel
9168a76e84 Merge branch 'pr-2610'
[apex] Support top-level enums in rules #2610
2020-07-16 17:47:48 +02:00
Clément Fournier
7ccec3bcef Merge branch 'master' into deprecate-set-lang-in-java 2020-07-06 14:02:46 +02:00
Clément Fournier
8add323403 Fix other offenders 2020-07-06 14:02:21 +02:00
Andreas Dangel
1fb085f7ab Use StringUtils.equalsIgnoreCase 2020-07-03 11:58:38 +02:00
Andreas Dangel
147f1ac053 [apex] UnusedLocalVariable - false positive on case insensitivity allowed in Apex
Fixes #2626
2020-07-02 22:39:17 +02:00
Andreas Dangel
370c0b0b6d Remove unused dependency, explicitly declare used dependencies 2020-07-02 15:12:31 +02:00
Clément Fournier
49635c2a66 Deprecate Rulechain visitors 2020-07-01 11:27:38 +02:00
Clément Fournier
659066ee02 Deprecate BaseLanguageModule constructor 2020-07-01 11:27:38 +02:00
Clément Fournier
d7f96e08d9 Uniformize apply across languages 2020-07-01 11:27:38 +02:00
Clément Fournier
3dd49db9cc Reorder attributes
(name first)
2020-06-27 18:08:30 +02:00
Clément Fournier
50cd4668a8 Fix apex rules 2020-06-27 17:59:20 +02:00
Andreas Dangel
95d8e80c1b [maven-release-plugin] prepare for next development iteration 2020-06-27 11:31:27 +02:00
Andreas Dangel
a219b2e1be [maven-release-plugin] prepare release pmd_releases/6.25.0 2020-06-27 11:31:16 +02:00
Andreas Dangel
acbbbee685 Merge branch 'pr-2608'
[apex][plsql][java] Deprecate base rule classes #2608
2020-06-26 18:01:30 +02:00
Andreas Dangel
9810cdd654 Fix StdCyclomaticComplexity: enums should not be considered
In Apex enums, there can't be any custom methods.
2020-06-20 19:54:54 +02:00