You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/26 14:23:55 UTC

[GitHub] [maven-pmd-plugin] adangel commented on a diff in pull request #66: [MPMD-336] Replace deprecated calls to PMD

adangel commented on code in PR #66:
URL: https://github.com/apache/maven-pmd-plugin/pull/66#discussion_r882725487


##########
src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java:
##########
@@ -323,6 +307,26 @@ private PmdResult run() throws MavenReportException
         return new PmdResult( new File( request.getTargetDirectory(), "pmd.xml" ), request.getOutputEncoding() );
     }
 
+    /**
+     * Gets the errors as a single string. Each error is in its own line.
+     * @param withDetails if <code>true</code> then add the error details additionally (contains e.g. the stacktrace)
+     * @return the errors as string
+     */
+    private String getErrorsAsString( List<Report.ProcessingError> errors, boolean withDetails )
+    {
+        List<String> errorsAsString = new ArrayList<>( errors.size() );
+        for ( Report.ProcessingError error : errors )
+        {
+            errorsAsString.add( error.getFile() + ": " + error.getMsg() );
+            if ( withDetails )
+            {
+                errorsAsString.add( error.getDetail() );

Review Comment:
   That's fine, because we collect separate lines (errorsAsString is a `List<String>`) and later join them.



-- 
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