Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/phpstan #21

Merged
merged 6 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions SUPPORTED-FORMATS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- DO NOT EDIT - Generated by ToolsLister at 2019-03-25T10:03:11.888-->
<!--- DO NOT EDIT - Generated by ToolsLister at 2019-03-27T20:39:21.753-->
# Supported Report Formats

Jenkins' Warnings Next Generation Plugin supports the following report formats.
Expand Down Expand Up @@ -79,32 +79,33 @@ the [Analysis Parsers Library](https://github.com/jenkinsci/analysis-model/).
| 63 | perl-critic | perlCritic() | - - | Perl::Critic | |
| 64 | php | php() | - - | PHP Runtime | |
| 65 | php-code-sniffer | phpCodeSniffer() | - - | [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) | |
| 66 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | |
| 67 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml |
| 68 | prefast | prefast() | - - | PREfast | |
| 69 | puppetlint | puppetLint() | - - | Puppet-Lint | |
| 70 | pydocstyle | pyDocStyle() | - - | Pydocstyle | |
| 71 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | |
| 72 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | |
| 73 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | |
| 74 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | |
| 75 | robocopy | robocopy() | - - | Robocopy | |
| 76 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | |
| 77 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | |
| 78 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | |
| 79 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | |
| 80 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json |
| 81 | sphinx | sphinxBuild() | - - | Sphinx-build | |
| 82 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml |
| 83 | stylecop | styleCop() | - - | StyleCop | |
| 84 | sunc | sunC() | - - | SUN C++ Compiler | |
| 85 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | |
| 86 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | |
| 87 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | |
| 88 | tnsdl | tnsdl() | - - | TNSDL Translator | |
| 89 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | |
| 90 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | |
| 91 | xmllint | xmlLint() | - - | XML Lint | |
| 92 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | |
| 93 | yui | yuiCompressor() | - - | YUI Compressor | |
| 94 | zptlint | zptLint() | - - | ZPT Lint | |
| 66 | phpstan | phpStan() | ![PHPStan](src/main/webapp/icons/phpstan-24x24.png) ![PHPStan](src/main/webapp/icons/phpstan-48x48.png) | [PHPStan](https://github.com/phpstan/phpstan) | |
| 67 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | |
| 68 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml |
| 69 | prefast | prefast() | - - | PREfast | |
| 70 | puppetlint | puppetLint() | - - | Puppet-Lint | |
| 71 | pydocstyle | pyDocStyle() | - - | Pydocstyle | |
| 72 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | |
| 73 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | |
| 74 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | |
| 75 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | |
| 76 | robocopy | robocopy() | - - | Robocopy | |
| 77 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | |
| 78 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | |
| 79 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | |
| 80 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | |
| 81 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json |
| 82 | sphinx | sphinxBuild() | - - | Sphinx-build | |
| 83 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml |
| 84 | stylecop | styleCop() | - - | StyleCop | |
| 85 | sunc | sunC() | - - | SUN C++ Compiler | |
| 86 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | |
| 87 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | |
| 88 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | |
| 89 | tnsdl | tnsdl() | - - | TNSDL Translator | |
| 90 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | |
| 91 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | |
| 92 | xmllint | xmlLint() | - - | XML Lint | |
| 93 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | |
| 94 | yui | yuiCompressor() | - - | YUI Compressor | |
| 95 | zptlint | zptLint() | - - | ZPT Lint | |
70 changes: 70 additions & 0 deletions src/main/java/io/jenkins/plugins/analysis/warnings/PhpStan.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package io.jenkins.plugins.analysis.warnings;

import edu.hm.hafner.analysis.parser.checkstyle.CheckStyleParser;
import edu.umd.cs.findbugs.annotations.NonNull;

import org.kohsuke.stapler.DataBoundConstructor;
import org.jenkinsci.Symbol;
import hudson.Extension;

import io.jenkins.plugins.analysis.core.model.IconLabelProvider;
import io.jenkins.plugins.analysis.core.model.ReportScanningTool;
import io.jenkins.plugins.analysis.core.model.StaticAnalysisLabelProvider;

/**
* Provides a parser and customized messages for PHPStan. Delegates to {@link CheckStyleParser}.
*
* @author Jeroen Jans
*/
public class PhpStan extends ReportScanningTool {
private static final long serialVersionUID = 2699509705079011738L;

private static final String ID = "phpstan";

/** Creates a new instance of {@link PhpStan}. */
@DataBoundConstructor
public PhpStan() {
super();
}

@Override
public CheckStyleParser createParser() {
return new CheckStyleParser();
}

/** Descriptor for this static analysis tool. */
@Symbol("phpStan")
@Extension
public static class Descriptor extends ReportScanningToolDescriptor {
/** Creates the descriptor instance. */
public Descriptor() {
super(ID);
}

@NonNull
@Override
public String getDisplayName() {
return Messages.Warnings_PhpStan_Name();
}

@Override
public boolean canScanConsoleLog() {
return false;
}

@Override
public String getHelp() {
return "Use the options: --no-progress --error-format checkstyle";
}

@Override
public String getUrl() {
return "https://github.com/phpstan/phpstan";
}

@Override
public StaticAnalysisLabelProvider getLabelProvider() {
return new IconLabelProvider(getId(), getDisplayName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Warnings.OpenTasks.Name=Open Tasks Scanner
Warnings.Infer.Name=Infer
Warnings.YamlLint.Name=YamlLint
Warnings.PhpCodeSniffer.Name=PHP_CodeSniffer
Warnings.PhpStan.Name=PHPStan
Warnings.TSLint.Name=TSLint
Warnings.SwiftLint.Name=SwiftLint
Warnings.ESlint.Name=ESlint
Expand Down
10 changes: 10 additions & 0 deletions src/main/webapp/icons/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ https://fontawesome.com/license

------------------------------------------------------------------------------

License for PHPStan icons

https://github.com/phpstan/phpstan/issues/2035#issuecomment-477313987

Original file: https://pbs.twimg.com/profile_images/985882871700361216/7_CAOhlW_400x400.jpg
The 24x24 and 48x48 icons were created from this file. No modifications were made, except
the scale that was changed.

------------------------------------------------------------------------------

License for Pylint icons

https://creativecommons.org/licenses/by-sa/4.0/
Expand Down
Binary file added src/main/webapp/icons/phpstan-24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/icons/phpstan-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,14 @@ public void shouldFindAllPhpIssues() {
shouldFindIssuesOfTool(5, new Php(), "php.txt");
}

/**
* Runs the PHPStan scanner on an output file that contains 14 issues.
*/
@Test
public void shouldFindAllPhpStanIssues() {
shouldFindIssuesOfTool(11, new PhpStan(), "phpstan.xml");
}

/** Runs the Microsoft PreFast parser on an output file that contains 11 issues. */
@Test
public void shouldFindAllPREfastIssues() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="src\Controller\IndexController.php">
<error line="297" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getQuery()." />
<error line="347" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getQuery()." />
<error line="348" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getQuery()." />
<error line="353" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getQuery()." />
<error line="389" column="1" severity="error" message="Cannot call method convertType() on array|object." />
<error line="496" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getPost()." />
<error line="499" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getPost()." />
<error line="500" column="1" severity="error" message="Call to an undefined method Zend\Stdlib\RequestInterface::getPost()." />
<error line="701" column="1" severity="error" message="Access to protected property Product::$_id." />
<error line="713" column="1" severity="error" message="Result of method Stock::setProduct() (void) is used." />
</file>
<file name="src\Controller\ProductController.php">
<error line="293" column="1" severity="error" message="Access to protected property Product::$category." />
</file>
</checkstyle>