Skip to content

Commit

Permalink
prepare feature release 9.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jul 5, 2024
1 parent 5d63575 commit a839235
Show file tree
Hide file tree
Showing 12 changed files with 353 additions and 102 deletions.
27 changes: 27 additions & 0 deletions .changes/9.4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

## 9.4.0 - 2024-07-05

### Added

- [#208](https://github.com/overtrue/phplint/issues/208) : Add support to more output formats
- support to `checkstyle` format

### Changed

- support to `sarif` format is now optional. Requires to install extra package `bartlett/sarif-php-converters`.

> [!NOTE]
>
> `sarif` format is a good example of how to use custom format not provided by current PHPLint distribution.
> Read how to use it at <https://github.com/llaville/sarif-php-converters/blob/1.0/docs/converter/phplint.md>
### Removed

- legacy `log-*` and `sarif-converter` options
- useless help column in configuration table when verbose mode is active

### Fixed

- shortcut of `progress` option is now detected on `phplint` binary launcher.

**Full Changelog**: [9.3.1...9.4.0](https://github.com/overtrue/phplint/compare/9.3.1...9.4.0)
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## 9.4.0 - 2024-07-05

### Added

- [#208](https://github.com/overtrue/phplint/issues/208) : Add support to more output formats
- support to `checkstyle` format

### Changed

- support to `sarif` format is now optional. Requires to install extra package `bartlett/sarif-php-converters`.

> [!NOTE]
>
> `sarif` format is a good example of how to use custom format not provided by current PHPLint distribution.
> Read how to use it at <https://github.com/llaville/sarif-php-converters/blob/1.0/docs/converter/phplint.md>
### Removed

- legacy `log-*` and `sarif-converter` options
- useless help column in configuration table when verbose mode is active

### Fixed

- shortcut of `progress` option is now detected on `phplint` binary launcher.

**Full Changelog**: [9.3.1...9.4.0](https://github.com/overtrue/phplint/compare/9.3.1...9.4.0)

## 9.3.1 - 2024-05-17

### Fixed
Expand Down
9 changes: 9 additions & 0 deletions bin/phplint
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/usr/bin/env php
<?php

/*
* This file is part of the overtrue/phplint package
*
* (c) overtrue
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

gc_disable(); // performance boost

require_once dirname(__DIR__) . '/autoload.php';
Expand Down
50 changes: 43 additions & 7 deletions docs/architecture/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ via the `Overtrue\PHPLint\Output\ChainOutput` object and its handlers (`Overtrue
- `ConsoleOutput` print results to the standard output
- `JsonOutput` print results on JSON format to a file (default to standard output)
- `JunitOutput` print results on Junit format to a file (default to standard output)
- `CheckstyleOutput` print results on Checkstyle format to a file (default to standard output)
- `SarifOutput` print results on SARIF format to a file (default to standard output)

## UML Diagram

Expand Down Expand Up @@ -43,6 +45,10 @@ This handler is responsible to print PHPLint results on JSON private format. For
"line": 12
}
},
"application_version": {
"long": "phplint 9.4.0",
"short": "9.4.0"
},
"time_usage": "< 1 sec",
"memory_usage": "6.0 MiB",
"cache_usage": "0 hit, 12 misses",
Expand Down Expand Up @@ -79,23 +85,53 @@ This handler is responsible to print PHPLint results on Junit XML format. For ex
```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="PHP Linter" timestamp="2023-12-16T08:21:51+0000" time="&lt; 1 sec" tests="1" errors="2">
<testsuite name="PHP Linter 9.4.0" timestamp="2024-07-05T08:21:51+0000" time="&lt; 1 sec" tests="1" errors="2">
<testcase errors="2" failures="0">
<error type="Error" message="unexpected end of file in line 4">/path/to/fixtures/syntax_error.php
<error type="Error" message="False can not be used as a standalone type in line 12">/path/to/fixtures/php-8.2_syntax.php
<error type="Error" message="unexpected end of file in line 4">/path/to/fixtures/syntax_error.php</error>
<error type="Error" message="False can not be used as a standalone type in line 12">/path/to/fixtures/php-8.2_syntax.php</error>
</testcase>
</testsuite>
</testsuites>
```

[bartlett/graph-uml]: https://packagist.org/packages/bartlett/graph-uml
[symfony/console]: https://github.com/symfony/console
[symfony-console-events]: https://symfony.com/doc/current/components/console/events.html
[chain-of-responsibility-pattern]: https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
## `CheckstyleOutput` handler

This handler is responsible to print PHPLint results on Checkstyle XML format. For example:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="/path/to/fixtures/syntax_error.php">
<error line="4" severity="error" message="unexpected end of file in line 4"/>
</file>
<file name="/path/to/fixtures/php-8.2_syntax.php">
<error line="12" severity="error" message="False can not be used as a standalone type in line 12"/>
</file>
<file name="/path/to/fixtures/syntax_warning.php">
<error line="12" severity="error" message=" declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in line 12"/>
</file>
</checkstyle>
```

## `SarifOutput` handler

> [!NOTE]
>
> Since version 9.4.0, this format is optional and requires an extra package to be installed.
>
> ```composer require --dev bartlett/sarif-php-converters```
This handler is responsible to print PHPLint results on SARIF JSON format.
Learn more at <https://github.com/llaville/sarif-php-converters/blob/1.0/docs/converter/phplint.md>

## `LinterOutput` object

This object represent the PHPLint results of all file checked.

It will allow to easily communicate with other extension or output handler. Thanks to the Event-Dispatcher component.

[bartlett/graph-uml]: https://packagist.org/packages/bartlett/graph-uml
[symfony/console]: https://github.com/symfony/console
[symfony-console-events]: https://symfony.com/doc/current/components/console/events.html
[chain-of-responsibility-pattern]: https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern

Loading

0 comments on commit a839235

Please sign in to comment.