You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "UncleOwen (via GitHub)" <gi...@apache.org> on 2026/04/21 16:44:54 UTC

[PR] Warn only once about deprecated rules. [maven-pmd-plugin]

UncleOwen opened a new pull request, #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703

   See https://github.com/pmd/pmd/issues/6610
   
   PmdAnalysis.create() already warns about deprecated rules. No need to load them twice, just to trigger the warning.
   
   Added an integration test that is basically a copy of MPMD-268-deprecated-rules - just checks for exactly one log message instead of at least one.
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
   - [X] Your pull request should address just one issue, without pulling in other changes.
   - [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [X] Each commit in the pull request should have a meaningful subject line and body.
     Note that commits might be squashed by a maintainer on merge.
   - [X] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
     This may not always be possible but is a best-practice.
   - [X] Run `mvn verify` to make sure basic checks pass.
     A more thorough check will be performed on your pull request automatically.
   - [X] You have run the integration tests successfully (`mvn -Prun-its verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
   - [X] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski merged PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "UncleOwen (via GitHub)" <gi...@apache.org>.
UncleOwen commented on PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703#issuecomment-4290731541

   Fine with me :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703#discussion_r3119090397


##########
src/it/PMD-6610-warn-only-once-about-deprecated-rules/verify.groovy:
##########
@@ -0,0 +1,24 @@
+import org.apache.commons.lang3.StringUtils
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+assert StringUtils.countMatches(buildLog.text, "Use Rule name category/java/codestyle.xml/ControlStatementBraces instead of the deprecated Rule name" ) == 1

Review Comment:
   try simply:
   ```
   assert  buildLog.text.count(...) == 1
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703#discussion_r3119071571


##########
src/it/PMD-6610-warn-only-once-about-deprecated-rules/src/main/java/sample/Sample.java:
##########
@@ -0,0 +1,24 @@
+package sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class Sample
+{
+}

Review Comment:
   missing end line



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703#issuecomment-4290611201

   > Added an integration test that is basically a copy of [MPMD-268-deprecated-rules](https://issues.apache.org/jira/browse/MPMD-268-deprecated-rules) - just checks for exactly one log message instead of at least one.
   
   now I see we have the seme test.
   I would like to change asertion in existing instead of adding a copy
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Warn only once about deprecated rules. [maven-pmd-plugin]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #703:
URL: https://github.com/apache/maven-pmd-plugin/pull/703#issuecomment-4291993401

   @slawekjaranowski Please assign appropriate label to PR according to the type of change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org