diff --git a/.all-contributorsrc b/.all-contributorsrc index 3ce273cee4..28d946f30a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -7753,7 +7753,8 @@ "profile": "https://github.com/dschach", "contributions": [ "bug", - "code" + "code", + "doc" ] }, { @@ -7782,6 +7783,42 @@ "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" + ] } ], "contributorsPerLine": 7, diff --git a/.ci/README.md b/.ci/README.md index 6286fd14b4..b2ce6f60b8 100644 --- a/.ci/README.md +++ b/.ci/README.md @@ -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 diff --git a/.ci/build.sh b/.ci/build.sh index 4e843d4311..cd5200588a 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -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/ diff --git a/.ci/inc/fetch_ci_scripts.bash b/.ci/inc/fetch_ci_scripts.bash index d608e40531..835fe6782e 100644 --- a/.ci/inc/fetch_ci_scripts.bash +++ b/.ci/inc/fetch_ci_scripts.bash @@ -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}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f4bc12a42..c98a1196bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | diff --git a/.github/workflows/git-repo-sync.yml b/.github/workflows/git-repo-sync.yml index e4413efb3f..7665bc6d3b 100644 --- a/.github/workflows/git-repo-sync.yml +++ b/.github/workflows/git-repo-sync.yml @@ -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 diff --git a/.github/workflows/troubleshooting.yml b/.github/workflows/troubleshooting.yml index 737c1a7ea8..91351ed96f 100644 --- a/.github/workflows/troubleshooting.yml +++ b/.github/workflows/troubleshooting.yml @@ -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: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b4fe5f9d27..1622cb421f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 . 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: . You can find build instructions there. +The documentation is generated as a Jekyll site, the source is available at: . You can find build instructions there. For more on contributing documentation check ## 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 diff --git a/Dangerfile b/Dangerfile index 97e38cf3c3..dea08b6960 100644 --- a/Dangerfile +++ b/Dangerfile @@ -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 diff --git a/Gemfile b/Gemfile index 441384af04..6fccc49416 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 9a7014556a..b8adad7272 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,7 +70,7 @@ GEM rchardet (1.8.0) rexml (3.3.6) strscan - rouge (4.3.0) + rouge (4.4.0) rufus-scheduler (3.9.1) fugit (~> 1.1, >= 1.1.6) safe_yaml (1.0.5) diff --git a/README.md b/README.md index a08c66d76c..8d215b233a 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/do-release.sh b/do-release.sh index 64435f8622..3440db6fc5 100755 --- a/do-release.sh +++ b/do-release.sh @@ -311,7 +311,7 @@ echo " " +echo "" echo echo "Press enter to continue when pmd-designer is available in maven-central..." echo "." diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 3f44ef4782..a8439253e3 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -264,7 +264,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (1.8.0) uri (0.13.1) - webrick (1.8.1) + webrick (1.8.2) PLATFORMS x86_64-linux diff --git a/docs/_config.yml b/docs/_config.yml index 372d019c17..912d463cc1 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,9 +1,9 @@ repository: pmd/pmd pmd: - version: 7.6.0-SNAPSHOT - previous_version: 7.5.0 - date: 2024-09-27 + version: 7.7.0-SNAPSHOT + previous_version: 7.6.0 + date: 2024-10-25 # 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 diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index 148ef1624f..babf53daf7 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -524,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 diff --git a/docs/pages/pmd/about/release_policies.md b/docs/pages/pmd/about/release_policies.md index f7a8fc9aea..21e4d2c2e3 100644 --- a/docs/pages/pmd/about/release_policies.md +++ b/docs/pages/pmd/about/release_policies.md @@ -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. diff --git a/docs/pages/pmd/devdocs/development.md b/docs/pages/pmd/devdocs/development.md index ad4871fc73..46a850ef47 100644 --- a/docs/pages/pmd/devdocs/development.md +++ b/docs/pages/pmd/devdocs/development.md @@ -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). diff --git a/docs/pages/pmd/devdocs/major_contributions/adding_a_new_antlr_based_language.md b/docs/pages/pmd/devdocs/major_contributions/adding_a_new_antlr_based_language.md index 46ab65c523..e1427c93a3 100644 --- a/docs/pages/pmd/devdocs/major_contributions/adding_a_new_antlr_based_language.md +++ b/docs/pages/pmd/devdocs/major_contributions/adding_a_new_antlr_based_language.md @@ -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 module’s constructor. Use `addDefaultVersion` for defining the default version. * You’ll 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 diff --git a/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md b/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md index 2cf623881e..5588cabbdf 100644 --- a/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md +++ b/docs/pages/pmd/devdocs/major_contributions/adding_new_cpd_language.md @@ -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 `` 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 diff --git a/docs/pages/pmd/devdocs/pmdtester.md b/docs/pages/pmd/devdocs/pmdtester.md index 208d11dd34..4c29da2a59 100644 --- a/docs/pages/pmd/devdocs/pmdtester.md +++ b/docs/pages/pmd/devdocs/pmdtester.md @@ -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) diff --git a/docs/pages/pmd/devdocs/writing_documentation.md b/docs/pages/pmd/devdocs/writing_documentation.md index 53c7be347f..5c27b940fa 100644 --- a/docs/pages/pmd/devdocs/writing_documentation.md +++ b/docs/pages/pmd/devdocs/writing_documentation.md @@ -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 diff --git a/docs/pages/pmd/languages/java.md b/docs/pages/pmd/languages/java.md index b69204caa7..e4a7fe05cd 100644 --- a/docs/pages/pmd/languages/java.md +++ b/docs/pages/pmd/languages/java.md @@ -199,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). diff --git a/docs/pages/pmd/projectdocs/committers/main_landing_page.md b/docs/pages/pmd/projectdocs/committers/main_landing_page.md index 8ad63c686f..4c9e4ec0be 100644 --- a/docs/pages/pmd/projectdocs/committers/main_landing_page.md +++ b/docs/pages/pmd/projectdocs/committers/main_landing_page.md @@ -18,15 +18,15 @@ It usually takes 15 minutes. ## Contents * Main page - aka "Landing page": - * 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": - * 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 diff --git a/docs/pages/pmd/projectdocs/committers/merging_pull_requests.md b/docs/pages/pmd/projectdocs/committers/merging_pull_requests.md index a450ff882d..ebd8779f36 100644 --- a/docs/pages/pmd/projectdocs/committers/merging_pull_requests.md +++ b/docs/pages/pmd/projectdocs/committers/merging_pull_requests.md @@ -5,7 +5,7 @@ last_updated: October 2021 author: Andreas Dangel --- -## 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 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 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 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 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 ## 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.
+up in the main branch and therefore in any future version of PMD.
The downside is however, that there are inevitable merge conflicts for the maven `pom.xml` files, since every branch changed the version number differently.
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. diff --git a/docs/pages/pmd/projectdocs/committers/releasing.md b/docs/pages/pmd/projectdocs/committers/releasing.md index 3bb05898df..11365d7333 100644 --- a/docs/pages/pmd/projectdocs/committers/releasing.md +++ b/docs/pages/pmd/projectdocs/committers/releasing.md @@ -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 " $ 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}" <" $ git push @@ -259,7 +259,7 @@ Here is, what happens: under . The release on GitHub Actions currently takes about 30-45 minutes. Once this is done, you -can proceed with releasing pmd designer, see . +can proceed with releasing pmd designer, see . 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 and on sourceforge. diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index d12aa44801..4795947746 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -226,7 +226,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d David M. Karr (fullname at gmail.com)
David M. Karr (fullname at gmail.com)

🐛 David Renz
David Renz

💻 🐛 David Renz
David Renz

🐛 - David Schach
David Schach

🐛 💻 + David Schach
David Schach

🐛 💻 📖 Dawid Ciok
Dawid Ciok

🐛 💻 Debamoy Datta
Debamoy Datta

💻 @@ -468,642 +468,646 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Lucas Silva
Lucas Silva

🐛 Lucas Soncini
Lucas Soncini

💻 🐛 Luis Alcantar
Luis Alcantar

💻 + Lukas Gräf
Lukas Gräf

💻 Lukasz Slonina
Lukasz Slonina

🐛 Lukebray
Lukebray

🐛 Lynn
Lynn

💻 🐛 - Lyor Goldstein
Lyor Goldstein

🐛 + Lyor Goldstein
Lyor Goldstein

🐛 MCMicS
MCMicS

🐛 Macarse
Macarse

🐛 Machine account for PMD
Machine account for PMD

💻 Maciek Siemczyk
Maciek Siemczyk

🐛 Maikel Steneker
Maikel Steneker

💻 🐛 Maksim Moiseikin
Maksim Moiseikin

🐛 - Manfred Koch
Manfred Koch

🐛 + Manfred Koch
Manfred Koch

🐛 Manuel Moya Ferrer
Manuel Moya Ferrer

💻 🐛 Manuel Ryan
Manuel Ryan

🐛 Marat Vyshegorodtsev
Marat Vyshegorodtsev

🐛 Marcel Härle
Marcel Härle

🐛 Marcello Fialho
Marcello Fialho

🐛 Marcin Dąbrowski
Marcin Dąbrowski

💻 - Marcin Rataj
Marcin Rataj

🐛 + Marcin Rataj
Marcin Rataj

🐛 Marcono1234
Marcono1234

🐛 Mark Adamcin
Mark Adamcin

🐛 Mark Hall
Mark Hall

💻 🐛 Mark Kolich
Mark Kolich

🐛 Mark Pritchard
Mark Pritchard

🐛 Markus Rathgeb
Markus Rathgeb

🐛 - Marquis Wang
Marquis Wang

🐛 + Marquis Wang
Marquis Wang

🐛 MartGit
MartGit

🐛 Martin Feldsztejn
Martin Feldsztejn

🐛 Martin Lehmann
Martin Lehmann

🐛 Martin Spamer
Martin Spamer

🐛 Martin Tarjányi
Martin Tarjányi

🐛 MatFl
MatFl

🐛 - Mateusz Stefanski
Mateusz Stefanski

🐛 + Mateusz Stefanski
Mateusz Stefanski

🐛 Mathieu Gouin
Mathieu Gouin

🐛 MatiasComercio
MatiasComercio

💻 🐛 Matt Benson
Matt Benson

🐛 Matt De Poorter
Matt De Poorter

🐛 Matt Hargett
Matt Hargett

💻 💵 Matt Harrah
Matt Harrah

🐛 - Matt Nelson
Matt Nelson

🐛 + Matt Nelson
Matt Nelson

🐛 Matthew Amos
Matthew Amos

🐛 Matthew Duggan
Matthew Duggan

🐛 Matthew Hall
Matthew Hall

🐛 + Matthew Rossner
Matthew Rossner

🐛 Matías Fraga
Matías Fraga

💻 🐛 Maxime Robert
Maxime Robert

💻 🐛 - MetaBF
MetaBF

🐛 - Metin Dagcilar
Metin Dagcilar

🐛 + MetaBF
MetaBF

🐛 + Metin Dagcilar
Metin Dagcilar

🐛 Michael
Michael

🐛 Michael Bell
Michael Bell

🐛 Michael Bernstein
Michael Bernstein

🐛 Michael Clay
Michael Clay

🐛 Michael Dombrowski
Michael Dombrowski

🐛 - Michael Hausegger
Michael Hausegger

🐛 - Michael Hoefer
Michael Hoefer

🐛 + Michael Hausegger
Michael Hausegger

🐛 + Michael Hoefer
Michael Hoefer

🐛 Michael Kolesnikov
Michael Kolesnikov

🐛 Michael Möbius
Michael Möbius

🐛 Michael N. Lipp
Michael N. Lipp

🐛 Michael Pellegrini
Michael Pellegrini

🐛 Michal Kordas
Michal Kordas

🐛 - Michał Borek
Michał Borek

🐛 - Michał Kuliński
Michał Kuliński

🐛 + Michał Borek
Michał Borek

🐛 + Michał Kuliński
Michał Kuliński

🐛 Miguel Núñez Díaz-Montes
Miguel Núñez Díaz-Montes

🐛 Mihai Ionut
Mihai Ionut

🐛 Mikhail Kuchma
Mikhail Kuchma

🐛 Mirek Hankus
Mirek Hankus

🐛 Mitch Spano
Mitch Spano

🐛 - Mladjan Gadzic
Mladjan Gadzic

🐛 - MrAngry52
MrAngry52

🐛 + Mladjan Gadzic
Mladjan Gadzic

🐛 + MrAngry52
MrAngry52

🐛 Muminur Choudhury
Muminur Choudhury

🐛 Mykhailo Palahuta
Mykhailo Palahuta

💻 🐛 Nagendra Kumar Singh
Nagendra Kumar Singh

🐛 Nahuel Barrios
Nahuel Barrios

🐛 Nakul Sharma
Nakul Sharma

🐛 - Nathan Braun
Nathan Braun

🐛 - Nathan Reynolds
Nathan Reynolds

🐛 + Nathan Braun
Nathan Braun

🐛 + Nathan Reynolds
Nathan Reynolds

🐛 Nathan Reynolds
Nathan Reynolds

🐛 Nathanaël
Nathanaël

🐛 Naveen
Naveen

💻 Nazdravi
Nazdravi

🐛 Neha-Dhonde
Neha-Dhonde

🐛 - Nicholas Doyle
Nicholas Doyle

🐛 - Nick Butcher
Nick Butcher

🐛 + Nicholas Doyle
Nicholas Doyle

🐛 + Nick Butcher
Nick Butcher

🐛 Nico Gallinal
Nico Gallinal

🐛 Nicola Dal Maso
Nicola Dal Maso

🐛 Nicolas Filotto
Nicolas Filotto

💻 Nicolas Vervelle
Nicolas Vervelle

🐛 Nicolas Vuillamy
Nicolas Vuillamy

📖 - Nikita Chursin
Nikita Chursin

🐛 - Niklas Baudy
Niklas Baudy

🐛 + Nikita Chursin
Nikita Chursin

🐛 + Niklas Baudy
Niklas Baudy

🐛 Nikolas Havrikov
Nikolas Havrikov

🐛 Nilesh Virkar
Nilesh Virkar

🐛 Nimit Patel
Nimit Patel

🐛 Niranjan Harpale
Niranjan Harpale

🐛 Nirvik Patel
Nirvik Patel

💻 - Noah Sussman
Noah Sussman

🐛 - Noah0120
Noah0120

🐛 + Noah Sussman
Noah Sussman

🐛 + Noah0120
Noah0120

🐛 Noam Tamim
Noam Tamim

🐛 Noel Grandin
Noel Grandin

🐛 Olaf Haalstra
Olaf Haalstra

🐛 Oleg Andreych
Oleg Andreych

💻 🐛 Oleg Pavlenko
Oleg Pavlenko

🐛 - Oleksii Dykov
Oleksii Dykov

💻 🐛 - Oliver Eikemeier
Oliver Eikemeier

🐛 + Oleksii Dykov
Oleksii Dykov

💻 🐛 + Oliver Eikemeier
Oliver Eikemeier

🐛 Oliver Siegmar
Oliver Siegmar

💵 Olivier Parent
Olivier Parent

💻 🐛 Ollie Abbey
Ollie Abbey

💻 🐛 + Ondrej Kratochvil
Ondrej Kratochvil

🐛 OverDrone
OverDrone

🐛 + + Ozan Gulle
Ozan Gulle

💻 🐛 PUNEET JAIN
PUNEET JAIN

🐛 Parbati Bose
Parbati Bose

🐛 - - Paul Berg
Paul Berg

🐛 Paul Guyot
Paul Guyot

💻 Pavel Bludov
Pavel Bludov

🐛 Pavel Mička
Pavel Mička

🐛 + + Pedro Nuno Santos
Pedro Nuno Santos

🐛 Pedro Rijo
Pedro Rijo

🐛 Pelisse Romain
Pelisse Romain

💻 📖 🐛 - - Per Abich
Per Abich

💻 Pete Davids
Pete Davids

🐛 Peter Bruin
Peter Bruin

🐛 Peter Chittum
Peter Chittum

💻 🐛 + + Peter Cudmore
Peter Cudmore

🐛 Peter Kasson
Peter Kasson

🐛 Peter Kofler
Peter Kofler

🐛 - - Peter Paul Bakker
Peter Paul Bakker

💻 Peter Rader
Peter Rader

🐛 Pham Hai Trung
Pham Hai Trung

🐛 Philip Graf
Philip Graf

💻 🐛 + + Philip Hachey
Philip Hachey

🐛 Philippe Ozil
Philippe Ozil

🐛 Phinehas Artemix
Phinehas Artemix

🐛 - - Phokham Nonava
Phokham Nonava

🐛 Pim van der Loos
Pim van der Loos

💻 ⚠️ Piotr Szymański
Piotr Szymański

🐛 Piotrek Żygieło
Piotrek Żygieło

💻 🐛 📖 + + Pranay Jaiswal
Pranay Jaiswal

🐛 Prasad Kamath
Prasad Kamath

🐛 Prasanna
Prasanna

🐛 - - Presh-AR
Presh-AR

🐛 Puneet1726
Puneet1726

🐛 RBRi
RBRi

🐛 Rafael Cortês
Rafael Cortês

🐛 + + RaheemShaik999
RaheemShaik999

🐛 RajeshR
RajeshR

💻 🐛 Ramachandra Mohan
Ramachandra Mohan

🐛 - - Ramel0921
Ramel0921

🐛 Raquel Pau
Raquel Pau

🐛 Ravikiran Janardhana
Ravikiran Janardhana

🐛 Reda Benhemmouche
Reda Benhemmouche

🐛 + + Reinhard Schiedermeier
Reinhard Schiedermeier

🐛 Renato Oliveira
Renato Oliveira

💻 🐛 Rich DiCroce
Rich DiCroce

🐛 - - Richard Corfield
Richard Corfield

💻 Richard Corfield
Richard Corfield

🐛 💻 Riot R1cket
Riot R1cket

🐛 Rishabh Jain
Rishabh Jain

🐛 + + RishabhDeep Singh
RishabhDeep Singh

🐛 Rob Baillie
Rob Baillie

🐛 Robbie Martinus
Robbie Martinus

💻 🐛 - - Robert Henry
Robert Henry

🐛 Robert Mihaly
Robert Mihaly

🐛 Robert Painsi
Robert Painsi

🐛 Robert Russell
Robert Russell

🐛 + + Robert Sösemann
Robert Sösemann

💻 📖 📢 🐛 Robert Whitebit
Robert Whitebit

🐛 Robin Richtsfeld
Robin Richtsfeld

🐛 - - Robin Stocker
Robin Stocker

💻 🐛 Robin Wils
Robin Wils

🐛 RochusOest
RochusOest

🐛 Rodolfo Noviski
Rodolfo Noviski

🐛 + + Rodrigo Casara
Rodrigo Casara

🐛 Rodrigo Fernandes
Rodrigo Fernandes

🐛 Roman Salvador
Roman Salvador

💻 🐛 - - Ronald Blaschke
Ronald Blaschke

🐛 Róbert Papp
Róbert Papp

🐛 Saikat Sengupta
Saikat Sengupta

🐛 Saksham Handu
Saksham Handu

🐛 + + Saladoc
Saladoc

🐛 Salesforce Bob Lightning
Salesforce Bob Lightning

🐛 Sam Carlberg
Sam Carlberg

🐛 - - + Sascha Riemer
Sascha Riemer

🐛 Sashko
Sashko

💻 Satoshi Kubo
Satoshi Kubo

🐛 Scott Kennedy
Scott Kennedy

🐛 + + Scott Wells
Scott Wells

🐛 💻 Scrates1
Scrates1

🐛 💻 Scrsloota
Scrsloota

💻 Sebastian Bögl
Sebastian Bögl

🐛 - - Sebastian Davids
Sebastian Davids

🐛 Sebastian Schuberth
Sebastian Schuberth

🐛 Sebastian Schwarz
Sebastian Schwarz

🐛 + + Seren
Seren

🐛 💻 Sergey Gorbaty
Sergey Gorbaty

🐛 Sergey Kozlov
Sergey Kozlov

🐛 Sergey Yanzin
Sergey Yanzin

💻 🐛 - - Seth Wilcox
Seth Wilcox

💻 Shai Bennathan
Shai Bennathan

🐛 💻 Shubham
Shubham

💻 🐛 + + Simon Abykov
Simon Abykov

💻 🐛 Simon Xiao
Simon Xiao

🐛 Srinivasan Venkatachalam
Srinivasan Venkatachalam

🐛 Stanislav Gromov
Stanislav Gromov

🐛 - - Stanislav Myachenkov
Stanislav Myachenkov

💻 Stefan Birkner
Stefan Birkner

🐛 Stefan Bohn
Stefan Bohn

🐛 + + Stefan Endrullis
Stefan Endrullis

🐛 Stefan Klöss-Schuster
Stefan Klöss-Schuster

🐛 Stefan Wolf
Stefan Wolf

🐛 Stephan H. Wissel
Stephan H. Wissel

🐛 - - Stephen
Stephen

🐛 Stephen Carter
Stephen Carter

🐛 Stephen Friedrich
Stephen Friedrich

🐛 + + Steve Babula
Steve Babula

💻 Steven Stearns
Steven Stearns

🐛 💻 Stexxe
Stexxe

🐛 Stian Lågstad
Stian Lågstad

🐛 - - StuartClayton5
StuartClayton5

🐛 Supun Arunoda
Supun Arunoda

🐛 Suren Abrahamyan
Suren Abrahamyan

🐛 + + Suvashri
Suvashri

📖 SwatiBGupta1110
SwatiBGupta1110

🐛 SyedThoufich
SyedThoufich

🐛 Szymon Sasin
Szymon Sasin

🐛 - - T-chuangxin
T-chuangxin

🐛 TERAI Atsuhiro
TERAI Atsuhiro

🐛 TIOBE Software
TIOBE Software

💻 🐛 + + Tarush Singh
Tarush Singh

💻 Taylor Smock
Taylor Smock

🐛 Techeira Damián
Techeira Damián

💻 🐛 Ted Husted
Ted Husted

🐛 - - TehBakker
TehBakker

🐛 The Gitter Badger
The Gitter Badger

🐛 Theodoor
Theodoor

🐛 + + Thiago Henrique Hüpner
Thiago Henrique Hüpner

🐛 Thibault Meyer
Thibault Meyer

🐛 Thomas Güttler
Thomas Güttler

🐛 Thomas Jones-Low
Thomas Jones-Low

🐛 - - Thomas Smith
Thomas Smith

💻 🐛 ThrawnCA
ThrawnCA

🐛 Thu Vo
Thu Vo

🐛 + + Thunderforge
Thunderforge

💻 🐛 Tim van der Lippe
Tim van der Lippe

🐛 Tobias Weimer
Tobias Weimer

💻 🐛 Tom Copeland
Tom Copeland

🐛 💻 📖 - - Tom Daly
Tom Daly

🐛 Tomas
Tomas

🐛 Tomer Figenblat
Tomer Figenblat

🐛 + + Tomi De Lucca
Tomi De Lucca

💻 🐛 Tony
Tony

📖 Torsten Kleiber
Torsten Kleiber

🐛 TrackerSB
TrackerSB

🐛 - - Tyson Stewart
Tyson Stewart

🐛 Ullrich Hafner
Ullrich Hafner

🐛 Utku Cuhadaroglu
Utku Cuhadaroglu

💻 🐛 + + Valentin Brandl
Valentin Brandl

🐛 Valeria
Valeria

🐛 Valery Yatsynovich
Valery Yatsynovich

📖 Vasily Anisimov
Vasily Anisimov

🐛 - - Vedant Chokshi
Vedant Chokshi

🐛 Vibhor Goyal
Vibhor Goyal

🐛 Vickenty Fesunov
Vickenty Fesunov

🐛 + + Victor Noël
Victor Noël

🐛 Vincent Galloy
Vincent Galloy

💻 Vincent HUYNH
Vincent HUYNH

🐛 Vincent Maurin
Vincent Maurin

🐛 - - Vincent Privat
Vincent Privat

🐛 Vishhwas
Vishhwas

🐛 Vishv_Android
Vishv_Android

🐛 + + Vitaly
Vitaly

🐛 Vitaly Polonetsky
Vitaly Polonetsky

🐛 Vojtech Polivka
Vojtech Polivka

🐛 Vsevolod Zholobov
Vsevolod Zholobov

🐛 - - Vyom Yadav
Vyom Yadav

💻 Wang Shidong
Wang Shidong

🐛 Waqas Ahmed
Waqas Ahmed

🐛 + + Wayne J. Earl
Wayne J. Earl

🐛 Wchenghui
Wchenghui

🐛 Wener
Wener

💻 Will Winder
Will Winder

🐛 - - William Brockhus
William Brockhus

💻 🐛 Wilson Kurniawan
Wilson Kurniawan

🐛 Wim Deblauwe
Wim Deblauwe

🐛 + + Woongsik Choi
Woongsik Choi

🐛 XenoAmess
XenoAmess

💻 🐛 Yang
Yang

💻 YaroslavTER
YaroslavTER

🐛 - - Yasar Shaikh
Yasar Shaikh

💻 Young Chan
Young Chan

💻 🐛 YuJin Kim
YuJin Kim

🐛 + + Yuri Dolzhenko
Yuri Dolzhenko

🐛 Yurii Dubinka
Yurii Dubinka

🐛 Zoltan Farkas
Zoltan Farkas

🐛 Zustin
Zustin

🐛 - - aaronhurst-google
aaronhurst-google

🐛 💻 alexmodis
alexmodis

🐛 andreoss
andreoss

🐛 + + andrey81inmd
andrey81inmd

💻 🐛 anicoara
anicoara

🐛 arunprasathav
arunprasathav

🐛 asiercamara
asiercamara

🐛 - - astillich-igniti
astillich-igniti

💻 avesolovksyy
avesolovksyy

🐛 avishvat
avishvat

🐛 + + avivmu
avivmu

🐛 axelbarfod1
axelbarfod1

🐛 b-3-n
b-3-n

🐛 balbhadra9
balbhadra9

🐛 - - base23de
base23de

🐛 bergander
bergander

🐛 💻 berkam
berkam

💻 🐛 + + breizh31
breizh31

🐛 caesarkim
caesarkim

🐛 carolyujing
carolyujing

🐛 cbfiddle
cbfiddle

🐛 - - cesares-basilico
cesares-basilico

🐛 chrite
chrite

🐛 ciufudean
ciufudean

📖 + + cobratbq
cobratbq

🐛 coladict
coladict

🐛 cosmoJFH
cosmoJFH

🐛 cristalp
cristalp

🐛 - - crunsk
crunsk

🐛 cwholmes
cwholmes

🐛 cyberjj999
cyberjj999

🐛 + + cyw3
cyw3

🐛 📖 d1ss0nanz
d1ss0nanz

🐛 dague1
dague1

📖 dalizi007
dalizi007

💻 - - danbrycefairsailcom
danbrycefairsailcom

🐛 dariansanity
dariansanity

🐛 darrenmiliband
darrenmiliband

🐛 + + davidburstrom
davidburstrom

🐛 dbirkman-paloalto
dbirkman-paloalto

🐛 deepak-patra
deepak-patra

🐛 dependabot[bot]
dependabot[bot]

💻 🐛 - - dinesh150
dinesh150

🐛 diziaq
diziaq

🐛 dreaminpast123
dreaminpast123

🐛 + + duanyanan
duanyanan

🐛 dutt-sanjay
dutt-sanjay

🐛 duursma
duursma

💻 dylanleung
dylanleung

🐛 - - dzeigler
dzeigler

🐛 eant60
eant60

🐛 ekkirala
ekkirala

🐛 + + emersonmoura
emersonmoura

🐛 emouty
emouty

💻 eugenepugach
eugenepugach

🐛 fairy
fairy

🐛 - - filiprafalowicz
filiprafalowicz

💻 flxbl-io
flxbl-io

💵 foxmason
foxmason

🐛 + + frankegabor
frankegabor

🐛 frankl
frankl

🐛 freafrea
freafrea

🐛 fsapatin
fsapatin

🐛 - - gearsethenry
gearsethenry

🐛 gracia19
gracia19

🐛 guo fei
guo fei

🐛 + + gurmsc5
gurmsc5

🐛 gwilymatgearset
gwilymatgearset

💻 🐛 haigsn
haigsn

🐛 hemanshu070
hemanshu070

🐛 - - henrik242
henrik242

🐛 hongpuwu
hongpuwu

🐛 hvbtup
hvbtup

💻 🐛 + + igniti GmbH
igniti GmbH

🐛 ilovezfs
ilovezfs

🐛 imax-erik
imax-erik

🐛 itaigilo
itaigilo

🐛 - - jakivey32
jakivey32

🐛 jbennett2091
jbennett2091

🐛 jcamerin
jcamerin

🐛 + + jkeener1
jkeener1

🐛 jmetertea
jmetertea

🐛 johnra2
johnra2

💻 johnzhao9
johnzhao9

🐛 - - josemanuelrolon
josemanuelrolon

💻 🐛 kabroxiko
kabroxiko

💻 🐛 karthikaiyasamy
karthikaiyasamy

📖 + + karwer
karwer

🐛 kaulonline
kaulonline

🐛 kdaemonv
kdaemonv

🐛 kdebski85
kdebski85

🐛 💻 - - kenji21
kenji21

💻 🐛 kfranic
kfranic

🐛 khalidkh
khalidkh

🐛 + + koalalam
koalalam

🐛 krzyk
krzyk

🐛 lasselindqvist
lasselindqvist

🐛 lgemeinhardt
lgemeinhardt

🐛 - - lihuaib
lihuaib

🐛 liqingjun123
liqingjun123

🐛 lonelyma1021
lonelyma1021

🐛 + + lpeddy
lpeddy

🐛 lujiefsi
lujiefsi

💻 lukelukes
lukelukes

💻 lyriccoder
lyriccoder

🐛 - - marcelmore
marcelmore

🐛 matchbox
matchbox

🐛 matthiaskraaz
matthiaskraaz

🐛 + + meandonlyme
meandonlyme

🐛 mikesive
mikesive

🐛 milossesic
milossesic

🐛 mluckam
mluckam

💻 🐛 - - mohan-chinnappan-n
mohan-chinnappan-n

💻 mriddell95
mriddell95

🐛 mrlzh
mrlzh

🐛 + + msloan
msloan

🐛 mucharlaravalika
mucharlaravalika

🐛 mvenneman
mvenneman

🐛 nareshl119
nareshl119

🐛 - - nicolas-harraudeau-sonarsource
nicolas-harraudeau-sonarsource

🐛 noerremark
noerremark

🐛 novsirion
novsirion

🐛 + + nwcm
nwcm

📖 🐛 💻 oggboy
oggboy

🐛 oinume
oinume

🐛 orimarko
orimarko

💻 🐛 - - pablogomez2197
pablogomez2197

🐛 pacvz
pacvz

💻 pallavi agarwal
pallavi agarwal

🐛 + + parksungrin
parksungrin

🐛 patpatpat123
patpatpat123

🐛 patriksevallius
patriksevallius

🐛 pbrajesh1
pbrajesh1

🐛 - - phoenix384
phoenix384

🐛 piotrszymanski-sc
piotrszymanski-sc

💻 plan3d
plan3d

🐛 + + poojasix
poojasix

🐛 prabhushrikant
prabhushrikant

🐛 pujitha8783
pujitha8783

🐛 r-r-a-j
r-r-a-j

🐛 - - raghujayjunk
raghujayjunk

🐛 rajeshveera
rajeshveera

🐛 rajeswarreddy88
rajeswarreddy88

🐛 + + recdevs
recdevs

🐛 reudismam
reudismam

💻 🐛 rijkt
rijkt

🐛 rillig-tk
rillig-tk

🐛 - - rmohan20
rmohan20

💻 🐛 rnveach
rnveach

🐛 rxmicro
rxmicro

🐛 + + ryan-gustafson
ryan-gustafson

💻 🐛 sabi0
sabi0

🐛 scais
scais

🐛 schosin
schosin

🐛 - - screamingfrog
screamingfrog

💵 sebbASF
sebbASF

🐛 sergeygorbaty
sergeygorbaty

💻 + + shilko2013
shilko2013

🐛 shiomiyan
shiomiyan

📖 simeonKondr
simeonKondr

🐛 snajberk
snajberk

🐛 - - sniperrifle2004
sniperrifle2004

🐛 snuyanzin
snuyanzin

🐛 💻 soloturn
soloturn

🐛 + + soyodream
soyodream

🐛 sratz
sratz

🐛 stonio
stonio

🐛 sturton
sturton

💻 🐛 - - sudharmohan
sudharmohan

🐛 suruchidawar
suruchidawar

🐛 svenfinitiv
svenfinitiv

🐛 + + szymanp23
szymanp23

🐛 💻 tashiscool
tashiscool

🐛 test-git-hook
test-git-hook

🐛 testation21
testation21

💻 🐛 - - thanosa
thanosa

🐛 tiandiyixian
tiandiyixian

🐛 tobwoerk
tobwoerk

🐛 + + tprouvot
tprouvot

🐛 💻 trentchilders
trentchilders

🐛 triandicAnt
triandicAnt

🐛 trishul14
trishul14

🐛 - - tsui
tsui

🐛 wangzitom12306
wangzitom12306

🐛 winhkey
winhkey

🐛 + + witherspore
witherspore

🐛 wjljack
wjljack

🐛 wuchiuwong
wuchiuwong

🐛 xingsong
xingsong

🐛 - - xioayuge
xioayuge

🐛 xnYi9wRezm
xnYi9wRezm

💻 🐛 xuanuy
xuanuy

🐛 + + xyf0921
xyf0921

🐛 yalechen-cyw3
yalechen-cyw3

🐛 yasuharu-sato
yasuharu-sato

🐛 zenglian
zenglian

🐛 - - zgrzyt93
zgrzyt93

💻 🐛 zh3ng
zh3ng

🐛 zt_soft
zt_soft

🐛 + + ztt79
ztt79

🐛 zzzzfeng
zzzzfeng

🐛 Árpád Magosányi
Árpád Magosányi

🐛 任贵杰
任贵杰

🐛 - - 茅延安
茅延安

💻 diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index a499b49cf8..535a5fa945 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -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" diff --git a/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md b/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md index 02b760aeb9..cc366a59a1 100644 --- a/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md +++ b/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md @@ -267,7 +267,7 @@ e.g. `xalan` (see ). ### cpdhtml.xslt -This stylesheet is available in the sources or from GitHub at: . +This stylesheet is available in the sources or from GitHub at: . ```shell xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml.html @@ -284,7 +284,7 @@ xalan -in cpd-report-sample.xml -xsl cpdhtml.xslt -out cpd-report-sample-cpdhtml ### cpdhtml-v2.xslt -This stylesheet is available in the sources or from GitHub at: . +This stylesheet is available in the sources or from GitHub at: . ```shell xalan -in pmd-core-cpd-report.xml -xsl etc/xslt/cpdhtml-v2.xslt -out pmd-core-cpd-report-v2.html diff --git a/docs/pages/pmd/userdocs/extending/defining_properties.md b/docs/pages/pmd/userdocs/extending/defining_properties.md index dfda872abc..19c728aa19 100644 --- a/docs/pages/pmd/userdocs/extending/defining_properties.md +++ b/docs/pages/pmd/userdocs/extending/defining_properties.md @@ -97,7 +97,7 @@ 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/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/AvoidReassigningLoopVariablesRule.java#L40). +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: * The property descriptors are declared `static final`, which should generally be the case, as descriptors are immutable and can be shared between instances of the same rule; diff --git a/docs/pages/pmd/userdocs/extending/testing.md b/docs/pages/pmd/userdocs/extending/testing.md index d746464657..8167a8d20a 100644 --- a/docs/pages/pmd/userdocs/extending/testing.md +++ b/docs/pages/pmd/userdocs/extending/testing.md @@ -132,7 +132,7 @@ The root element is ``. It can contain one or more `` and Each `` element defines a single test case. `` elements are used to share code snippets between different test cases. -{%include note.html content="The XML schema is available at [rule-tests.xsd](https://github.com/pmd/pmd/blob/master/pmd-test-schema/src/main/resources/net/sourceforge/pmd/test/schema/rule-tests_1_0_0.xsd)." %} +{%include note.html content="The XML schema is available at [rule-tests.xsd](https://github.com/pmd/pmd/blob/main/pmd-test-schema/src/main/resources/net/sourceforge/pmd/test/schema/rule-tests_1_0_0.xsd)." %} ### `` attributes diff --git a/docs/pages/pmd/userdocs/pmd_report_formats.md b/docs/pages/pmd/userdocs/pmd_report_formats.md index 85a037bb26..0b32afb05e 100644 --- a/docs/pages/pmd/userdocs/pmd_report_formats.md +++ b/docs/pages/pmd/userdocs/pmd_report_formats.md @@ -18,7 +18,7 @@ The header of the sections below are used to select the format on the command li arguments to the `--format` option. When a format accepts *properties*, those can be specified with the `--property` / `-P` option on the command-line. -{% include note.html content="Suppressed violations are only reported, if the CLI parameter `--show-suppressed` is set." %} +{% include note.html content="Suppressed violations are only reported, if the CLI parameter `--show-suppressed` is set and if the format supports showing suppressed violations. Currently only html, summaryhtml and xml show suppressed violations." %} ## sarif @@ -98,7 +98,7 @@ Example: HTML format. This renderer provides two properties to render a link to the source where the violations -have been found. The following example has been created with `-property linkPrefix=https://github.com/pmd/pmd/blob/master/ -property linePrefix=L -shortnames -d pmd`. +have been found. The following example has been created with `-property linkPrefix=https://github.com/pmd/pmd/blob/main/ -property linePrefix=L -shortnames -d pmd`. If "linkPrefix" is not set, then "linePrefix" has no effect anyway: just the filename will be rendered, with no html link. Otherwise if "linePrefix" is not set, then the link will not contain a line number. @@ -277,7 +277,7 @@ Vladimir Bossicard HTML format. XML format. -This format is a XML document, that can be validated by a XSD schema. The schema is [report_2_0_0.xsd](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/resources/report_2_0_0.xsd). +This format is a XML document, that can be validated by a XSD schema. The schema is [report_2_0_0.xsd](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/resources/report_2_0_0.xsd). Example: @@ -345,10 +345,10 @@ XML with a XSL transformation applied. PMD provides one built-in stylesheet, that is used by default, if no other stylesheet with the property "xsltFilename" is specified. It is called -[pmd-nicerhtml.xsl](https://github.com/pmd/pmd/blob/master/pmd-core/src/main/resources/pmd-nicerhtml.xsl) +[pmd-nicerhtml.xsl](https://github.com/pmd/pmd/blob/main/pmd-core/src/main/resources/pmd-nicerhtml.xsl) and can be used for customization. -There are many other stylesheets available online: . +There are many other stylesheets available online: . Examples: * [Example with pmd-nicerhtml.xsl](report-examples/pmd-report-pmd-nicerhtml.html) diff --git a/docs/pages/pmd/userdocs/tools/tools.md b/docs/pages/pmd/userdocs/tools/tools.md index ace5b4e816..ba455ff7e8 100644 --- a/docs/pages/pmd/userdocs/tools/tools.md +++ b/docs/pages/pmd/userdocs/tools/tools.md @@ -91,7 +91,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M BlueJ - pmd-bluej + pmd-bluej Tom Copeland @@ -133,7 +133,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M Gel - github: pmd/pmd-misc/pmd-gel + github: pmd/pmd-misc/pmd-gel Andrei Lumianski @@ -161,7 +161,7 @@ With TCA you have PMD analysis out-of-the-box, and it is open source under the M JBuilder - github: pmd/pmd-misc/pmd-jbuilder + github: pmd/pmd-misc/pmd-jbuilder Tom Copeland diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b5856fd753..6f89cebd47 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,27 +14,30 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 New and noteworthy +### 🌟 Rule Changes + +#### Renamed Rules +Several rules for unit testing have been renamed to better reflect their actual scope. Lots of them were called +after JUnit / JUnit 4, even when they applied to JUnit 5 and / or TestNG. + +* {% rule java/bestpractices/UnitTestAssertionsShouldIncludeMessage %} (Java Best Practices) has been renamed from `JUnitAssertionsShouldIncludeMessage`. +* {% rule java/bestpractices/UnitTestContainsTooManyAsserts %} (Java Best Practices) has been renamed from `JUnitTestContainsTooManyAsserts`. +* {% rule java/bestpractices/UnitTestShouldIncludeAssert %} (Java Best Practices) has been renamed from `JUnitTestsShouldIncludeAssert`. +* {% rule java/bestpractices/UnitTestShouldUseAfterAnnotation %} (Java Best Practices) has been renamed from `JUnit4TestShouldUseAfterAnnotation`. +* {% rule java/bestpractices/UnitTestShouldUseBeforeAnnotation %} (Java Best Practices) has been renamed from `JUnit4TestShouldUseBeforeAnnotation`. +* {% rule java/bestpractices/UnitTestShouldUseTestAnnotation %} (Java Best Practices) has been renamed from `JUnit4TestShouldUseTestAnnotation`. + +The old rule names still work but are deprecated. + ### 🐛 Fixed Issues -* apex - * [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers - (ApexCRUDViolation, CognitiveComplexity, OperationWithLimitsInLoop) - * [#5163](https://github.com/pmd/pmd/issues/5163): \[apex] Parser error when using toLabel in SOSL query - * [#5182](https://github.com/pmd/pmd/issues/5182): \[apex] Parser error when using GROUPING in a SOQL query - * [#5218](https://github.com/pmd/pmd/issues/5218): \[apex] Parser error when using nested subqueries in SOQL -* core - * [#5059](https://github.com/pmd/pmd/issues/5059): \[core] xml output doesn't escape CDATA inside its own CDATA - * [#5201](https://github.com/pmd/pmd/issues/5201): \[core] PMD sarif schema file points to nonexistent location - * [#5222](https://github.com/pmd/pmd/issues/5222): \[core] RuleReference/RuleSetWriter don't handle changed default property values correctly * java - * [#5190](https://github.com/pmd/pmd/issues/5190): \[java] NPE in type inference -* java-errorprone - * [#5207](https://github.com/pmd/pmd/issues/5207): \[java] CheckSkipResult: false positve for a private method `void skip(int)` in a subclass of FilterInputStream + * [#4532](https://github.com/pmd/pmd/issues/4532): \[java] Rule misnomer for JUnit* rules ### 🚨 API Changes -### ✨ External Contributions -* [#5202](https://github.com/pmd/pmd/pull/5202): \[core] Sarif format: refer to schemastore.org - [David Schach](https://github.com/dschach) (@dschach) -* [#5208](https://github.com/pmd/pmd/pull/5208): \[doc] Added Codety to "Tools / Integrations" - [Tony](https://github.com/random1223) (@random1223) +### ✨ Merged pull requests +* [#4965](https://github.com/pmd/pmd/pull/4965): \[java] Rename JUnit rules with overly restrictive names - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) +* [#5241](https://github.com/pmd/pmd/pull/5241): Ignore javacc code in coverage report - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) {% endtocmaker %} diff --git a/docs/pages/release_notes_old.md b/docs/pages/release_notes_old.md index 575700bafa..6a7983db8b 100644 --- a/docs/pages/release_notes_old.md +++ b/docs/pages/release_notes_old.md @@ -5,6 +5,114 @@ permalink: pmd_release_notes_old.html Previous versions of PMD can be downloaded here: [Releases - pmd/pmd (GitHub)](https://github.com/pmd/pmd/releases) +## 27-September-2024 - 7.6.0 + +The PMD team is pleased to announce PMD 7.6.0. + +This is a minor release. + +### Table Of Contents + +* [🚀 New and noteworthy](#new-and-noteworthy) + * [New Git default branch - "main"](#new-git-default-branch---main) +* [🐛 Fixed Issues](#fixed-issues) +* [🚨 API Changes](#api-changes) +* [✨ Merged pull requests](#merged-pull-requests) +* [📦 Dependency updates](#dependency-updates) +* [📈 Stats](#stats) + +### 🚀 New and noteworthy + +#### New Git default branch - "main" + +We are joining the Git community and updating "master" to "main". Using the term "master" for the main +development branch can be offensive to some people. Existing versions of Git have been always capable of +working with any branch name and since 2.28.0 (July 2020) the default initial branch is configurable +(`init.defaultBranch`). Since October 2020, the default branch for new repositories on GitHub +is "main". Finally, PMD will also use this new name for the main branch in all our own repositories. + +Why "main"? PMD uses a very simple branching model - pull requests with feature branches and one main development +branch, from which releases are created. That's why "main" is currently the best fitting name. + +More information: +- +- + +What changes? +- We change the default branch on GitHub, so that pull requests are automatically created against `main` from + now on. +- If you have already a local clone of PMD's repository, you'll need to rename the old master branch locally: + ``` + git branch --move master main + git fetch origin + git branch --set-upstream-to=origin/main main + git remote set-head origin --auto + ``` + + More info: + and + +- If you created a fork on GitHub, you'll need to change the default branch in your fork to `main` as + well (Settings > Default Branch). +- Some time after this release, we'll delete the old master branch on GitHub. Then only `main` can be used. +- This change is expanded to the other PMD repositories as well, e.g. pmd-designer and pmd-regression-tester. + +### 🐛 Fixed Issues +* apex + * [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers + (ApexCRUDViolation, CognitiveComplexity, OperationWithLimitsInLoop) + * [#5163](https://github.com/pmd/pmd/issues/5163): \[apex] Parser error when using toLabel in SOSL query + * [#5182](https://github.com/pmd/pmd/issues/5182): \[apex] Parser error when using GROUPING in a SOQL query + * [#5218](https://github.com/pmd/pmd/issues/5218): \[apex] Parser error when using nested subqueries in SOQL + * [#5228](https://github.com/pmd/pmd/issues/5228): \[apex] Parser error when using convertCurrency() in SOQL +* core + * [#5059](https://github.com/pmd/pmd/issues/5059): \[core] xml output doesn't escape CDATA inside its own CDATA + * [#5201](https://github.com/pmd/pmd/issues/5201): \[core] PMD sarif schema file points to nonexistent location + * [#5222](https://github.com/pmd/pmd/issues/5222): \[core] RuleReference/RuleSetWriter don't handle changed default property values correctly + * [#5229](https://github.com/pmd/pmd/issues/5229): \[doc] CLI flag `--show-suppressed` needs to mention xml, html, summaryhtml +* java + * [#5190](https://github.com/pmd/pmd/issues/5190): \[java] NPE in type inference +* java-codestyle + * [#5046](https://github.com/pmd/pmd/issues/5046): \[java] LocalVariableCouldBeFinal false positive with try/catch +* java-errorprone + * [#5068](https://github.com/pmd/pmd/issues/5068): \[java] MissingStaticMethodInNonInstantiatableClass: false positive with builder pattern + * [#5207](https://github.com/pmd/pmd/issues/5207): \[java] CheckSkipResult: false positve for a private method `void skip(int)` in a subclass of FilterInputStream + +### 🚨 API Changes + +No changes. + +### ✨ Merged pull requests +* [#5186](https://github.com/pmd/pmd/pull/5186): \[java] Cleanup things about implicit classes - [Clément Fournier](https://github.com/oowekyala) (@oowekyala) +* [#5188](https://github.com/pmd/pmd/pull/5188): \[apex] Use new apex-parser 4.2.0 - [Andreas Dangel](https://github.com/adangel) (@adangel) +* [#5191](https://github.com/pmd/pmd/pull/5191): \[java] Fix #5046 - FPs in LocalVariableCouldBeFinal - [Clément Fournier](https://github.com/oowekyala) (@oowekyala) +* [#5192](https://github.com/pmd/pmd/pull/5192): \[java] Fix #5190 - NPE in type inference caused by null type - [Clément Fournier](https://github.com/oowekyala) (@oowekyala) +* [#5195](https://github.com/pmd/pmd/pull/5195): \[apex] Fix various FNs when using triggers - [Andreas Dangel](https://github.com/adangel) (@adangel) +* [#5202](https://github.com/pmd/pmd/pull/5202): \[core] Sarif format: refer to schemastore.org - [David Schach](https://github.com/dschach) (@dschach) +* [#5208](https://github.com/pmd/pmd/pull/5208): \[doc] Added Codety to "Tools / Integrations" - [Tony](https://github.com/random1223) (@random1223) +* [#5210](https://github.com/pmd/pmd/pull/5210): \[core] Fix PMD's XMLRenderer to escape CDATA - [Andreas Dangel](https://github.com/adangel) (@adangel) +* [#5211](https://github.com/pmd/pmd/pull/5211): Change branch master to main - [Andreas Dangel](https://github.com/adangel) (@adangel) +* [#5212](https://github.com/pmd/pmd/pull/5212): \[java] Adjust signature matching in CheckSkipResultRule - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod) +* [#5223](https://github.com/pmd/pmd/pull/5223): \[core] Fix RuleReference / RuleSetWriter handling of properties - [Andreas Dangel](https://github.com/adangel) (@adangel) +* [#5224](https://github.com/pmd/pmd/pull/5224): \[java] Fix #5068: Class incorrectly identified as non-instantiatable - [Lukas Gräf](https://github.com/lukasgraef) (@lukasgraef) +* [#5230](https://github.com/pmd/pmd/pull/5230): \[doc] Documentation update for --show-suppressed flag - [David Schach](https://github.com/dschach) (@dschach) +* [#5237](https://github.com/pmd/pmd/pull/5237): \[apex] Support convertCurrency() in SOQL/SOSL - [Andreas Dangel](https://github.com/adangel) (@adangel) + +### 📦 Dependency updates +* [#5185](https://github.com/pmd/pmd/issues/5185): Bump checkstyle from 10.14.0 to 10.18.1 +* [#5187](https://github.com/pmd/pmd/issues/5187): Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3 +* [#5199](https://github.com/pmd/pmd/issues/5199): Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.3 +* [#5216](https://github.com/pmd/pmd/issues/5216): Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.20.0 to 0.23.0 +* [#5226](https://github.com/pmd/pmd/issues/5226): Bump rouge from 4.3.0 to 4.4.0 in the all-gems group across 1 directory +* [#5227](https://github.com/pmd/pmd/issues/5227): Bump com.google.code.gson:gson from 2.10.1 to 2.11.0 +* [#5232](https://github.com/pmd/pmd/issues/5232): Bump com.google.protobuf:protobuf-java from 3.25.3 to 3.25.5 +* [#5233](https://github.com/pmd/pmd/issues/5233): Bump webrick from 1.8.1 to 1.8.2 in /docs + +### 📈 Stats +* 60 commits +* 27 closed tickets & PRs +* Days since last release: 27 + ## 30-August-2024 - 7.5.0 The PMD team is pleased to announce PMD 7.5.0. @@ -7635,7 +7743,7 @@ conduct. Please note that this project is released with a Contributor Code of Conduct. 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](https://github.com/pmd/pmd/blob/master/code_of_conduct.md) +You can find the code of conduct in the file [code_of_conduct.md](https://github.com/pmd/pmd/blob/main/code_of_conduct.md) in our repository. #### Performance improvements for XPath 2.0 rules diff --git a/docs/report-examples/pmd-report-html.html b/docs/report-examples/pmd-report-html.html index 2c1c41342d..0d745e32b9 100644 --- a/docs/report-examples/pmd-report-html.html +++ b/docs/report-examples/pmd-report-html.html @@ -3,20 +3,20 @@ #FileLineProblem 1 -pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java +pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java 124 Logger calls should be surrounded by log level guards. 2 -pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java +pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java 58 This for loop can be replaced by a foreach loop

Processing errors

- +
FileProblem
pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.javapmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
net.sourceforge.pmd.PMDException: Error while parsing pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
     at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:110)
     at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:89)
@@ -52,7 +52,7 @@ Was expecting one of:
 

Suppressed warnings

- + @@ -64,4 +64,4 @@ Was expecting one of: -
FileLineRuleNOPMD or AnnotationReason
pmd-core/src/main/java/net/sourceforge/pmd/PMD.javapmd-core/src/main/java/net/sourceforge/pmd/PMD.java 505 CloseResource AnnotationLoosePackageCoupling No packages or classes specified
\ No newline at end of file + diff --git a/docs/report-examples/pmd-report-summaryhtml.html b/docs/report-examples/pmd-report-summaryhtml.html index 92dc3e1f72..cf6c056057 100644 --- a/docs/report-examples/pmd-report-summaryhtml.html +++ b/docs/report-examples/pmd-report-summaryhtml.html @@ -10,20 +10,20 @@ #FileLineProblem 1 -pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java +pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java 124 Logger calls should be surrounded by log level guards. 2 -pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java +pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmarker.java 58 This for loop can be replaced by a foreach loop

Processing errors

- +
FileProblem
pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.javapmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
net.sourceforge.pmd.PMDException: Error while parsing pmd-core/src/test/resources/net/sourceforge/pmd/cpd/files/file_with_ISO-8859-1_encoding.java
     at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:110)
     at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:89)
@@ -59,7 +59,7 @@ Was expecting one of:
 

Suppressed warnings

- + @@ -71,4 +71,4 @@ Was expecting one of: -
FileLineRuleNOPMD or AnnotationReason
pmd-core/src/main/java/net/sourceforge/pmd/PMD.javapmd-core/src/main/java/net/sourceforge/pmd/PMD.java 505 CloseResource AnnotationLoosePackageCoupling No packages or classes specified
\ No newline at end of file + diff --git a/javacc-wrapper.xml b/javacc-wrapper.xml index 2c43e086d8..05837e96ba 100644 --- a/javacc-wrapper.xml +++ b/javacc-wrapper.xml @@ -224,6 +224,9 @@ + + + @@ -262,7 +265,8 @@ - + @@ -272,7 +276,8 @@ - + @@ -385,11 +390,12 @@ - +'/> @@ -534,8 +540,9 @@ public final class ${token-constants-name} \{${line.separator} - + diff --git a/pmd-ant/pom.xml b/pmd-ant/pom.xml index 35df92992a..bc57065dc2 100644 --- a/pmd-ant/pom.xml +++ b/pmd-ant/pom.xml @@ -7,7 +7,7 @@ pmd net.sourceforge.pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT 4.0.0 diff --git a/pmd-apex/pom.xml b/pmd-apex/pom.xml index c616dde033..1c1c8045fe 100644 --- a/pmd-apex/pom.xml +++ b/pmd-apex/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml @@ -96,7 +96,7 @@ io.github.apex-dev-tools apex-parser - 4.2.0 + 4.3.0 com.google.summit diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java index 8ec31a42cd..3b08de7d9b 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTSoqlExpression.java @@ -77,6 +77,7 @@ public final class ASTSoqlExpression extends AbstractApexNode.Single myList; + + myList = [ + SELECT convertcurrency(Amount) + FROM Opportunity + ]; + + // with FORMAT() + myList = [ + SELECT Amount, FORMAT(amount) Amt, convertCurrency(amount) convertedAmount, + FORMAT(convertCurrency(amount)) convertedCurrency + FROM Opportunity where id = '006R00000024gDtIAI' + ]; + + // FORMAT() with aggregate function + myList = [ SELECT FORMAT(MIN(closedate)) Amt FROM opportunity ]; + } + + void soslQueries() { + List> searchResults; + + // label with alias + searchResults = [ + FIND :searchTerm + IN ALL FIELDS + RETURNING + Account(Id, toLabel(Name) AliasName) + LIMIT 10 + ]; + + // convertCurrency + searchResults = [ FIND 'test' RETURNING Opportunity(Name, convertCurrency(Amount), convertCurrency(Amount) AliasCurrency) ]; + + // with FORMAT() + searchResults = [ FIND 'Acme' RETURNING Account(AnnualRevenue, FORMAT(convertCurrency(AnnualRevenue)) convertedCurrency) ]; + + // FORMAT() with aggregate function + searchResults = [ FIND 'Acme' RETURNING Account(AnnualRevenue, FORMAT(MIN(CloseDate))) ]; + + } +} diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt new file mode 100644 index 0000000000..f297ddecfc --- /dev/null +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt @@ -0,0 +1,57 @@ ++- ApexFile[@DefiningType = "PmdTest", @RealLoc = true] + +- UserClass[@DefiningType = "PmdTest", @Image = "PmdTest", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "PmdTest", @SuperClassName = ""] + +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @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 = "queryOpportunities", @Constructor = false, @DefiningType = "PmdTest", @Image = "queryOpportunities", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] + | +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @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 = "PmdTest", @RealLoc = true] + | +- VariableDeclarationStatements[@DefiningType = "PmdTest", @RealLoc = true] + | | +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @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] + | | +- VariableDeclaration[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true, @Type = "List"] + | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] + | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] + | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | | +- SoqlExpression[@CanonicalQuery = "SELECT CONVERTCURRENCY(Amount)\n FROM Opportunity", @DefiningType = "PmdTest", @Query = "SELECT convertcurrency(Amount)\n FROM Opportunity", @RealLoc = true] + | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] + | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | | +- SoqlExpression[@CanonicalQuery = "SELECT Amount, FORMAT(amount) Amt, CONVERTCURRENCY(amount) convertedAmount,\n FORMAT(CONVERTCURRENCY(amount)) convertedCurrency\n FROM Opportunity WHERE id = \'006R00000024gDtIAI\'", @DefiningType = "PmdTest", @Query = "SELECT Amount, FORMAT(amount) Amt, convertCurrency(amount) convertedAmount,\n FORMAT(convertCurrency(amount)) convertedCurrency\n FROM Opportunity where id = \'006R00000024gDtIAI\'", @RealLoc = true] + | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] + | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | +- SoqlExpression[@CanonicalQuery = "SELECT FORMAT(MIN(closedate)) Amt FROM opportunity", @DefiningType = "PmdTest", @Query = "SELECT FORMAT(MIN(closedate)) Amt FROM opportunity", @RealLoc = true] + +- Method[@Arity = 0, @CanonicalName = "soslQueries", @Constructor = false, @DefiningType = "PmdTest", @Image = "soslQueries", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] + +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @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 = "PmdTest", @RealLoc = true] + +- VariableDeclarationStatements[@DefiningType = "PmdTest", @RealLoc = true] + | +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @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] + | +- VariableDeclaration[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true, @Type = "List>"] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] + | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] + | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | +- SoslExpression[@CanonicalQuery = "FIND :tmpVar1\n IN ALL FIELDS\n RETURNING\n Account(Id, TOLABEL(Name) AliasName)\n LIMIT 10", @DefiningType = "PmdTest", @Query = "\n FIND :searchTerm\n IN ALL FIELDS\n RETURNING\n Account(Id, toLabel(Name) AliasName)\n LIMIT 10\n ", @RealLoc = true] + | +- BindExpressions[@DefiningType = "PmdTest", @RealLoc = true] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchTerm", @RealLoc = true] + | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] + | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | +- SoslExpression[@CanonicalQuery = "FIND \'test\' RETURNING Opportunity(Name, CONVERTCURRENCY(Amount), CONVERTCURRENCY(Amount) AliasCurrency)", @DefiningType = "PmdTest", @Query = " FIND \'test\' RETURNING Opportunity(Name, convertCurrency(Amount), convertCurrency(Amount) AliasCurrency) ", @RealLoc = true] + +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] + | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + | +- SoslExpression[@CanonicalQuery = "FIND \'Acme\' RETURNING Account(AnnualRevenue, FORMAT(CONVERTCURRENCY(AnnualRevenue)) convertedCurrency)", @DefiningType = "PmdTest", @Query = " FIND \'Acme\' RETURNING Account(AnnualRevenue, FORMAT(convertCurrency(AnnualRevenue)) convertedCurrency) ", @RealLoc = true] + +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] + +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] + +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] + | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] + +- SoslExpression[@CanonicalQuery = "FIND \'Acme\' RETURNING Account(AnnualRevenue, FORMAT(MIN(CloseDate)))", @DefiningType = "PmdTest", @Query = " FIND \'Acme\' RETURNING Account(AnnualRevenue, FORMAT(MIN(CloseDate))) ", @RealLoc = true] diff --git a/pmd-cli/pom.xml b/pmd-cli/pom.xml index 18203f263c..adca9527ba 100644 --- a/pmd-cli/pom.xml +++ b/pmd-cli/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-cli/src/main/java/net/sourceforge/pmd/cli/commands/internal/PmdCommand.java b/pmd-cli/src/main/java/net/sourceforge/pmd/cli/commands/internal/PmdCommand.java index f60632ba63..de3fe49ec3 100644 --- a/pmd-cli/src/main/java/net/sourceforge/pmd/cli/commands/internal/PmdCommand.java +++ b/pmd-cli/src/main/java/net/sourceforge/pmd/cli/commands/internal/PmdCommand.java @@ -138,7 +138,7 @@ public class PmdCommand extends AbstractAnalysisPmdSubcommand this.benchmark = benchmark; } - @Option(names = "--show-suppressed", description = "Report should show suppressed rule violations.") + @Option(names = "--show-suppressed", description = "Report should show suppressed rule violations if supported by the report format.") public void setShowSuppressed(final boolean showSuppressed) { this.showSuppressed = showSuppressed; } diff --git a/pmd-coco/pom.xml b/pmd-coco/pom.xml index 202e7f61a9..147966f7b6 100644 --- a/pmd-coco/pom.xml +++ b/pmd-coco/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index 48d6799ffe..531a06515f 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java b/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java new file mode 100644 index 0000000000..ab9b46f465 --- /dev/null +++ b/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java @@ -0,0 +1,23 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Marks a class as generated code, and therefore to be ignored for code coverage purposes. + * + * @since 7.6.0 + */ +@Retention(RetentionPolicy.CLASS) +@Documented +public @interface Generated { + + /** The generator that produced this code */ + String value() default ""; + +} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceId.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceId.java index 6d287fa0e0..b0ce233400 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceId.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceId.java @@ -70,8 +70,8 @@ import net.sourceforge.pmd.util.internal.ResourceLoader; * EmptyCatchBlock * * - * https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface - * https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/quickstart.xml + * https://raw.githubusercontent.com/pmd/pmd/main/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface + * https://raw.githubusercontent.com/pmd/pmd/main/pmd-java/src/main/resources/rulesets/java/quickstart.xml * ConstantsInInterface * * diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceIdTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceIdTest.java index ca3c0ea388..3de2efd91d 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceIdTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/internal/RuleSetReferenceIdTest.java @@ -91,8 +91,8 @@ class RuleSetReferenceIdTest { new RuleSetReferenceId("rulesets/java/basic.xml/EmptyCatchBlock")); assertRuleSetReferenceId(false, null, false, "EmptyCatchBlock", "EmptyCatchBlock", new RuleSetReferenceId("EmptyCatchBlock")); - assertRuleSetReferenceId(true, "https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/quickstart.xml", false, "ConstantsInInterface", "https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface", - new RuleSetReferenceId("https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface")); + assertRuleSetReferenceId(true, "https://raw.githubusercontent.com/pmd/pmd/main/pmd-java/src/main/resources/rulesets/java/quickstart.xml", false, "ConstantsInInterface", "https://raw.githubusercontent.com/pmd/pmd/main/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface", + new RuleSetReferenceId("https://raw.githubusercontent.com/pmd/pmd/main/pmd-java/src/main/resources/rulesets/java/quickstart.xml/ConstantsInInterface")); assertRuleSetReferenceId(true, "https://example.org/ruleset/MyRule", true, null, "https://example.org/ruleset/MyRule", new RuleSetReferenceId("https://example.org/ruleset/MyRule")); assertRuleSetReferenceId(true, "https://example.org/ruleset.xml", false, "MyRule", "https://example.org/ruleset.xml/MyRule", diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/renderers/HTMLRendererTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/renderers/HTMLRendererTest.java index adc1f2cc7d..669faa1337 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/renderers/HTMLRendererTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/renderers/HTMLRendererTest.java @@ -93,7 +93,7 @@ class HTMLRendererTest extends AbstractRendererTest { @Test void testLinkPrefix() throws IOException { final HTMLRenderer renderer = new HTMLRenderer(); - final String linkPrefix = "https://github.com/pmd/pmd/blob/master/"; + final String linkPrefix = "https://github.com/pmd/pmd/blob/main/"; final String linePrefix = "L"; renderer.setProperty(HTMLRenderer.LINK_PREFIX, linkPrefix); renderer.setProperty(HTMLRenderer.LINE_PREFIX, Optional.of(linePrefix)); @@ -106,7 +106,7 @@ class HTMLRendererTest extends AbstractRendererTest { @Test void testLinePrefixNotSet() throws IOException { final HTMLRenderer renderer = new HTMLRenderer(); - final String linkPrefix = "https://github.com/pmd/pmd/blob/master/"; + final String linkPrefix = "https://github.com/pmd/pmd/blob/main/"; renderer.setProperty(HTMLRenderer.LINK_PREFIX, linkPrefix); // dont set line prefix renderer.setProperty(HTMLRenderer.LINE_PREFIX, linePrefix); renderer.setProperty(HTMLRenderer.HTML_EXTENSION, false); @@ -118,7 +118,7 @@ class HTMLRendererTest extends AbstractRendererTest { @Test void testEmptyLinePrefix() throws IOException { final HTMLRenderer renderer = new HTMLRenderer(); - final String linkPrefix = "https://github.com/pmd/pmd/blob/master/"; + final String linkPrefix = "https://github.com/pmd/pmd/blob/main/"; renderer.setProperty(HTMLRenderer.LINK_PREFIX, linkPrefix); renderer.setProperty(HTMLRenderer.LINE_PREFIX, Optional.of("")); renderer.setProperty(HTMLRenderer.HTML_EXTENSION, false); diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 60461ac5a8..adbfbd8e3c 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index 5cb4092835..0eec39f809 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-dart/pom.xml b/pmd-dart/pom.xml index 823d71180c..496115127b 100644 --- a/pmd-dart/pom.xml +++ b/pmd-dart/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 1b847abbb8..9ad286e9a4 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml index 69a470e505..c0b7991017 100644 --- a/pmd-doc/pom.xml +++ b/pmd-doc/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/DeadLinksChecker.java b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/DeadLinksChecker.java index 28b6ce4a39..eea45f8719 100644 --- a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/DeadLinksChecker.java +++ b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/DeadLinksChecker.java @@ -67,7 +67,7 @@ public class DeadLinksChecker { ); // the link is actually pointing to a file in the pmd project - private static final String LOCAL_FILE_PREFIX = "https://github.com/pmd/pmd/blob/master/"; + private static final String LOCAL_FILE_PREFIX = "https://github.com/pmd/pmd/blob/main/"; // don't check links to PMD bugs/issues/pull-requests and some other sites (performance optimization) private static final List IGNORED_URL_PREFIXES = Collections.unmodifiableList(Arrays.asList( diff --git a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java index 24eba979bb..aff45936e7 100644 --- a/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java +++ b/pmd-doc/src/main/java/net/sourceforge/pmd/doc/internal/RuleDocGenerator.java @@ -58,7 +58,7 @@ public class RuleDocGenerator { private static final String DEPRECATION_LABEL = "Deprecated"; private static final String DEPRECATED_RULE_PROPERTY_MARKER = "deprecated!"; - private static final String GITHUB_SOURCE_LINK = "https://github.com/pmd/pmd/blob/master/"; + private static final String GITHUB_SOURCE_LINK = "https://github.com/pmd/pmd/blob/main/"; /** Maintains mapping from pmd terse language name to rouge highlighter language. */ private static final Map LANGUAGE_HIGHLIGHT_MAPPER = new HashMap<>(); diff --git a/pmd-doc/src/test/resources/expected/sample.md b/pmd-doc/src/test/resources/expected/sample.md index e8a7016e4d..63d079b7ba 100644 --- a/pmd-doc/src/test/resources/expected/sample.md +++ b/pmd-doc/src/test/resources/expected/sample.md @@ -167,7 +167,7 @@ Second paragraph. Third paragraph. -**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.errorprone.OverrideBothEqualsAndHashcodeRule](https://github.com/pmd/pmd/blob/master/net/sourceforge/pmd/lang/java/rule/errorprone/OverrideBothEqualsAndHashcodeRule.java) +**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.errorprone.OverrideBothEqualsAndHashcodeRule](https://github.com/pmd/pmd/blob/main/net/sourceforge/pmd/lang/java/rule/errorprone/OverrideBothEqualsAndHashcodeRule.java) **Example(s):** diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index c95bc8df5f..94bc7d94bd 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-gherkin/pom.xml b/pmd-gherkin/pom.xml index fe3227d1aa..6aee2c1be5 100644 --- a/pmd-gherkin/pom.xml +++ b/pmd-gherkin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 7651123d36..4df297ebc9 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-groovy/pom.xml b/pmd-groovy/pom.xml index 6e3436a51c..bf716ac77c 100644 --- a/pmd-groovy/pom.xml +++ b/pmd-groovy/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-html/pom.xml b/pmd-html/pom.xml index 53f8a42a35..86f19c7c01 100644 --- a/pmd-html/pom.xml +++ b/pmd-html/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index 2ff998e827..d8131b8d65 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageRule.java index 915415a0a3..4da48f44b0 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageRule.java @@ -4,41 +4,10 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; -import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; -import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; -import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; -import net.sourceforge.pmd.lang.java.types.InvocationMatcher; -import net.sourceforge.pmd.lang.java.types.InvocationMatcher.CompoundInvocationMatcher; +/** + * @deprecated The rule was renamed {@link UnitTestAssertionsShouldIncludeMessageRule} + */ +@Deprecated +public class JUnitAssertionsShouldIncludeMessageRule extends UnitTestAssertionsShouldIncludeMessageRule { -public class JUnitAssertionsShouldIncludeMessageRule extends AbstractJavaRulechainRule { - - private final CompoundInvocationMatcher checks = - InvocationMatcher.parseAll( - "_#assertEquals(_,_)", - "_#assertTrue(_)", - "_#assertFalse(_)", - "_#assertSame(_,_)", - "_#assertNotSame(_,_)", - "_#assertNull(_)", - "_#assertNotNull(_)", - "_#assertArrayEquals(_,_)", - "_#assertThat(_,_)", - "_#fail()", - "_#assertEquals(float,float,float)", - "_#assertEquals(double,double,double)" - ); - - public JUnitAssertionsShouldIncludeMessageRule() { - super(ASTMethodCall.class); - } - - @Override - public Object visit(ASTMethodCall node, Object data) { - if (TestFrameworksUtil.isCallOnAssertionContainer(node)) { - if (checks.anyMatch(node)) { - asCtx(data).addViolation(node); - } - } - return null; - } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsRule.java index e68ac3e9ac..13b9d247e1 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsRule.java @@ -4,54 +4,10 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; -import java.util.Set; -import java.util.stream.Collectors; +/** + * @deprecated The rule was renamed {@link UnitTestContainsTooManyAssertsRule} + */ +@Deprecated +public class JUnitTestContainsTooManyAssertsRule extends UnitTestContainsTooManyAssertsRule { -import net.sourceforge.pmd.lang.java.ast.ASTBlock; -import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; -import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; -import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; -import net.sourceforge.pmd.properties.NumericConstraints; -import net.sourceforge.pmd.properties.PropertyDescriptor; -import net.sourceforge.pmd.properties.PropertyFactory; - -public class JUnitTestContainsTooManyAssertsRule extends AbstractJavaRulechainRule { - - private static final PropertyDescriptor MAX_ASSERTS = - PropertyFactory.intProperty("maximumAsserts") - .desc("Maximum number of assert calls in a test method") - .require(NumericConstraints.positive()) - .defaultValue(1) - .build(); - - private static final PropertyDescriptor> EXTRA_ASSERT_METHOD_NAMES = - PropertyFactory.stringProperty("extraAssertMethodNames") - .desc("Extra valid assertion methods names") - .map(Collectors.toSet()) - .emptyDefaultValue() - .build(); - - - public JUnitTestContainsTooManyAssertsRule() { - super(ASTMethodDeclaration.class); - definePropertyDescriptor(MAX_ASSERTS); - definePropertyDescriptor(EXTRA_ASSERT_METHOD_NAMES); - } - - @Override - public Object visit(ASTMethodDeclaration method, Object data) { - ASTBlock body = method.getBody(); - if (body != null && TestFrameworksUtil.isTestMethod(method)) { - Set extraAsserts = getProperty(EXTRA_ASSERT_METHOD_NAMES); - int assertCount = body.descendants(ASTMethodCall.class) - .filter(call -> TestFrameworksUtil.isProbableAssertCall(call) - || extraAsserts.contains(call.getMethodName())) - .count(); - if (assertCount > getProperty(MAX_ASSERTS)) { - asCtx(data).addViolation(method); - } - } - return data; - } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertRule.java index b5bf29134b..452e67d033 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertRule.java @@ -4,43 +4,10 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; -import java.util.Set; -import java.util.stream.Collectors; +/** + * @deprecated The rule was renamed {@link UnitTestShouldIncludeAssertRule} + */ +@Deprecated +public class JUnitTestsShouldIncludeAssertRule extends UnitTestShouldIncludeAssertRule { -import net.sourceforge.pmd.lang.java.ast.ASTBlock; -import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; -import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; -import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; -import net.sourceforge.pmd.properties.PropertyDescriptor; -import net.sourceforge.pmd.properties.PropertyFactory; - -public class JUnitTestsShouldIncludeAssertRule extends AbstractJavaRulechainRule { - - private static final PropertyDescriptor> EXTRA_ASSERT_METHOD_NAMES = - PropertyFactory.stringProperty("extraAssertMethodNames") - .desc("Extra valid assertion methods names") - .map(Collectors.toSet()) - .emptyDefaultValue() - .build(); - - public JUnitTestsShouldIncludeAssertRule() { - super(ASTMethodDeclaration.class); - definePropertyDescriptor(EXTRA_ASSERT_METHOD_NAMES); - } - - @Override - public Object visit(ASTMethodDeclaration method, Object data) { - ASTBlock body = method.getBody(); - Set extraAsserts = getProperty(EXTRA_ASSERT_METHOD_NAMES); - if (body != null - && TestFrameworksUtil.isTestMethod(method) - && !TestFrameworksUtil.isExpectAnnotated(method) - && body.descendants(ASTMethodCall.class) - .none(call -> TestFrameworksUtil.isProbableAssertCall(call) - || extraAsserts.contains(call.getMethodName()))) { - asCtx(data).addViolation(method); - } - return data; - } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageRule.java new file mode 100644 index 0000000000..78be7c765e --- /dev/null +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageRule.java @@ -0,0 +1,44 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.bestpractices; + +import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; +import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; +import net.sourceforge.pmd.lang.java.types.InvocationMatcher; +import net.sourceforge.pmd.lang.java.types.InvocationMatcher.CompoundInvocationMatcher; + +public class UnitTestAssertionsShouldIncludeMessageRule extends AbstractJavaRulechainRule { + + private final CompoundInvocationMatcher checks = + InvocationMatcher.parseAll( + "_#assertEquals(_,_)", + "_#assertTrue(_)", + "_#assertFalse(_)", + "_#assertSame(_,_)", + "_#assertNotSame(_,_)", + "_#assertNull(_)", + "_#assertNotNull(_)", + "_#assertArrayEquals(_,_)", + "_#assertThat(_,_)", + "_#fail()", + "_#assertEquals(float,float,float)", + "_#assertEquals(double,double,double)" + ); + + public UnitTestAssertionsShouldIncludeMessageRule() { + super(ASTMethodCall.class); + } + + @Override + public Object visit(ASTMethodCall node, Object data) { + if (TestFrameworksUtil.isCallOnAssertionContainer(node)) { + if (checks.anyMatch(node)) { + asCtx(data).addViolation(node); + } + } + return null; + } +} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsRule.java new file mode 100644 index 0000000000..42168a10b5 --- /dev/null +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsRule.java @@ -0,0 +1,57 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.bestpractices; + +import java.util.Set; +import java.util.stream.Collectors; + +import net.sourceforge.pmd.lang.java.ast.ASTBlock; +import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; +import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; +import net.sourceforge.pmd.properties.NumericConstraints; +import net.sourceforge.pmd.properties.PropertyDescriptor; +import net.sourceforge.pmd.properties.PropertyFactory; + +public class UnitTestContainsTooManyAssertsRule extends AbstractJavaRulechainRule { + + private static final PropertyDescriptor MAX_ASSERTS = + PropertyFactory.intProperty("maximumAsserts") + .desc("Maximum number of assert calls in a test method") + .require(NumericConstraints.positive()) + .defaultValue(1) + .build(); + + private static final PropertyDescriptor> EXTRA_ASSERT_METHOD_NAMES = + PropertyFactory.stringProperty("extraAssertMethodNames") + .desc("Extra valid assertion methods names") + .map(Collectors.toSet()) + .emptyDefaultValue() + .build(); + + + public UnitTestContainsTooManyAssertsRule() { + super(ASTMethodDeclaration.class); + definePropertyDescriptor(MAX_ASSERTS); + definePropertyDescriptor(EXTRA_ASSERT_METHOD_NAMES); + } + + @Override + public Object visit(ASTMethodDeclaration method, Object data) { + ASTBlock body = method.getBody(); + if (body != null && TestFrameworksUtil.isTestMethod(method)) { + Set extraAsserts = getProperty(EXTRA_ASSERT_METHOD_NAMES); + int assertCount = body.descendants(ASTMethodCall.class) + .filter(call -> TestFrameworksUtil.isProbableAssertCall(call) + || extraAsserts.contains(call.getMethodName())) + .count(); + if (assertCount > getProperty(MAX_ASSERTS)) { + asCtx(data).addViolation(method); + } + } + return data; + } +} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertRule.java new file mode 100644 index 0000000000..dc21c4fb1a --- /dev/null +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertRule.java @@ -0,0 +1,46 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule.bestpractices; + +import java.util.Set; +import java.util.stream.Collectors; + +import net.sourceforge.pmd.lang.java.ast.ASTBlock; +import net.sourceforge.pmd.lang.java.ast.ASTMethodCall; +import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule; +import net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil; +import net.sourceforge.pmd.properties.PropertyDescriptor; +import net.sourceforge.pmd.properties.PropertyFactory; + +public class UnitTestShouldIncludeAssertRule extends AbstractJavaRulechainRule { + + private static final PropertyDescriptor> EXTRA_ASSERT_METHOD_NAMES = + PropertyFactory.stringProperty("extraAssertMethodNames") + .desc("Extra valid assertion methods names") + .map(Collectors.toSet()) + .emptyDefaultValue() + .build(); + + public UnitTestShouldIncludeAssertRule() { + super(ASTMethodDeclaration.class); + definePropertyDescriptor(EXTRA_ASSERT_METHOD_NAMES); + } + + @Override + public Object visit(ASTMethodDeclaration method, Object data) { + ASTBlock body = method.getBody(); + Set extraAsserts = getProperty(EXTRA_ASSERT_METHOD_NAMES); + if (body != null + && TestFrameworksUtil.isTestMethod(method) + && !TestFrameworksUtil.isExpectAnnotated(method) + && body.descendants(ASTMethodCall.class) + .none(call -> TestFrameworksUtil.isProbableAssertCall(call) + || extraAsserts.contains(call.getMethodName()))) { + asCtx(data).addViolation(method); + } + return data; + } +} diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java index c16c1a34ed..183cd71fd0 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/internal/DataflowPass.java @@ -636,7 +636,16 @@ public final class DataflowPass { SpanInfo exceptionalState = null; int i = 0; for (ASTCatchClause catchClause : node.getCatchClauses()) { - SpanInfo current = acceptOpt(catchClause, catchSpans.get(i)); + /* + Note: here we absorb the end state of the body, which is not necessary. + We do that to conform to the language's definition of "effective-finality", + which is more conservative than needed. Doing this fixes FPs in LocalVariableCouldBeFinal + at the cost of some FNs in UnusedAssignment. + */ + SpanInfo catchSpan = catchSpans.get(i); + catchSpan.absorb(bodyState); + + SpanInfo current = acceptOpt(catchClause, catchSpan); exceptionalState = current.absorb(exceptionalState); i++; } diff --git a/pmd-java/src/main/resources/category/java/bestpractices.xml b/pmd-java/src/main/resources/category/java/bestpractices.xml index 4bf4a370bf..aa2f4e7255 100644 --- a/pmd-java/src/main/resources/category/java/bestpractices.xml +++ b/pmd-java/src/main/resources/category/java/bestpractices.xml @@ -672,148 +672,11 @@ public class GoodTest { - - -In JUnit 3, the tearDown method was used to clean up all data entities required in running tests. -JUnit 4 skips the tearDown method and executes all methods annotated with @After after running each test. -JUnit 5 introduced @AfterEach and @AfterAll annotations to execute methods after each test or after all tests in the class, respectively. - - 3 - - - - - - - - - - - + - - -In JUnit 3, the setUp method was used to set up all data entities required in running tests. -JUnit 4 skips the setUp method and executes all methods annotated with @Before before all tests. -JUnit 5 introduced @BeforeEach and @BeforeAll annotations to execute methods before each test or before all tests in the class, respectively. - - 3 - - - - -]]> - - - - - - - - - - -In JUnit 3, the framework executed all methods which started with the word test as a unit test. -In JUnit 4, only methods annotated with the @Test annotation are executed. -In JUnit 5, one of the following annotations should be used for tests: @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest. -In TestNG, only methods annotated with the @Test annotation are executed. - - 3 - - - - - - - - - - - - + - - -JUnit assertions should include an informative message - i.e., use the three-argument version of -assertEquals(), not the two-argument version. - - 3 - - - - + - - -Unit tests should not contain too many asserts. Many asserts are indicative of a complex test, for which -it is harder to verify correctness. Consider breaking the test scenario into multiple, shorter test scenarios. -Customize the maximum number of assertions used by this Rule to suit your needs. + -This rule checks for JUnit4, JUnit5 and TestNG Tests, as well as methods starting with "test". - - 3 - - - - - - - -JUnit tests should include at least one assertion. This makes the tests more robust, and using assert -with messages provide the developer a clearer idea of what the test does. - - 3 - - - - + + + + +Unit assertions should include an informative message - i.e., use the three-argument version of +`assertEquals()`, not the two-argument version. + +This rule supports tests using JUnit (3, 4 and 5) and TestNG. + + 3 + + + + + + + + Unit tests should not contain too many asserts. Many asserts are indicative of a complex test, for which + it is harder to verify correctness. Consider breaking the test scenario into multiple, shorter test scenarios. + Customize the maximum number of assertions used by this Rule to suit your needs. + + This rule checks for JUnit (3, 4 and 5) and TestNG Tests. + + 3 + + + + + + + + Unit tests should include at least one assertion. This makes the tests more robust, and using assert + with messages provide the developer a clearer idea of what the test does. + + This rule checks for JUnit (3, 4 and 5) and TestNG Tests. + + 3 + + + + + + + + This rule detects methods called `tearDown()` that are not properly annotated as a cleanup method. + This is primarily intended to assist in upgrading from JUnit 3, where tear down methods were required to be called `tearDown()`. + To a lesser extent, this may help detect omissions under newer JUnit versions, as long as you are following this convention to name the methods. + + JUnit 4 will only execute methods annotated with `@After` after running each test. + JUnit 5 introduced `@AfterEach` and `@AfterAll` annotations to execute methods after each test or after all tests in the class, respectively. + + 3 + + + + + + + + + + + + + + + This rule detects methods called `setUp()` that are not properly annotated as a setup method. + This is primarily intended to assist in upgrading from JUnit 3, where setup methods were required to be called `setUp()`. + To a lesser extent, this may help detect omissions even under newer JUnit versions, as long as you are following this convention to name the methods. + + JUnit 4 will only execute methods annotated with `@Before` before all tests. + JUnit 5 introduced `@BeforeEach` and `@BeforeAll` annotations to execute methods before each test or before all tests in the class, respectively. + + 3 + + + + + + + + + + + + + + + The rule will detect any test method starting with "test" that is not properly annotated, and will therefore not be run. + + In JUnit 4, only methods annotated with the `@Test` annotation are executed. + In JUnit 5, one of the following annotations should be used for tests: `@Test`, `@RepeatedTest`, `@TestFactory`, `@TestTemplate` or `@ParameterizedTest`. + In TestNG, only methods annotated with the `@Test` annotation are executed. + + 3 + + + + + + + + + + + + + --> - - - - - - @@ -45,6 +39,12 @@ + + + + + + diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/AllDataflowRuleTests.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/AllDataflowRuleTests.java new file mode 100644 index 0000000000..a0e8159ddc --- /dev/null +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/AllDataflowRuleTests.java @@ -0,0 +1,32 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.java.rule; + + +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.Suite; + +import net.sourceforge.pmd.lang.java.rule.bestpractices.UnusedAssignmentTest; +import net.sourceforge.pmd.lang.java.rule.codestyle.LocalVariableCouldBeFinalTest; +import net.sourceforge.pmd.lang.java.rule.design.AvoidThrowingNullPointerExceptionTest; +import net.sourceforge.pmd.lang.java.rule.design.ImmutableFieldTest; +import net.sourceforge.pmd.lang.java.rule.design.LawOfDemeterTest; +import net.sourceforge.pmd.lang.java.rule.design.SingularFieldTest; +import net.sourceforge.pmd.lang.java.rule.errorprone.ImplicitSwitchFallThroughTest; +import net.sourceforge.pmd.lang.java.rule.errorprone.InvalidLogMessageFormatTest; + +@Suite +@SelectClasses({ + LocalVariableCouldBeFinalTest.class, + ImmutableFieldTest.class, + UnusedAssignmentTest.class, + LawOfDemeterTest.class, + SingularFieldTest.class, + ImplicitSwitchFallThroughTest.class, + InvalidLogMessageFormatTest.class, + AvoidThrowingNullPointerExceptionTest.class +}) +public class AllDataflowRuleTests { +} diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageTest.java similarity index 76% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageTest.java index e77dd78150..c24f4bcbe0 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitAssertionsShouldIncludeMessageTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestAssertionsShouldIncludeMessageTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnitAssertionsShouldIncludeMessageTest extends PmdRuleTst { +class UnitTestAssertionsShouldIncludeMessageTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsTest.java similarity index 78% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsTest.java index 30404275d4..e0d7780c95 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestContainsTooManyAssertsTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestContainsTooManyAssertsTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnitTestContainsTooManyAssertsTest extends PmdRuleTst { +class UnitTestContainsTooManyAssertsTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertTest.java similarity index 78% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertTest.java index 933f3f612c..bab5134261 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnitTestsShouldIncludeAssertTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldIncludeAssertTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnitTestsShouldIncludeAssertTest extends PmdRuleTst { +class UnitTestShouldIncludeAssertTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseAfterAnnotationTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseAfterAnnotationTest.java similarity index 88% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseAfterAnnotationTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseAfterAnnotationTest.java index 2ea2b290d2..87c0b30c81 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseAfterAnnotationTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseAfterAnnotationTest.java @@ -9,7 +9,7 @@ import org.junit.Before; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnit4TestShouldUseAfterAnnotationTest extends PmdRuleTst { +class UnitTestShouldUseAfterAnnotationTest extends PmdRuleTst { // no additional unit tests public static class BaseTest { diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseBeforeAnnotationTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseBeforeAnnotationTest.java similarity index 88% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseBeforeAnnotationTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseBeforeAnnotationTest.java index 6922491f02..794e4f86b4 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseBeforeAnnotationTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseBeforeAnnotationTest.java @@ -9,7 +9,7 @@ import org.junit.Before; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnit4TestShouldUseBeforeAnnotationTest extends PmdRuleTst { +class UnitTestShouldUseBeforeAnnotationTest extends PmdRuleTst { // no additional unit tests public static class BaseTest { diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseTestAnnotationTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseTestAnnotationTest.java similarity index 77% rename from pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseTestAnnotationTest.java rename to pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseTestAnnotationTest.java index 15b507dafb..3f50bf341c 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/JUnit4TestShouldUseTestAnnotationTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnitTestShouldUseTestAnnotationTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; -class JUnit4TestShouldUseTestAnnotationTest extends PmdRuleTst { +class UnitTestShouldUseTestAnnotationTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedAssignmentTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedAssignmentTest.java index 0401dd83ec..61f8a16b77 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedAssignmentTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/bestpractices/UnusedAssignmentTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.bestpractices; import net.sourceforge.pmd.test.PmdRuleTst; -class UnusedAssignmentTest extends PmdRuleTst { +public class UnusedAssignmentTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableCouldBeFinalTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableCouldBeFinalTest.java index 5c49860210..d87bf490ac 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableCouldBeFinalTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableCouldBeFinalTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.codestyle; import net.sourceforge.pmd.test.PmdRuleTst; -class LocalVariableCouldBeFinalTest extends PmdRuleTst { +public class LocalVariableCouldBeFinalTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/AvoidThrowingNullPointerExceptionTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/AvoidThrowingNullPointerExceptionTest.java index c1b437ab41..e729824a6d 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/AvoidThrowingNullPointerExceptionTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/AvoidThrowingNullPointerExceptionTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; -class AvoidThrowingNullPointerExceptionTest extends PmdRuleTst { +public class AvoidThrowingNullPointerExceptionTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/ImmutableFieldTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/ImmutableFieldTest.java index eb0972d72b..7c614b7dcd 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/ImmutableFieldTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/ImmutableFieldTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; -class ImmutableFieldTest extends PmdRuleTst { +public class ImmutableFieldTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterTest.java index b4e94a6e26..88e54418ac 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/LawOfDemeterTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; -class LawOfDemeterTest extends PmdRuleTst { +public class LawOfDemeterTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/SingularFieldTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/SingularFieldTest.java index 81835c7c5b..b550b06f85 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/SingularFieldTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/design/SingularFieldTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.design; import net.sourceforge.pmd.test.PmdRuleTst; -class SingularFieldTest extends PmdRuleTst { +public class SingularFieldTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/ImplicitSwitchFallThroughTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/ImplicitSwitchFallThroughTest.java index 3a14a27009..71f0e03495 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/ImplicitSwitchFallThroughTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/ImplicitSwitchFallThroughTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.errorprone; import net.sourceforge.pmd.test.PmdRuleTst; -class ImplicitSwitchFallThroughTest extends PmdRuleTst { +public class ImplicitSwitchFallThroughTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/InvalidLogMessageFormatTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/InvalidLogMessageFormatTest.java index 933231b1bc..091595c70e 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/InvalidLogMessageFormatTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/errorprone/InvalidLogMessageFormatTest.java @@ -6,6 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.errorprone; import net.sourceforge.pmd.test.PmdRuleTst; -class InvalidLogMessageFormatTest extends PmdRuleTst { +public class InvalidLogMessageFormatTest extends PmdRuleTst { // no additional unit tests } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitAssertionsShouldIncludeMessage.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestAssertionsShouldIncludeMessage.xml similarity index 100% rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitAssertionsShouldIncludeMessage.xml rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestAssertionsShouldIncludeMessage.xml diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitTestContainsTooManyAsserts.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestContainsTooManyAsserts.xml similarity index 100% rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitTestContainsTooManyAsserts.xml rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestContainsTooManyAsserts.xml diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitTestsShouldIncludeAssert.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestShouldIncludeAssert.xml similarity index 100% rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnitTestsShouldIncludeAssert.xml rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestShouldIncludeAssert.xml diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnit4TestShouldUseAfterAnnotation.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestShouldUseAfterAnnotation.xml similarity index 97% rename from pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnit4TestShouldUseAfterAnnotation.xml rename to pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestShouldUseAfterAnnotation.xml index 69118826e1..7a3121d8fe 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/JUnit4TestShouldUseAfterAnnotation.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnitTestShouldUseAfterAnnotation.xml @@ -136,7 +136,7 @@ public class Foo { [java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592 0 [java] JUnit4TestShouldUseBeforeAnnotation false positive when overriding setUp #1592 0 Definitions in try block reach catch blocks through method calls - 2 - 4,7 + 1 + 4 The initializer for variable 'halfway' is never used (overwritten on line 7) - The value assigned to variable 'halfway' is never used + + Definitions in try block reach catch blocks through method calls 3 - 1 - 8 - - The value assigned to variable 'halfway' is never used - + + 0 + + + + + 5,7,9 The initializer for variable 'a' is never used (overwritten on lines 7, 9 and 11) - The value assigned to variable 'a' is never used (overwritten on line 11) + The value assigned to variable 'a' is never used (overwritten on lines 9 and 11) The value assigned to variable 'a' is never used (overwritten on line 11) + + + [java] LocalVariableCouldBeFinal false positive with try/catch #5046 + 0 + createFileWatcher() { + Optional optionalFileWatcher; // false positive in PMD 7.2.0, cannot be final + try { + optionalFileWatcher = Optional.of(new FileWatcher()); + } catch (final IOException e) { + optionalFileWatcher = Optional.empty(); + } + return optionalFileWatcher; + } + } ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/MissingStaticMethodInNonInstantiatableClass.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/MissingStaticMethodInNonInstantiatableClass.xml index b52d0be101..16e23ab0d4 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/MissingStaticMethodInNonInstantiatableClass.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/MissingStaticMethodInNonInstantiatableClass.xml @@ -614,6 +614,31 @@ import lombok.Builder; public class Foo { private Foo() {} } +]]> +
+ + + #5068:[java] fp when using builder with private constructor + 0 + diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index 03dc85a75e..5e4506efd4 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index a6da55d891..9f1d3fb223 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-julia/pom.xml b/pmd-julia/pom.xml index bf53e57a24..ac3ed6eed1 100644 --- a/pmd-julia/pom.xml +++ b/pmd-julia/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-kotlin/pom.xml b/pmd-kotlin/pom.xml index 797705d698..40f19513de 100644 --- a/pmd-kotlin/pom.xml +++ b/pmd-kotlin/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-lang-test/pom.xml b/pmd-lang-test/pom.xml index b2e328dcb1..49f8aade09 100644 --- a/pmd-lang-test/pom.xml +++ b/pmd-lang-test/pom.xml @@ -12,7 +12,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-languages-deps/pom.xml b/pmd-languages-deps/pom.xml index d10632ed97..38f0d009e8 100644 --- a/pmd-languages-deps/pom.xml +++ b/pmd-languages-deps/pom.xml @@ -4,7 +4,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT pmd-languages-deps diff --git a/pmd-lua/pom.xml b/pmd-lua/pom.xml index 69e2f52f7f..f3a24be6d3 100644 --- a/pmd-lua/pom.xml +++ b/pmd-lua/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index 56a052c78d..373fa78a8d 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml index 148463da16..639c224e2c 100644 --- a/pmd-modelica/pom.xml +++ b/pmd-modelica/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index 6abcd2a7eb..66818f1a47 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-perl/pom.xml b/pmd-perl/pom.xml index 3b28d3cc61..3cb972b403 100644 --- a/pmd-perl/pom.xml +++ b/pmd-perl/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index aefd501fe4..88f09db7a4 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index 81e20a53d7..2e6ad097a4 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index ce43de76dd..85b6643126 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index ed664e81f8..9acaabbf96 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-scala-modules/pmd-scala-common/pom.xml b/pmd-scala-modules/pmd-scala-common/pom.xml index e3f8af4612..80ad4da7bd 100644 --- a/pmd-scala-modules/pmd-scala-common/pom.xml +++ b/pmd-scala-modules/pmd-scala-common/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../../pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.12/pom.xml b/pmd-scala-modules/pmd-scala_2.12/pom.xml index ba1409b1c9..3f73f1cbfb 100644 --- a/pmd-scala-modules/pmd-scala_2.12/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.12/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pmd-scala-common/pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.13/pom.xml b/pmd-scala-modules/pmd-scala_2.13/pom.xml index 394545d1af..ee66fca93a 100644 --- a/pmd-scala-modules/pmd-scala_2.13/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.13/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd-scala-common - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pmd-scala-common/pom.xml diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index 9a9114fc76..023fa8dd39 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-test-schema/pom.xml b/pmd-test-schema/pom.xml index 0e523bc688..43a990e8dc 100644 --- a/pmd-test-schema/pom.xml +++ b/pmd-test-schema/pom.xml @@ -11,7 +11,7 @@ pmd net.sourceforge.pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index dd5aa868f8..0fd57a4437 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-tsql/pom.xml b/pmd-tsql/pom.xml index ee68fd8441..e3a2489eff 100644 --- a/pmd-tsql/pom.xml +++ b/pmd-tsql/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-velocity/pom.xml b/pmd-velocity/pom.xml index dee695afc9..6cb54b0cd5 100644 --- a/pmd-velocity/pom.xml +++ b/pmd-velocity/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml index a5616f85b0..7ae874578d 100644 --- a/pmd-visualforce/pom.xml +++ b/pmd-visualforce/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index e8f276a171..1d19200b86 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -7,7 +7,7 @@ net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index aef0039d8b..8f0474ab59 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.sourceforge.pmd pmd - 7.6.0-SNAPSHOT + 7.7.0-SNAPSHOT pom PMD @@ -83,7 +83,7 @@ - 2024-08-30T08:11:07Z + 2024-09-27T08:50:09Z 8 @@ -115,7 +115,7 @@ -Xmx512m -Dfile.encoding=${project.build.sourceEncoding} ${extraArgLine} - 27-SNAPSHOT + 27 7.2.0 ${settings.localRepository}/net/java/dev/javacc/javacc/${javacc.version}/javacc-${javacc.version}.jar @@ -611,7 +611,7 @@ org.jacoco jacoco-maven-plugin - 0.8.11 + 0.8.12 org.cyclonedx @@ -886,7 +886,7 @@ com.google.code.gson gson - 2.10.1 + 2.11.0 org.yaml @@ -1089,7 +1089,7 @@ com.google.protobuf protobuf-java - 3.25.3 + 3.25.5