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..d664bbbe3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - master tags: - '**' pull_request: diff --git a/.github/workflows/git-repo-sync.yml b/.github/workflows/git-repo-sync.yml index e4413efb3f..fe2c156ce0 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: 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/README.md b/README.md index a08c66d76c..0d2253b4e8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # 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/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) 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/_config.yml b/docs/_config.yml index 372d019c17..4213ed8b41 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -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/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..c0e4760e54 100644 --- a/docs/pages/pmd/userdocs/pmd_report_formats.md +++ b/docs/pages/pmd/userdocs/pmd_report_formats.md @@ -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 cabc0d7b83..5cde4e3dcd 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,6 +14,40 @@ This is a {{ site.pmd.release_type }} release. ### 🚀 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 diff --git a/docs/pages/release_notes_old.md b/docs/pages/release_notes_old.md index 575700bafa..1dbd44da28 100644 --- a/docs/pages/release_notes_old.md +++ b/docs/pages/release_notes_old.md @@ -7635,7 +7635,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/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-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):**