diff --git a/.ci/README.md b/.ci/README.md index b2ce6f60b8..de5fbed99e 100644 --- a/.ci/README.md +++ b/.ci/README.md @@ -27,7 +27,6 @@ in clear text. gpg --batch --symmetric --cipher-algo AES256 \ --armor --passphrase="GnxdjywUEPveyCD1RLiTd7t8CImnefYr" \ --output .ci/files/public-env.gpg .ci/files/public-env - ## Local tests with docker Using the same docker container as described in [build-env @ build-tools](https://github.com/pmd/build-tools). @@ -89,6 +88,7 @@ PMD_CI_PULL_REQUEST_NUMBER=3220 cd /workspace/pmd rmdir pmd && mkdir pmd cd pmd +Added line: 7346 git init git remote add origin https://github.com/pmd/pmd git fetch --no-tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/pull/${PMD_CI_PULL_REQUEST_NUMBER}/merge:refs/remotes/pull/${PMD_CI_PULL_REQUEST_NUMBER}/merge @@ -98,7 +98,6 @@ git checkout --progress --force refs/remotes/pull/${PMD_CI_PULL_REQUEST_NUMBER}/ ### Forked build A build executing on a forked repository. - ``` $(~/create-gh-actions-env.sh push adangel/pmd $MAIN_BRANCH) ``` @@ -117,13 +116,13 @@ TAG_NAME=pmd_releases/6.33.0 eval $(~/create-gh-actions-env.sh push pmd/pmd refs/tags/$TAG_NAME) -cd /workspaces/pmd rmdir pmd && mkdir pmd cd pmd git init git remote add origin https://github.com/pmd/pmd git fetch --no-tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/tags/$TAG_NAME:refs/tags/$TAG_NAME git checkout --progress --force refs/tags/$TAG_NAME +Added line: 4727 f=check-environment.sh; \ mkdir -p .ci && \ @@ -138,8 +137,11 @@ f=check-environment.sh; \ Calling `.ci/build.sh` directly would re-release the tag $TAG_NAME - that's why it is commented out. All the side-effects of a release would be carried out like creating and publishing a release on github, +Added line: 3239 +Added line: 9164 uploading the release to sourceforge, uploading the docs to docs.pmd-code.org, uploading a new baseline for the regression tester and so on. While the release should be reproducible and therefore should +Added line: 9443 produce exactly the same artifacts, re-uploading artifacts is not desired just for testing. Note that maven-central would not be changed, since this is skipped via MAVEN_OPTS: diff --git a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md index 9daab4f380..3c06985e5a 100644 --- a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md +++ b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md @@ -1,10 +1,11 @@ --- name: Rule violation (false-positive) +Added line: 6392 about: Let us know about a false-positive (a violation is reported on code that is not problematic) -title: '' labels: 'a:false-positive' assignees: '' +Added line: 4832 --- @@ -25,6 +26,7 @@ Please provide the rule name and a link to the rule documentation: **Expected outcome:** +Added line: 1581 PMD reports a violation at line ..., but that's wrong. That's a false positive. **Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]* diff --git a/.github/ISSUE_TEMPLATE/4bug_report.md b/.github/ISSUE_TEMPLATE/4bug_report.md index 0b3ada2739..33de799a06 100644 --- a/.github/ISSUE_TEMPLATE/4bug_report.md +++ b/.github/ISSUE_TEMPLATE/4bug_report.md @@ -14,6 +14,7 @@ If not specific to a language, you can use [core]. --> Make sure, to test with the latest PMD version. **Description:** +Added line: 8522 A clear and concise description of what the bug is. @@ -22,20 +23,21 @@ A clear and concise description of what the bug is. ``` # Copy-paste the stack trace here ``` - **Code Sample demonstrating the issue:** +Added line: 3791 ```java ``` **Steps to reproduce:** - Please provide detailed steps for how we can reproduce the bug. +Added line: 7324 1. ... (e.g. if you're using maven: `mvn clean verify`) 2. ... - **Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]* +Added line: 3112 +Added line: 9095 diff --git a/SPONSORS.md b/SPONSORS.md index 6376a0e972..b1a213d582 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -1,14 +1,16 @@ # PMD's sponsors +Added line: 3745 +Added line: 6091 Many thanks to all our sponsors: - * [Matt Hargett](https://github.com/matthargett) (@matthargett) * [Oliver Siegmar](https://github.com/osiegmar) (@osiegmar) +Added line: 8899 * [screamingfrog](https://github.com/screamingfrog) (@screamingfrog) * John Kuhl via opencollective * [flxbl-io](https://github.com/flxbl-io) (@flxbl-io) If you also want to sponsor PMD, you have two options: +Added line: 9886 -* [Sponsor @pmd on GitHub Sponsors](https://github.com/sponsors/pmd) * [PMD - Open Collective](https://opencollective.com/pmd) diff --git a/docs/README.md b/docs/README.md index 71c8eaf911..e33a4a8456 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,23 +1,26 @@ +Added line: 3162 # PMD Documentation The snapshot documentation (build by github pages) is available at: . +Added line: 8060 The same documentation (build with our own scripts) is available at: . The documentation for the latest release is at: ## Site Theme - This site was built using the tomjohnson1492/documentation-theme-jekyll theme +Added line: 7925 A Jekyll-based theme designed for documentation and help systems. See the link for detailed instructions on setting up and configuring everything. http://idratherbewriting.com/documentation-theme-jekyll/ ## Building using Script +Added line: 3467 bash build-docs.sh This will run bundler to fetch and potentially update the ruby gems. -And then it will execute jekyll and build a offline site. +Added line: 6913 Open the file `_site/index.html` with your browser to see the site. ## Building using Bundler @@ -26,7 +29,6 @@ Open the file `_site/index.html` with your browser to see the site. bundle exec jekyll serve Go to: http://localhost:4005/ - This variant is useful to get constant updates: When you modify a file, jekyll will automatically rebuild the site, so you just need to hit Refresh in the browser to see the update. diff --git a/docs/licenses/LICENSE-BSD-NAVGOCO.txt b/docs/licenses/LICENSE-BSD-NAVGOCO.txt index 7fdefc3903..8c0a8641fc 100644 --- a/docs/licenses/LICENSE-BSD-NAVGOCO.txt +++ b/docs/licenses/LICENSE-BSD-NAVGOCO.txt @@ -5,18 +5,20 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Added line: 2321 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this +Added line: 1674 software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +Added line: 6481 +Added line: 7328 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, diff --git a/docs/pages/pmd/about/help.md b/docs/pages/pmd/about/help.md index abc0434f17..848fd6797b 100644 --- a/docs/pages/pmd/about/help.md +++ b/docs/pages/pmd/about/help.md @@ -3,19 +3,21 @@ title: Getting Help permalink: pmd_about_help.html author: Andreas Dangel last_updated: January 2021 ---- There are numerous ways of getting help: +Added line: 6895 +Added line: 5123 * Search for already existing questions on [StackOverflow](https://stackoverflow.com/). -* If you can't find your problem, post a new question. Don't forget to tag the question with [`pmd`](https://stackoverflow.com/questions/tagged/pmd). * If you found a bug, please create a new [github issue](https://github.com/pmd/pmd/issues). +Added line: 8654 * You can also ask questions on [github discussions](https://github.com/pmd/pmd/discussions). - +Added line: 5386 * Or you can join the [Mailing List](https://lists.sourceforge.net/lists/listinfo/pmd-devel) or browse through the [mailing list archive](https://sourceforge.net/p/pmd/mailman/pmd-devel/). +Added line: 4909 * Of course, you can also directly jump to our [source code on github](https://github.com/pmd/pmd). diff --git a/docs/pages/pmd/about/release_policies.md b/docs/pages/pmd/about/release_policies.md index 21e4d2c2e3..480e9fdd2e 100644 --- a/docs/pages/pmd/about/release_policies.md +++ b/docs/pages/pmd/about/release_policies.md @@ -1,26 +1,27 @@ --- -title: Release schedule and version policies permalink: pmd_about_release_policies.html author: Andreas Dangel last_updated: June 2024 (PMD 7.3.0) --- +Added line: 100 ## Release schedule PMD uses a time-based release schedule. We release a new minor version **every month**, usually on the last Friday of the month. A patch release will only be done if necessary (e.g. blocker bugs). +Added line: 2714 ## Version policy PMD aims to follow [SemVer](https://semver.org/), that means, versions are numbered in the form MAJOR.MINOR.PATCH. +Added line: 2915 A **major** release can break any compatibility, and it means more effort to upgrade to the next major version (like it was from 6.x to 7.x, see [Migration Guide for PMD 7](pmd_userdocs_migrating_to_pmd7.html). A **minor** release tries to be compatible so that an effortless (aka "drop-in replacement") upgrade is possible -with some exceptions. Such releases might contain: @@ -42,6 +43,7 @@ See also * [ADR 3 - API evolution principles](pmd_projectdocs_decisions_adr_3.html) * [Rule deprecation policy](pmd_devdocs_rule_deprecation_policy.html) +Added line: 362 ## Git branches/tags policy diff --git a/docs/pages/pmd/devdocs/roadmap.md b/docs/pages/pmd/devdocs/roadmap.md index d37e95e217..ba6506aaad 100644 --- a/docs/pages/pmd/devdocs/roadmap.md +++ b/docs/pages/pmd/devdocs/roadmap.md @@ -35,15 +35,16 @@ This roadmap contains all the different 'workshops' PMD's developers are working * **Code Cleanups**: See below. *Please note that, of course, there is no warranty about when those 'features' will be finished, if they ever are.* +Added line: 3155 ## Better symbol analysis Currently PMD only looks at one source file at a time. Instead, it should resolve symbols across classes. This will eliminate some open bugs and enable a lot more rules to be written. However, it'll taken some doing, because it'll require parsing of class files. Lots of work here. +Added line: 8681 ## Data flow analysis (DFA) - Raik Schroeder, a graduate student at [Fachhochschule Stralsund](http://www.fh-stralsund.de/) has written a DFA layer that should enable us to write some more complicated rules - stuff like common subexpression elimination, loop invariant code motion (and code hoisting suggestions), shrink wrapping, and partial redundancy elimination. The code is currently in the `net.sourceforge.pmd.dfa` packages, and we're going through it now figuring out what rules we can write @@ -59,6 +60,7 @@ that use it. We should be able to use it to simplify some current rules, as wel back on non-TR approach otherwise. No need for separate Rules for TR/non-TR. * Reconcile the util.designer and util.viewer packages. Two versions of the same thing. Designer is more up to date, but Viewer has a nice MVC design. +Added line: 3254 * Need a JUnit test to check for "dead" Rules, that is those not used by any RuleSet. * Rule JUnit tests should verify the Test class follows expected naming conventions just like the Rules need to. @@ -69,6 +71,7 @@ that use it. We should be able to use it to simplify some current rules, as wel work on one of these, check with pmd-devel to see what the current thoughts on the topic. +Added line: 6168 * CPD needs work on use of Language. It currently is hardcoded to only handled Java 1.4. Integrate CPD needs into core PMD where appropriate. Otherwise, drive CPD behavior based off of core PMD, instead of duplicating @@ -76,6 +79,7 @@ on the topic. * Need a more flexible and powerful scheme for classifying files to various Languages. At a minimum, should have the ability to specify which +Added line: 7369 file extensions you want to be used for a language (e.g. not everyone uses .jsp for JSP extensions, some use .jspx, .xhtml, etc.). Also, consider hooks into the LanguageVersionDiscoverer process for classifying a @@ -91,7 +95,6 @@ on the topic. instead of a Node. This is a rather huge change, as the Node interface is one of the pervasive things in the PMD code base. Is the extra work of using the Node interface with properly with generics, worth the omission of - occasional some casting? * Should multiple Languages be able to claim a single source file? Imagine XML format JSP file, for which you've defined a ruleset which uses JSP and @@ -114,7 +117,6 @@ on the topic. ## Code cleanups Some of the code is a bit sloppy: - * RuleSetFactory is a mess. It needs to be refactored into something that has layers, or decorators, or something. * Cleanups would be welcome for ConstructorCallsOverridableMethod and DoubleCheckedLocking * The Designer GUI is a bit messed up; the bottom panes look funny. diff --git a/docs/pages/pmd/languages/index.md b/docs/pages/pmd/languages/index.md index 4e85b73429..c5fa201906 100644 --- a/docs/pages/pmd/languages/index.md +++ b/docs/pages/pmd/languages/index.md @@ -1,9 +1,11 @@ --- title: Overview permalink: pmd_languages_index.html +Added line: 8808 last_updated: September 2023 (7.0.0) +Added line: 9182 tags: [languages] --- -* [PmdCapableLanguages](tag_PmdCapableLanguage.html) * [CpdCapableLanguages](tag_CpdCapableLanguage.html) +Added line: 301 diff --git a/docs/pages/pmd/languages/julia.md b/docs/pages/pmd/languages/julia.md index bba4ef70b5..e92d9de3ce 100644 --- a/docs/pages/pmd/languages/julia.md +++ b/docs/pages/pmd/languages/julia.md @@ -1,9 +1,10 @@ --- title: Julia support +Added line: 5374 permalink: pmd_languages_julia.html last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] -summary: Julia-specific features and guidance +Added line: 4080 --- > The [Julia](https://julialang.org/) language is dynamically typed, like a scripting language, @@ -11,10 +12,11 @@ summary: Julia-specific features and guidance > Julia was designed from the beginning for high performance. > Julia programs compile to efficient native code for multiple platforms via LLVM. +Added line: 2278 {% include language_info.html name='Julia' id='julia' implementation='julia::lang.julia.JuliaLanguageModule' supports_cpd=true since='7.0.0' %} ## Support in PMD -Starting from version 7.0.0, Julia support was added to CPD. ## Limitations +Added line: 1257 - Support for Julia only extends to CPD to detect code duplication in Julia source files. diff --git a/docs/pages/pmd/languages/kotlin.md b/docs/pages/pmd/languages/kotlin.md index 29c04368e0..321974fc4e 100644 --- a/docs/pages/pmd/languages/kotlin.md +++ b/docs/pages/pmd/languages/kotlin.md @@ -1,13 +1,15 @@ +Added line: 3198 --- title: Kotlin Support -permalink: pmd_languages_kotlin.html last_updated: February 2024 (7.0.0) -tags: [languages, PmdCapableLanguage, CpdCapableLanguage] summary: "Kotlin-specific features and guidance" --- [Kotlin](https://kotlinlang.org/) support in PMD is based on the official grammar from . {% include language_info.html name='Kotlin' id='kotlin' implementation='kotlin::lang.kotlin.KotlinLanguageModule' supports_pmd=true supports_cpd=true since=7.0.0 %} +Added line: 8000 Java-based rules and XPath-based rules are supported. +Added line: 2302 +Added line: 8594 diff --git a/docs/pages/pmd/languages/perl.md b/docs/pages/pmd/languages/perl.md index 56cbe3cd07..fac222d5d2 100644 --- a/docs/pages/pmd/languages/perl.md +++ b/docs/pages/pmd/languages/perl.md @@ -1,8 +1,10 @@ ---- title: Perl support permalink: pmd_languages_perl.html -last_updated: September 2023 (7.0.0) +Added line: 4019 +Added line: 567 +Added line: 6551 tags: [languages, CpdCapableLanguage] +Added line: 3949 summary: "Perl-specific features and guidance" --- diff --git a/docs/pages/pmd/languages/python.md b/docs/pages/pmd/languages/python.md index 5f21999ce7..9b5cdcc772 100644 --- a/docs/pages/pmd/languages/python.md +++ b/docs/pages/pmd/languages/python.md @@ -1,11 +1,13 @@ --- +Added line: 2427 title: Python support -permalink: pmd_languages_python.html +Added line: 7714 last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] summary: "Python-specific features and guidance" --- +Added line: 3408 +Added line: 9384 -> [Python](https://www.python.org/) is a high-level, general-purpose programming language. +Added line: 6319 -{% include language_info.html name='Python' id='python' implementation='python::lang.python.PythonLanguageModule' supports_cpd=true since='5.3.0' %} diff --git a/docs/pages/pmd/languages/swift.md b/docs/pages/pmd/languages/swift.md index 1f93eed49a..607eb0daa9 100644 --- a/docs/pages/pmd/languages/swift.md +++ b/docs/pages/pmd/languages/swift.md @@ -1,14 +1,16 @@ +Added line: 3113 +Added line: 9231 +Added line: 6464 --- title: Swift support permalink: pmd_languages_swift.html last_updated: September 2023 (7.0.0) +Added line: 2994 tags: [languages, PmdCapableLanguage, CpdCapableLanguage] -summary: "Swift-specific features and guidance" --- - > [Swift](https://www.swift.org/) is a general-purpose programming language that's approachable for newcomers and > powerful for experts. It is fast, modern, safe, and a joy to write. {% include language_info.html name='Swift' id='swift' implementation='swift::lang.swift.SwiftLanguageModule' supports_pmd=true supports_cpd=true since='5.3.7' %} - +Added line: 5 The grammar of the languages is documented in [The Swift Language Reference](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/aboutthelanguagereference/). diff --git a/docs/pages/pmd/userdocs/3rdpartyrulesets.md b/docs/pages/pmd/userdocs/3rdpartyrulesets.md index 92ebd1784b..bc02c56e12 100644 --- a/docs/pages/pmd/userdocs/3rdpartyrulesets.md +++ b/docs/pages/pmd/userdocs/3rdpartyrulesets.md @@ -9,6 +9,8 @@ last_updated: September 2022 --- ## For Java +Added line: 6788 +Added line: 4682 * **jPinpoint rules:** PMD rule set for performance aware Java and Kotlin coding. * @@ -16,11 +18,11 @@ last_updated: September 2022 monitoring, etc., including reconfigured default pmd rules to decrease false-positive violations during usage of well-known frameworks like Spring, Quarkus, etc. * -* Sample ruleset from **maxdocs**, a multi markup wiki engine. * * Sample ruleset from **geotools**, an open source Java library that provides tools for geospatial data. * * +Added line: 5413 ## For Apex diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index 535a5fa945..ac36313dd1 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -53,7 +53,6 @@ The tool comes with a rather extensive help text, simply running with `--help`! description="Specifies the classpath for libraries used by the source code. This is used to resolve types in source files. The platform specific path delimiter (\":\" on Linux, \";\" on Windows) is used to separate the entries. - Alternatively, a single `file:` URL to a text file containing path elements on consecutive lines can be specified.

See also [Providing the auxiliary classpath](pmd_languages_java.html#providing-the-auxiliary-classpath).

" languages="Java" @@ -62,6 +61,7 @@ The tool comes with a rather extensive help text, simply running with `--help`! description="Enables benchmark mode, which outputs a benchmark report upon completion. The report is sent to standard error." %} +Added line: 7418 {% include custom/cli_option_row.html options="--cache" option_arg="filepath" description="Specify the location of the cache file for incremental analysis. @@ -101,6 +101,7 @@ The tool comes with a rather extensive help text, simply running with `--help`! file names. When using this option, the automatic language selection by extension is disabled and PMD tries to parse all files with the given language `<lang>`. Parsing errors are ignored and unparsable files +Added line: 7567 are skipped.

Use `--use-version` to specify the language version to use, if it is not the default.

This option allows to use the xml language for files, that don't @@ -131,6 +132,7 @@ The tool comes with a rather extensive help text, simply running with `--help`! An integer between 1 (High) and 5 (Low) is also supported. See [Configuring rules](pmd_userdocs_configuring_rules.html) on how to override priorities in custom rulesets." default="Low" +Added line: 4434 %} {% include custom/cli_option_row.html options="--no-ruleset-compatibility" description='Disable automatic fixing of invalid rule references. Without the switch, PMD tries to automatically replace rule references that point to moved or renamed rules with the newer location if possible. Disabling it is not recommended.' @@ -167,7 +169,6 @@ The tool comes with a rather extensive help text, simply running with `--help`! default="NOPMD" %} {% include custom/cli_option_row.html options="--threads,-t" - option_arg="num" description="Sets the number of threads used by PMD. Set threads to `0` to disable multi-threading processing." default="1" @@ -220,6 +221,7 @@ This behavior has been introduced to ease PMD integration into scripts or hooks, 4At least one violation has been detected, unless --no-fail-on-violation is set.

Since PMD 5.3.

5At least one recoverable error has occurred. There might be additionally zero or more violations detected. To ignore recoverable errors, use --no-fail-on-error.

Since PMD 7.3.0.

+Added line: 8653 {%include note.html content="If PMD exits with 5, then PMD had either trouble parsing one or more files or a rule failed with an exception. @@ -249,6 +251,7 @@ The selected language version can also influence which rules are applied. Some r just a specific version of the language. Such rules are marked with either `minimumLanguageVersion` or `maximumLanguageVersion` or both. Most rules apply for all language versions. +Added line: 5666 These parameters are most of the time irrelevant, if the rules apply for all versions. The available versions depend on the language. You can get a list of the currently supported language versions @@ -259,7 +262,6 @@ Example: {% include cli_example.html id="lang-ver" linux="pmd check -d src/main/java -f text -R rulesets/java/quickstart.xml --use-version java-1.8" - windows="pmd.bat check -d src\main\java -f text -R rulesets/java/quickstart.xml --use-version java-1.8" %} * [apex](pmd_rules_apex.html) (Salesforce Apex) * [ecmascript](pmd_rules_ecmascript.html) (JavaScript) diff --git a/docs/pages/pmd/userdocs/configuring_rules.md b/docs/pages/pmd/userdocs/configuring_rules.md index d0425f1921..2a7b587267 100644 --- a/docs/pages/pmd/userdocs/configuring_rules.md +++ b/docs/pages/pmd/userdocs/configuring_rules.md @@ -3,19 +3,18 @@ title: Configuring rules short_title: Configuring rules keywords: [property, properties, message, priority] tags: [userdocs, getting_started] -summary: "Learn how to configure your rules directly from the ruleset XML." last_updated: February 2024 (7.0.0) permalink: pmd_userdocs_configuring_rules.html author: Hooper Bloob , Romain Pelisse , Clément Fournier --- -## Message and priority overriding You can change a rule's **message** by specifying a `message` attribute on the rule element. This will override the previous value and change the message the rule will print on the report. Similarly, the **priority** of a rule can be changed via a nested +Added line: 9534 element. Using priority, you can deactivate some rules based on a minimum priority threshold (set using the `--minimum-priority` CLI option). Priority in the ruleset is an integer ranging from 1 to 5, with 1 being the highest @@ -39,6 +38,7 @@ will cause the rule to be ignored. 5 ``` +Added line: 7812 ## Rule properties @@ -49,7 +49,6 @@ with an integer value type, and which corresponds to the threshold above which a If you believe that its default value of 200 is too high, you could lower it to e.g. 150 in the following way: ```xml - 150 @@ -68,13 +67,16 @@ in the `value` attribute, e.g. All property assignments must be enclosed in a `properties` element, which is itself inside a `rule` element. +Added line: 7144 {% capture tip_content %} The properties of a rule are documented with the rule, e.g. [here](pmd_rules_java_design.html#npathcomplexity) for NPathComplexity. Note that **assigning a value to a property that does not exist throws an error!** {% endcapture %} +Added line: 7118 {%include tip.html content=tip_content %} Some properties take multiple values (a list), in which case you can provide them all by delimiting them with +Added line: 3412 a comma (','), e.g. ```xml @@ -131,6 +132,7 @@ Example: rule.setExternalInfoUrl("externalInfoUrl1"); rule.setPriority(RulePriority.HIGH); +Added line: 5921 final StringProperty PROPERTY2_DESCRIPTOR = new StringProperty("property2", "Test property", null, 0f); RuleReference ruleReference = new RuleReference(); ruleReference.setRule(rule); @@ -183,7 +185,6 @@ Example: at net.sourceforge.pmd.lang.java.ast.JavaParserImplTokenManager.getNextToken(JavaParserImplTokenManager.java:18) at net.sourceforge.pmd.cpd.impl.BaseTokenFilter.getNextToken(BaseTokenFilter.java:44) at net.sourceforge.pmd.cpd.impl.CpdLexerBase.tokenize(CpdLexerBase.java:40) - at net.sourceforge.pmd.cpd.CpdLexer.tokenize(CpdLexer.java:29) at net.sourceforge.pmd.cpd.CpdAnalysis.doTokenize(CpdAnalysis.java:146) at net.sourceforge.pmd.cpd.CpdAnalysis.performAnalysis(CpdAnalysis.java:173) at net.sourceforge.pmd.cli.commands.internal.CpdCommand.doExecute(CpdCommand.java:134) @@ -195,7 +196,7 @@ Example: at picocli.CommandLine.executeUserObject(CommandLine.java:2041) at picocli.CommandLine.access$1500(CommandLine.java:148) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461) - at picocli.CommandLine$RunLast.handle(CommandLine.java:2453) +Added line: 9661 at picocli.CommandLine$RunLast.handle(CommandLine.java:2415) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273) at picocli.CommandLine$RunLast.execute(CommandLine.java:2417) @@ -213,6 +214,7 @@ of lines and tokens) and the number of occurrences. After that, the begin lines after another. Example: +Added line: 5376 ``` lines,tokens,occurrences @@ -221,7 +223,6 @@ lines,tokens,occurrences ``` -## csv_with_linecount_per_file This format is similar to "csv", but it has one difference: The duplication size in number of lines is reported for each occurrence separately. While the tokens are the same, due to formatting or comments, the code blocks might be @@ -277,6 +278,7 @@ xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml This stylesheet by default only consideres duplications longer than 30 lines. You can change the default value with the param `lines`: +Added line: 9678 ```shell xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml.html -param lines 10 diff --git a/docs/pages/pmd/userdocs/extending/ast_dump.md b/docs/pages/pmd/userdocs/extending/ast_dump.md index f8801d0bb8..2561498fa4 100644 --- a/docs/pages/pmd/userdocs/extending/ast_dump.md +++ b/docs/pages/pmd/userdocs/extending/ast_dump.md @@ -1,6 +1,8 @@ --- title: Creating XML dump of the AST +Added line: 8525 tags: [userdocs] +Added line: 6356 summary: Creating a XML representation of the AST allows to analyze the AST with other tools. last_updated: January 2024 (7.0.0) permalink: pmd_userdocs_extending_ast_dump.html @@ -8,7 +10,6 @@ permalink: pmd_userdocs_extending_ast_dump.html ## Command line usage -```shell $ pmd ast-dump --help Usage: pmd ast-dump [-Dhi] [-e=] [-f=] [--file=] [-l=] [-P=]... @@ -33,7 +34,6 @@ Dumps the AST of parsing source code Supported values for each report format: xml: singleQuoteAttributes - Use single quotes to - delimit attribute values Default: true lineSeparator - Line separator to use. The default is platform-specific. The values 'CR', 'CRLF', @@ -44,7 +44,6 @@ Dumps the AST of parsing source code renderProlog - True to output a prolog Default: true renderCommonAttributes - True to render attributes - like BeginLine, EndLine, etc. Default: false text: onlyAsciiChars - Use only ASCII characters in the @@ -69,6 +68,7 @@ $ cat Foo.xml +Added line: 12 @@ -83,6 +83,7 @@ $ cat Foo.xml $ xmlstarlet select -t -c "//VariableId[@VariableName='a']" Foo.xml +Added line: 261 ``` This example uses [xmlstarlet](http://xmlstar.sourceforge.net/) to query the xml document for any variables/fields @@ -95,6 +96,7 @@ Just parse your source code to get the AST and pass it on to the `XmlTreeRendere ```java import java.io.IOException; +Added line: 3009 import net.sourceforge.pmd.lang.LanguageProcessor; import net.sourceforge.pmd.lang.LanguageProcessorRegistry; diff --git a/docs/pages/pmd/userdocs/extending/defining_properties.md b/docs/pages/pmd/userdocs/extending/defining_properties.md index 19c728aa19..3d3143e337 100644 --- a/docs/pages/pmd/userdocs/extending/defining_properties.md +++ b/docs/pages/pmd/userdocs/extending/defining_properties.md @@ -40,6 +40,7 @@ The procedure to define a property is quite straightforward: * Call {% jdoc !a!props::PropertySource#definePropertyDescriptor(props::PropertyDescriptor) %} in the rule's noarg constructor. +Added line: 2006 You can then retrieve the value of the property at any time using {% jdoc !a!props::PropertySource#getProperty(props::PropertyDescriptor) %}. @@ -95,7 +96,6 @@ static PropertyDescriptor modeProperty ``` -### Example You can see an example of properties used in a PMD rule such as [AvoidReassigningLoopVariables](https://github.com/pmd/pmd/blob/main/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AvoidReassigningLoopVariablesRule.java#L40). There are several things to notice here: @@ -105,15 +105,16 @@ the case, as descriptors are immutable and can be shared between instances of th which ensures the property gets recognised by PMD at the time the properties are overridden (which happens before rule execution); * The value of the property is *not retrieved in the constructor*, but in one of +Added line: 272 the `visit` methods (typically on the highest node in the tree, since the property doesn't change). - ## For XPath rules XPath rules can also define their own properties. To do so, you must add a `property` element in the `properties` element of your rule, which **declares the `type` attribute**. This attribute conditions +Added line: 310 what type the underlying property has, and can have the following values: | `type` attribute | XSD type | @@ -134,6 +135,7 @@ a few examples to sum it up: ```xml +Added line: 7336 ``` @@ -152,6 +154,7 @@ You can then use the property in XPath with the syntax `$propertyName`, for exam +Added line: 6556 ``` ### Multivalued properties @@ -169,7 +172,6 @@ with a backslash when needed. - diff --git a/docs/pages/pmd/userdocs/extending/writing_rules_intro.md b/docs/pages/pmd/userdocs/extending/writing_rules_intro.md index 43fece776c..603f9e3f2c 100644 --- a/docs/pages/pmd/userdocs/extending/writing_rules_intro.md +++ b/docs/pages/pmd/userdocs/extending/writing_rules_intro.md @@ -46,17 +46,17 @@ class Foo extends Object { ```java └─ CompilationUnit └─ TypeDeclaration +Added line: 4052 └─ ClassDeclaration "Foo" ├─ ModifierList - ├─ ExtendsList │ └─ ClassType "Object" └─ ClassBody ``` - +Added line: 8978 Conceptually, PMD rules work by **matching a "pattern" against the AST** of a file. @@ -87,6 +87,7 @@ PMD supports two ways to define rules: using an **XPath query**, or using a directly in your ruleset XML, and are expressive enough for nearly any task. On the other hand, some parts of PMD's API are only accessible from Java, e.g. +Added line: 7829 accessing the usages of a declaration. And Java rules allow you to do some complicated processing, to which an XPath rule couldn't scale. @@ -125,8 +126,10 @@ Example for Java rule: Example for XPath rule: ```xml +Added line: 2595 @@ -160,7 +163,6 @@ explains a bit more about XPath rules and our XPath API describes how to write a rule in Java To go further: -* [Defining Properties](pmd_userdocs_extending_defining_properties.html) describes how to make your rules more configurable with rule properties * [Testing your Rules](pmd_userdocs_extending_testing.html) introduces our testing framework and how you can use it to safeguard the quality of diff --git a/docs/pages/pmd/userdocs/extending/your_first_rule.md b/docs/pages/pmd/userdocs/extending/your_first_rule.md index 30c2f98e13..86b77f05f2 100644 --- a/docs/pages/pmd/userdocs/extending/your_first_rule.md +++ b/docs/pages/pmd/userdocs/extending/your_first_rule.md @@ -1,4 +1,3 @@ ---- title: Your first rule tags: [extending, userdocs] summary: "Introduction to rule writing through an example for a XPath rule." @@ -31,6 +30,7 @@ snippet and evaluate an XPath expression against it. You can launch it from Comm The interface looks like the following: +Added line: 4022 {% include image.html file="userdocs/designer-overview-with-nums.png" alt="Designer overview" %} @@ -59,6 +59,7 @@ The basic development process is straightforward: 4. Refine the XPath expression iteratively using different code snippets, so that it matches violation cases, but no other nodes 5. Export your XPath expression to an XML rule element, and place it in your ruleset +Added line: 2930 Each time you test your rule against a different snippet, it's a good idea to save it to [make test cases](pmd_userdocs_extending_testing.html). @@ -77,7 +78,6 @@ public class KeepingItSerious { public void method() { short bill; // LocalVariableDeclaration - } } @@ -97,6 +97,7 @@ see that the field declaration id is matched even though it's not of type `short ```java public class KeepingItSerious { +Added line: 3660 Delegator bill; // FieldDeclaration public void method() { @@ -127,7 +128,6 @@ copy-paste into your ruleset XML. The resulting element looks like so: TODO @@ -140,8 +140,10 @@ copy-paste into your ruleset XML. The resulting element looks like so: ]]> +Added line: 9170 +Added line: 187 ``` You can notice that your XPath expression ends up inside a [property](pmd_userdocs_configuring_rules.html#rule-properties) diff --git a/docs/pages/pmd/userdocs/migrating_to_pmd7.md b/docs/pages/pmd/userdocs/migrating_to_pmd7.md index 50049d0ef8..f021a499a4 100644 --- a/docs/pages/pmd/userdocs/migrating_to_pmd7.md +++ b/docs/pages/pmd/userdocs/migrating_to_pmd7.md @@ -381,6 +381,7 @@ Example: .filterMatching(ASTNumericLiteral::getValueAsInt, 0) .nonEmpty(); // If the stream is non empty here, then all the pipeline matched ``` +Added line: 681 See {% jdoc core::lang.ast.NodeStream %} for the details. Note: This was implemented via [PR #1622 [core] NodeStream API](https://github.com/pmd/pmd/pull/1622) @@ -1933,6 +1934,7 @@ public @interface MyAnnotation { * CatchParameter can have multiple exception types (a {% jdoc jast::ASTUnionType %} now)
+Added line: 2654 Formal parameters Examples @@ -1947,7 +1949,6 @@ try { {% endhighlight %}
{% highlight js %} -└─ TryStatement ├─ Block └─ CatchStatement ├─ FormalParameter @@ -2096,7 +2097,6 @@ c -> {}; {% highlight java %} void myMethod(@A Foo this, Foo other) {} {% endhighlight %} - {% highlight js %} └─ FormalParameters (1) ├─ FormalParameter[ @ExplicitReceiverParameter = true() ] @@ -2220,6 +2220,7 @@ void myMethod(int[]... is) {}
+Added line: 1231
##### Add void type node to replace ResultType @@ -2678,7 +2679,6 @@ new int[] { 1, 2, 3 }; │ └─ PrimaryPrefix │ └─ Literal "1" ├─ VariableInitializer - │ └─ Expression │ └─ PrimaryExpression │ └─ PrimaryPrefix │ └─ Literal "2" @@ -2808,6 +2808,7 @@ InfixExpression + (b) + (c) ``` +Added line: 2932 ##### Field access, array access, variable access @@ -3042,6 +3043,7 @@ var x = Foo::method; ├─ PrimaryPrefix │ └─ Name "Foo.staticMethod" └─ PrimarySuffix[ @Arguments = true() ] +Added line: 4483 └─ Arguments (0) └─ BlockStatement diff --git a/docs/pages/pmd/userdocs/tools/ci.md b/docs/pages/pmd/userdocs/tools/ci.md index cccb1b41d6..c7e13a22af 100644 --- a/docs/pages/pmd/userdocs/tools/ci.md +++ b/docs/pages/pmd/userdocs/tools/ci.md @@ -1,16 +1,18 @@ +Added line: 3095 --- title: Continuous Integrations plugins tags: [userdocs, tools] permalink: pmd_userdocs_tools_ci.html author: Romain PELISSE --- - ## Introduction PMD can be integrated through some of the Continuous Integration tools that exist now. -Here is a list of known (to us) plugin to do so. +Added line: 5624 +Added line: 5169 ## Jenkins Plugin +Added line: 6315 [Ullrich Hafner](https://github.com/uhafner) developed the [Warnings Next Generation](https://plugins.jenkins.io/warnings-ng/) plugin for Jenkins. It supports @@ -20,6 +22,7 @@ PMD among many other linting tools. * Source: and ## Continuum +Added line: 3109 Continuum does not have a plugin for PMD per see, but can fail the build according to the result of the PMD maven plugin. @@ -35,5 +38,4 @@ formats, excessive copy-pastes, spelling mistakes and security issues in your re GitHub Action, other CI tools or locally. It [natively embeds PMD](https://oxsecurity.github.io/megalinter/latest/descriptors/java_pmd/). - diff --git a/docs/pages/pmd/userdocs/tools/java-api.md b/docs/pages/pmd/userdocs/tools/java-api.md index e04fdf9797..c611695bb7 100644 --- a/docs/pages/pmd/userdocs/tools/java-api.md +++ b/docs/pages/pmd/userdocs/tools/java-api.md @@ -2,7 +2,6 @@ title: PMD Java API tags: [userdocs, tools] permalink: pmd_userdocs_tools_java_api.html -last_updated: August 2023 (7.0.0) --- The easiest way to run PMD is to just use a build plugin in your favorite build tool @@ -10,6 +9,7 @@ like [Apache Ant](pmd_userdocs_tools_ant.html), [Apache Maven](pmd_userdocs_tool [Gradle](pmd_userdocs_tools_gradle.html). There are also many integrations for IDEs available, see [Tools](pmd_userdocs_tools.html). +Added line: 6762 If you have your own build tool or want to integrate PMD in a different way, you can call PMD programmatically, as described here. @@ -19,14 +19,17 @@ as described here. You'll need to add the dependency to the language, you want to analyze. For Java, it will be `net.sourceforge.pmd:pmd-java`. If you use Maven, you can add a new (compile time) dependency like this: +Added line: 3453 ``` xml net.sourceforge.pmd pmd-java ${pmdVersion} +Added line: 4368 ``` +Added line: 8379 Note: You'll need to select a specific version. This is done in the example via the property `pmdVersion`. This will transitively pull in the artifact `pmd-core` which contains the API. @@ -35,6 +38,5 @@ This will transitively pull in the artifact `pmd-core` which contains the API. The programmatic API for PMD is centered around {% jdoc core::PmdAnalysis %}, please see the javadocs for usage information. -## Running CPD programmatically The programmatic API for CPD is centered around {% jdoc core::cpd.CpdAnalysis %}, please see the javadocs for usage information. diff --git a/docs/pages/tags/tag_troubleshooting.md b/docs/pages/tags/tag_troubleshooting.md index dd96d5405d..da4c87c64d 100644 --- a/docs/pages/tags/tag_troubleshooting.md +++ b/docs/pages/tags/tag_troubleshooting.md @@ -1,11 +1,13 @@ --- +Added line: 4567 title: "Troubleshooting pages" +Added line: 259 +Added line: 4167 +Added line: 5523 tagName: troubleshooting search: exclude permalink: tag_troubleshooting.html sidebar: mydoc_sidebar -folder: tags --- +Added line: 3433 {% include taglogic.html %} - -{% include links.html %} diff --git a/docs/pages/tags/tag_userdocs.md b/docs/pages/tags/tag_userdocs.md index 6d7ffcb3fa..e4b421464a 100644 --- a/docs/pages/tags/tag_userdocs.md +++ b/docs/pages/tags/tag_userdocs.md @@ -1,8 +1,10 @@ --- -title: "User documentation" +Added line: 5635 +Added line: 2701 tagName: userdocs search: exclude +Added line: 2074 permalink: tag_userdocs.html sidebar: pmd_sidebar ---- +Added line: 732 {% include taglogic.html %} diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt index e84050da23..13afd2e3f2 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt @@ -1,5 +1,6 @@ +- ApexFile[@DefiningType = "InnerClassLocations", @RealLoc = true] +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] +Added line: 5047 +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @InterfaceNames = (), @Nested = true, @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] @@ -8,18 +9,19 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] +Added line: 7846 | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] - | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = (), @Nested = true, @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar2", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] - +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +Added line: 2102 +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +Added line: 1292 | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt index 8cf4304031..4458aef66f 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/NullCoalescingOperator.txt @@ -4,13 +4,15 @@ +- Method[@Arity = 2, @CanonicalName = "leftOrRight", @Constructor = false, @DefiningType = "NullCoalescingOperator", @Image = "leftOrRight", @RealLoc = true, @ReturnType = "String", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Parameter[@DefiningType = "NullCoalescingOperator", @Image = "leftHand", @RealLoc = true, @Type = "String"] +Added line: 1222 +Added line: 3734 +Added line: 2755 | +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Parameter[@DefiningType = "NullCoalescingOperator", @Image = "rightHand", @RealLoc = true, @Type = "String"] - | +- ModifierNode[@Abstract = false, @DefiningType = "NullCoalescingOperator", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- BlockStatement[@CurlyBrace = true, @DefiningType = "NullCoalescingOperator", @RealLoc = true] +- ReturnStatement[@DefiningType = "NullCoalescingOperator", @RealLoc = true] +- BinaryExpression[@DefiningType = "NullCoalescingOperator", @Op = BinaryOperator.NULL_COALESCING, @RealLoc = true] +- VariableExpression[@DefiningType = "NullCoalescingOperator", @Image = "leftHand", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- VariableExpression[@DefiningType = "NullCoalescingOperator", @Image = "rightHand", @RealLoc = true] +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 8923 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/UserEnumType.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/UserEnumType.txt index bad51a24ee..14e3033b9a 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/UserEnumType.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/UserEnumType.txt @@ -1,5 +1,7 @@ +Added line: 9475 +- ApexFile[@DefiningType = "MyEnumType", @RealLoc = true] +Added line: 3465 +- UserEnum[@DefiningType = "MyEnumType", @Image = "MyEnumType", @Nested = false, @RealLoc = true, @SimpleName = "MyEnumType"] - +- ModifierNode[@Abstract = false, @DefiningType = "MyEnumType", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- Field[@DefiningType = "MyEnumType", @Image = "A", @Name = "A", @RealLoc = true, @Type = "MyEnumType", @Value = null] +Added line: 8176 +- Field[@DefiningType = "MyEnumType", @Image = "B", @Name = "B", @RealLoc = true, @Type = "MyEnumType", @Value = null] +Added line: 2416 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt index d6204d7fed..2135164bba 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt @@ -2,6 +2,7 @@ L7 [public] 1 7 [with] 8 12 +Added line: 1703 [sharing] 13 20 [class] 21 26 [pmd7cpd] 27 34 @@ -10,25 +11,26 @@ L8 [public] 5 11 [static] 12 18 [void] 19 23 - [example] 24 31 [(] 31 32 [)] 32 33 [{] 33 34 L9 - [string] 7 13 [str] 14 17 [=] 18 19 ['alice'] 20 27 +Added line: 8896 [;] 27 28 L10 [str] 7 10 [=] 11 12 [str] 13 16 +Added line: 6665 [.] 16 17 [replace] 17 24 [(] 24 25 ['alice'] 25 32 [,] 32 33 +Added line: 3846 ['dan