You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/07/15 11:26:13 UTC

[GitHub] [netbeans] junichi11 commented on a change in pull request #2254: [NETBEANS-4573] PHP CS Fixer doesn't work with a directory and a file

junichi11 commented on a change in pull request #2254:
URL: https://github.com/apache/netbeans/pull/2254#discussion_r454980440



##########
File path: php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodingStandardsFixer.java
##########
@@ -172,15 +172,17 @@ public void startAnalyzeGroup() {
     public List<Result> analyze(CodingStandardsFixerParams params, FileObject file) {
         assert file.isValid() : "Invalid file given: " + file;
         try {
-            
-            Integer result = getExecutable(Bundle.CodingStandardsFixer_analyze(analyzeGroupCounter++), findWorkDir(file))
+            File workDir = findWorkDir(file);
+            Integer result = getExecutable(Bundle.CodingStandardsFixer_analyze(analyzeGroupCounter++), workDir)
                     .additionalParameters(getParameters(params, file))
                     .runAndWait(getDescriptor(), "Running coding standards fixer..."); // NOI18N
             if (result == null) {
                 return null;
             }
-
-            return CodingStandardsFixerReportParser.parse(XML_LOG, file);
+            // if the project for the file is not found(i.e. if the workDir is not found),
+            // the results are not shown in the inspector window
+            FileObject root = workDir != null ? FileUtil.toFileObject(workDir) : file;
+            return CodingStandardsFixerReportParser.parse(XML_LOG, root);

Review comment:
       I think it's OK. It just worked with the project directory (i.e. when the working directory is the project directory) before I fixed this. 
   The case where the project directory(i.e. working directory) cannot be found: a user inspects a file or a directory from a Favorite pane. In such case, the API side doesn't show the result in the inspector window. But the XML result is shown in the Output window. I confirmed that.




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

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



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

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists