Skip to content

Commit 0bd171e

Browse files
committed
init commit
0 parents  commit 0bd171e

15 files changed

+5116
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* linguist-vendored
2+
*.php linguist-vendored=false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.idea/*
2+
/vendor/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Tomas Pospisil
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# PHPStan FileOutput
2+
An error formatter for [Easy Coding Standard](https://github.com/phpstan/phpstan) that exports analysis result into HTML file
3+
4+
## Installation
5+
```
6+
composer require noximo/phpstan-fileoutput
7+
```
8+
9+
## Usage
10+
Edit or create your phpstan.neon file and register new error formatter.
11+
First two parameters are mandatory.
12+
13+
- First specifies path to file in which data will be outputed.
14+
15+
- Second specifies which other formatter will be used with FileOutput formatter running silently in the background. You can set it to null if you wish to only work with FileOutput-generated files.
16+
```
17+
services:
18+
errorFormatter.fileoutput: # Can be any name after errorFormatter
19+
class: noximo\FileOutput(./example/phpstan.html, null)
20+
```
21+
22+
You can (and should) specify second parameter to use one of the other formatters as well, so console output will be unaffected:
23+
```
24+
class: noximo\FileOutput(./example/phpstan.html, @errorFormatter.raw)
25+
```
26+
At the time of writing of this readme these formatters were available by default in PHPStan:
27+
- ```errorFormatter.checkstyle```,
28+
- ```errorFormatter.json```,
29+
- ```errorFormatter.prettyJson```,
30+
- ```errorFormatter.raw```,
31+
- ```errorFormatter.table```
32+
33+
_Check [PHPStan repository](https://github.com/phpstan/phpstan) for possible updates._
34+
35+
Third parameter sets custom output template.
36+
```
37+
class: noximo\FileOutput(./example/phpstan.html, null, ./tests/alternative_table.phtml)
38+
```
39+
See [table.phtml](/src/table.phtml) for implementation details and data structure.
40+
41+
## Output
42+
FileOutputer will generate HTML file (assuming default template) with hyperlinks directly into PHP files where errors were encountered. If you want to leverage clickable links, set up your enviromenent according to this article: [https://tracy.nette.org/en/open-files-in-ide](https://tracy.nette.org/en/open-files-in-ide)
43+
44+
Note: When you fix an error, file structure and line numbers can no longer correspond to line number at the time of analysis. You'll need to re-run PHPStan to regenerate output file. Errors are outputed in descending order (line-number wise) so there's bigger chance that you won't lines out of their current positions.

composer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "noximo/ecs-fileoutput",
3+
"description": "An error formatter for Easy Coding Standard that exports analysis result into HTML file",
4+
"keywords": [
5+
"Easy Coding Standard",
6+
"Error formatter",
7+
"File output"
8+
],
9+
"type": "library",
10+
"authors": [
11+
{
12+
"name": "Tomas Pospisil",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"noximo\\EasyCodingStandardFileoutput\\": [
19+
"src/",
20+
"tests/"
21+
]
22+
}
23+
},
24+
"require": {
25+
"php": "^7.1",
26+
"symplify/easy-coding-standard": "^5.3",
27+
"nette/utils": "2.5.*"
28+
},
29+
"license": "MIT",
30+
"require-dev": {
31+
"phpstan/phpstan": "^0.10",
32+
"noximo/dbgr": "dev-master"
33+
},
34+
"scripts": {
35+
"check": [
36+
"@check-cs",
37+
"@phpstan"
38+
],
39+
"check-cs": "ecs check src",
40+
"fix-cs": "ecs check src --fix",
41+
"phpstan": "phpstan analyse src --level max --error-format=fileoutput",
42+
"phpstan-test": "phpstan analyse src tests --level max --error-format=fileoutput --no-progress",
43+
"check-cs-test": "ecs check tests "
44+
}
45+
}

0 commit comments

Comments
 (0)