You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "lokidundun (via GitHub)" <gi...@apache.org> on 2025/11/13 15:59:04 UTC

[PR] optimize: highlight pmd-check log [incubator-seata]

lokidundun opened a new pull request, #7781:
URL: https://github.com/apache/incubator-seata/pull/7781

   <!--
       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.
   -->
   <!-- Please make sure you have read and understood the contributing guidelines -->
   
   - [x] I have read the [CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md) guidelines.
   - [ ] I have registered the PR [changes](https://github.com/apache/incubator-seata/tree/2.x/changes).
   
   ### Ⅰ. Describe what this PR did
   If the build fails, pmd-check will only output logs at the info level, which is difficult to see in the large number of logs generated by the ci build process.
   Therefore, it is changed to add the error level and highlighted after the detail information to make it easier for developers to view
   
   <img width="1911" height="841" alt="dc8cfd9da2e3369a3ce9b44a34b616e1" src="https://github.com/user-attachments/assets/46f5023e-1547-48cf-97c8-2cae6c5c4cef" />
   
   
   ### Ⅱ. Does this pull request fix one issue?
   <!-- If that, add "fixes #xxx" below in the next line, for example, fixes #97. -->
   
   
   ### Ⅲ. Why don't you add test cases (unit test/integration test)? 
   
   
   ### Ⅳ. Describe how to verify it
   
   
   ### Ⅴ. Special notes for reviews
   
   


-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: highlight pmd-check log [incubator-seata]

Posted by "lokidundun (via GitHub)" <gi...@apache.org>.
lokidundun commented on code in PR #7781:
URL: https://github.com/apache/incubator-seata/pull/7781#discussion_r2525855181


##########
.github/workflows/build.yml:
##########
@@ -84,7 +84,13 @@ jobs:
                  -Dpmd.skip=false -Dlicense.skip=false -DredisCaseEnabled=true -DnacosCaseEnabled=true \
                  -e -B \
                  -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error;
+                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=info \
+                 2>&1 | tee build.log | while read line; do
+                   echo "$line"
+                   if [[ "$line" == *"PMD Failure"* ]]; then
+                     echo "::error::PMD Violations Detected! Check Details Above!"
+                   fi
+                 done

Review Comment:
   `exit_code=${PIPESTATUS[0]}
   exit $exit_code`
   This should not be added; otherwise, the CI will exit prematurely, and the complete logs cannot be viewed.



-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: highlight pmd-check log [incubator-seata]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7781:
URL: https://github.com/apache/incubator-seata/pull/7781#issuecomment-3528532247

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/7781?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 67.06%. Comparing base ([`5a89e80`](https://app.codecov.io/gh/apache/incubator-seata/commit/5a89e80734ec1a39d6d5215c3d691e6cff02769f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`433cf5b`](https://app.codecov.io/gh/apache/incubator-seata/commit/433cf5b54a3ebeef0336eb175e43bef469f0d865?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##                2.x    #7781      +/-   ##
   ============================================
   - Coverage     69.18%   67.06%   -2.12%     
   - Complexity      992     2148    +1156     
   ============================================
     Files          1322      514     -808     
     Lines         50175    17200   -32975     
     Branches       5932     2214    -3718     
   ============================================
   - Hits          34712    11535   -23177     
   + Misses        12548     4709    -7839     
   + Partials       2915      956    -1959     
   ```
   [see 904 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/7781/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/incubator-seata/pull/7781/graphs/tree.svg?width=650&height=150&src=pr&token=tbmHt2ZfxO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/incubator-seata/pull/7781?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: highlight pmd-check log [incubator-seata]

Posted by "lokidundun (via GitHub)" <gi...@apache.org>.
lokidundun commented on code in PR #7781:
URL: https://github.com/apache/incubator-seata/pull/7781#discussion_r2525855181


##########
.github/workflows/build.yml:
##########
@@ -84,7 +84,13 @@ jobs:
                  -Dpmd.skip=false -Dlicense.skip=false -DredisCaseEnabled=true -DnacosCaseEnabled=true \
                  -e -B \
                  -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error;
+                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=info \
+                 2>&1 | tee build.log | while read line; do
+                   echo "$line"
+                   if [[ "$line" == *"PMD Failure"* ]]; then
+                     echo "::error::PMD Violations Detected! Check Details Above!"
+                   fi
+                 done

Review Comment:
   `exit_code=${PIPESTATUS[0]}
   exit $exit_code`
   This should not be added; otherwise, the CI will exit prematurely, and the complete logs cannot be viewed.



-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: highlight pmd-check log [incubator-seata]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7781:
URL: https://github.com/apache/incubator-seata/pull/7781#discussion_r2525473621


##########
.github/workflows/build.yml:
##########
@@ -84,7 +84,13 @@ jobs:
                  -Dpmd.skip=false -Dlicense.skip=false -DredisCaseEnabled=true -DnacosCaseEnabled=true \
                  -e -B \
                  -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error;
+                 -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=info \
+                 2>&1 | tee build.log | while read line; do
+                   echo "$line"
+                   if [[ "$line" == *"PMD Failure"* ]]; then
+                     echo "::error::PMD Violations Detected! Check Details Above!"
+                   fi
+                 done

Review Comment:
   The pipe to `while read` loop creates a subshell that can mask the Maven command's exit code. If Maven fails (including PMD failures), the workflow step might still succeed because the exit code of the last command in the pipeline (the while loop) is returned instead of Maven's exit code.
   
   To fix this, you should:
   1. Set `set -o pipefail` to ensure the pipeline fails if Maven fails
   2. Capture and preserve the Maven exit code explicitly
   
   Suggested fix:
   ```bash
   set -o pipefail
   ./mvnw -T 4C clean test \
          -Dpmd.skip=false -Dlicense.skip=false -DredisCaseEnabled=true -DnacosCaseEnabled=true \
          -e -B \
          -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
          -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=info \
          2>&1 | tee build.log | while read line; do
            echo "$line"
            if [[ "$line" == *"PMD Failure"* ]]; then
              echo "::error::PMD Violations Detected! Check Details Above!"
            fi
          done
   exit_code=${PIPESTATUS[0]}
   exit $exit_code
   ```



-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] optimize: highlight pmd-check log [incubator-seata]

Posted by "maple525866 (via GitHub)" <gi...@apache.org>.
maple525866 merged PR #7781:
URL: https://github.com/apache/incubator-seata/pull/7781


-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org