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 3ec237c [NETBEANS-3243] Prioritize "--standard" parameter of the path of Code Sniffer new 8b605a2 Merge pull request #1574 from junichi11/netbeans-3243 3ec237c is described below commit 3ec237c7763ad795bf40c2bdc2576ba870cb7538 Author: Junichi Yamamoto <junich...@apache.org> AuthorDate: Thu Oct 17 23:27:13 2019 +0900 [NETBEANS-3243] Prioritize "--standard" parameter of the path of Code Sniffer Before: If `/path/to/phpcs --standard=/path/to/ruleset.xml -s` is set to the path of Code Sniffer, `--standard` parameter is added twice. ``` "/usr/bin/php" "/path/to/phpcs" "--standard=/path/to/ruleset.xml" "-s" "--standard=MySource" "--report=xml" "--extensions=phtml,php,php4,php5,php3,phpt,inc" "--encoding=UTF-8" "/path/to/target.php" ``` After: If the path have that parameter, just use only it. ``` "/usr/bin/php" "/path/to/phpcs" "--standard=/path/to/ruleset.xml" "-s" "--report=xml" "--extensions=phtml,php,php4,php5,php3,phpt,inc" "--encoding=UTF-8" "/path/to/target.php" ``` --- .../netbeans/modules/php/analysis/commands/CodeSniffer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 2575121..e18d698 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 @@ -64,7 +64,8 @@ public final class CodeSniffer { static final File XML_LOG = new File(System.getProperty("java.io.tmpdir"), "nb-php-phpcs-log.xml"); // NOI18N // #270987 use --standard instead of --runtime-set default_standard - private static final String STANDARD_PARAM = "--standard=%s"; // NOI18N + private static final String STANDARD_PARAM = "--standard"; // NOI18N + private static final String STANDARD_PARAM_FORMAT = STANDARD_PARAM + "=%s"; // NOI18N private static final String RUNTIME_SET_PARAM = "--runtime-set"; // NOI18N private static final String DEFAULT_STANDARD_PARAM = "default_standard"; // NOI18N private static final String LIST_STANDARDS_PARAM = "-i"; // NOI18N @@ -237,8 +238,12 @@ public final class CodeSniffer { private List<String> getParameters(String standard, FileObject file, boolean noRecursion) { Charset encoding = FileEncodingQuery.getEncoding(file); List<String> params = new ArrayList<>(); - // #270987 use --standard - params.add(String.format(STANDARD_PARAM, standard)); + // NETBEANS-3243 the path of Code Sniffer may have --standard parameter + if (!codeSnifferPath.contains(STANDARD_PARAM + "=") // NOI18N + && !codeSnifferPath.contains(STANDARD_PARAM + " ")) { // NOI18N + // #270987 use --standard + params.add(String.format(STANDARD_PARAM_FORMAT, standard)); + } params.add(REPORT_PARAM); params.add(String.format(EXTENSIONS_PARAM, StringUtils.implode(FileUtil.getMIMETypeExtensions(FileUtils.PHP_MIME_TYPE), ","))); // NOI18N params.add(String.format(ENCODING_PARAM, encoding.name())); --------------------------------------------------------------------- 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