This is an automated email from the ASF dual-hosted git repository. junichi11 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 4fd0dbf [NETBEANS-4571] Show Static Analysis configuration files in Important Files new 48e04bb Merge pull request #2249 from KacerCZ/netbeans-4571-static-analysis-important-files 4fd0dbf is described below commit 4fd0dbf366ff1ca2b35b8c7b5690906e9115e24d Author: Tomas Prochazka <ka...@razdva.cz> AuthorDate: Sat Jul 11 18:55:28 2020 +0200 [NETBEANS-4571] Show Static Analysis configuration files in Important Files https://issues.apache.org/jira/browse/NETBEANS-4571 Added standard configuration files of PHP static analysis tools to Important Files. --- .../modules/php/analysis/ImportantFilesImpl.java | 66 ++++++++++++++++++++++ .../modules/php/analysis/commands/CodeSniffer.java | 6 ++ .../analysis/commands/CodingStandardsFixer.java | 4 ++ .../modules/php/analysis/commands/PHPStan.java | 4 ++ 4 files changed, 80 insertions(+) diff --git a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ImportantFilesImpl.java b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ImportantFilesImpl.java new file mode 100644 index 0000000..7be381e --- /dev/null +++ b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ImportantFilesImpl.java @@ -0,0 +1,66 @@ +/* + * 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. + */ +package org.netbeans.modules.php.analysis; + +import java.util.Collection; +import javax.swing.event.ChangeListener; +import org.netbeans.api.project.Project; +import org.netbeans.modules.php.analysis.commands.CodeSniffer; +import org.netbeans.modules.php.analysis.commands.CodingStandardsFixer; +import org.netbeans.modules.php.analysis.commands.PHPStan; +import org.netbeans.modules.php.spi.phpmodule.ImportantFilesImplementation; +import org.netbeans.modules.php.spi.phpmodule.ImportantFilesSupport; +import org.netbeans.spi.project.ProjectServiceProvider; + +@ProjectServiceProvider(service = ImportantFilesImplementation.class, projectType = "org-netbeans-modules-php-project") // NOI18N +public final class ImportantFilesImpl implements ImportantFilesImplementation { + + private static final String[] CONFIG_FILE_NAMES = { + CodeSniffer.CONFIG_FILE_NAME, + CodeSniffer.DOT_CONFIG_FILE_NAME, + CodeSniffer.DIST_CONFIG_FILE_NAME, + CodeSniffer.DIST_DOT_CONFIG_FILE_NAME, + CodingStandardsFixer.CONFIG_FILE_NAME, + CodingStandardsFixer.DIST_CONFIG_FILE_NAME, + PHPStan.CONFIG_FILE_NAME, + PHPStan.DIST_CONFIG_FILE_NAME}; + + private final ImportantFilesSupport support; + + public ImportantFilesImpl(Project project) { + assert project != null; + support = ImportantFilesSupport.create(project.getProjectDirectory(), CONFIG_FILE_NAMES); + } + + @Override + public Collection<ImportantFilesImplementation.FileInfo> getFiles() { + return support.getFiles(null); + } + + @Override + public void addChangeListener(ChangeListener listener) { + support.addChangeListener(listener); + } + + @Override + public void removeChangeListener(ChangeListener listener) { + support.removeChangeListener(listener); + } + +} diff --git a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodeSniffer.java b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodeSniffer.java index 77a487e..a3dbc56 100644 --- a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodeSniffer.java +++ b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodeSniffer.java @@ -75,6 +75,12 @@ public final class CodeSniffer { private static final String IGNORE_PARAM = "--ignore=%s"; // NOI18N private static final String NO_RECURSION_PARAM = "-l"; // NOI18N + // configuration files + public static final String CONFIG_FILE_NAME = "phpcs.xml"; // NOI18N + public static final String DOT_CONFIG_FILE_NAME = ".phpcs.xml"; // NOI18N + public static final String DIST_CONFIG_FILE_NAME = "phpcs.xml.dist"; // NOI18N + public static final String DIST_DOT_CONFIG_FILE_NAME = ".phpcs.xml.dist"; // NOI18N + // cache private static final List<String> CACHED_STANDARDS = new CopyOnWriteArrayList<>(); diff --git a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodingStandardsFixer.java b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodingStandardsFixer.java index 62ba3ef..0d58c9d 100644 --- a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodingStandardsFixer.java +++ b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/CodingStandardsFixer.java @@ -86,6 +86,10 @@ public final class CodingStandardsFixer { ANSI_PARAM, NO_INTERACTION_PARAM); + // configuration files + public static final String CONFIG_FILE_NAME = ".php_cs"; // NOI18N + public static final String DIST_CONFIG_FILE_NAME = ".php_cs.dist"; // NOI18N + @org.netbeans.api.annotations.common.SuppressWarnings(value = "MS_MUTABLE_COLLECTION", justification = "It is immutable") // NOI18N public static final List<String> VERSIONS = Arrays.asList( "1", // NOI18N diff --git a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/PHPStan.java b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/PHPStan.java index 997a561..a4652dc 100644 --- a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/PHPStan.java +++ b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/commands/PHPStan.java @@ -75,6 +75,10 @@ public final class PHPStan { ERROR_FORMAT_PARAM ); + // configuration files + public static final String CONFIG_FILE_NAME = "phpstan.neon"; // NOI18N + public static final String DIST_CONFIG_FILE_NAME = "phpstan.neon.dist"; // NOI18N + private final String phpStanPath; private int analyzeGroupCounter = 1; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists