Skip to content

Commit

Permalink
prepare feature release 9.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed May 3, 2024
1 parent 4781c13 commit b211fe1
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .changes/9.2.0.md
@@ -0,0 +1,12 @@

## 9.2.0 - 2024-05-03

### Added

- [#186](https://github.com/overtrue/phplint/issues/186) : Add SARIF output format

### Changed

- Reorganize binary launcher (`bin/phplint`) and autoloader (`autoload.php` replaced `config/bootstrap.php`)

**Full Changelog**: [9.1.2...9.2.0](https://github.com/overtrue/phplint/compare/9.1.2...9.2.0)
3 changes: 0 additions & 3 deletions .changes/unreleased/Added-20240503-034646.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions .changes/unreleased/Changed-20240502-192920.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "9.1"
ref: "9.2"
repository: "overtrue/phplint"

- # https://github.com/shivammathur/setup-php
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "9.1"
ref: "9.2"
repository: "overtrue/phplint"

- # https://github.com/shivammathur/setup-php
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,18 @@ 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.2.0 - 2024-05-03

### Added

- [#186](https://github.com/overtrue/phplint/issues/186) : Add SARIF output format

### Changed

- Reorganize binary launcher (`bin/phplint`) and autoloader (`autoload.php` replaced `config/bootstrap.php`)

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

## 9.1.2 - 2024-02-06

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -16,7 +16,7 @@ USER appuser
# Install Composer v2 then overtrue/phplint package
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN composer global require --no-progress overtrue/phplint 9.1.x-dev
RUN composer global require --no-progress overtrue/phplint 9.2.x-dev

# Following recommendation at https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#workdir

Expand Down
4 changes: 3 additions & 1 deletion autoload.php
Expand Up @@ -18,8 +18,10 @@ class Autoload
{
/**
* The composer autoloader.
*
* @var \Composer\Autoload\ClassLoader
*/
private static ?\Composer\Autoload\ClassLoader $composerAutoloader = null;
private static $composerAutoloader = null;

public static function load(string $class): void
{
Expand Down
6 changes: 2 additions & 4 deletions box.json.dist
Expand Up @@ -9,9 +9,7 @@
"This source file is subject to the MIT license that is bundled",
"with this source code in the file LICENSE."
],
"compactors": [
"KevinGH\\Box\\Compactor\\PhpScoper"
],
"force-autodiscovery": true,
"files": ["config/bootstrap.php"]
"exclude-dev-files": false,
"files": ["autoload.php", "phplint.php"]
}
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -34,6 +34,7 @@
"symfony/yaml": "^6.4 || ^7.0"
},
"require-dev": {
"bartlett/sarif-php-sdk": "^1.2",
"php-parallel-lint/php-console-highlighter": "^1.0",
"brainmaestro/composer-git-hooks": "^2.8.5 || 3.0.0-alpha.1",
"jetbrains/phpstorm-stubs": "^2021.3 || ^2022.3 || ^2023.3 || ^2024.1",
Expand Down
84 changes: 83 additions & 1 deletion docs/configuration.md
Expand Up @@ -10,6 +10,7 @@
1. [Memory limit][memory-limit]
1. [JSON output][log-json]
1. [XML output][log-xml]
1. [SARIF output][log-sarif]
1. [Exit Code][no-files-exit-code]

The `phplint` command relies on a configuration file for loading settings.
Expand Down Expand Up @@ -136,6 +137,86 @@ For example:
</testsuites>
```

## SARIF output (`log-sarif`)

The `log-sarif` (`null`|`string` default `null` to print results to standard output) setting allow to write results in a SARIF JSON format.
For example:

```json
{
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "PHPLint",
"shortDescription": {
"text": "Syntax check only (lint) of PHP files"
},
"fullDescription": {
"text": "PHPLint is a tool that can speed up linting of php files by running several lint processes at once."
},
"semanticVersion": "9.2.0.0",
"informationUri": "https://github.com/overtrue/phplint"
}
},
"invocations": [
{
"executionSuccessful": true,
"workingDirectory": {
"uri": "file:///shared/backups/github/phplint/"
}
}
],
"originalUriBaseIds": {
"WORKINGDIR": {
"uri": "file:///shared/backups/github/phplint/"
}
},
"results": [
{
"message": {
"text": "unexpected end of file in line 4"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "tests/fixtures/syntax_error.php",
"uriBaseId": "WORKINGDIR"
},
"region": {
"startLine": 4
}
}
}
]
},
{
"message": {
"text": " declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in line 12"
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "tests/fixtures/syntax_warning.php",
"uriBaseId": "WORKINGDIR"
},
"region": {
"startLine": 12
}
}
}
]
}
]
}
]
}
```

## Exit Code (`no-files-exit-code`)

The `no-files-exit-code` (`bool` default `false`) setting allow to exit `phplint` command with failure (status code `1`) when no files processed.
Expand All @@ -150,5 +231,6 @@ By default, `phplint` exit with success (status code `0`)
[no-cache]: #no-caching-no-cache
[memory-limit]: #memory-limit-memory-limit
[log-json]: #json-output-log-json
[log-xml]: #xml-output-log-xml
[log-xml]: #xml-output-log-junit
[log-sarif]: #sarif-output-log-sarif
[no-files-exit-code]: #exit-code-no-files-exit-code
2 changes: 1 addition & 1 deletion docs/installation.md
Expand Up @@ -48,7 +48,7 @@ You can also install `phplint` locally to your project with [Phive][phive] and c
```xml
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="overtrue/phplint" version="^9.1" copy="false" />
<phar name="overtrue/phplint" version="^9.2" copy="false" />
</phive>
```

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Application.php
Expand Up @@ -36,7 +36,7 @@
final class Application extends BaseApplication
{
public const NAME = 'phplint';
public const VERSION = '9.1.2';
public const VERSION = '9.2.0';

public function __construct()
{
Expand Down
1 change: 1 addition & 0 deletions src/Extension/OutputFormat.php
Expand Up @@ -29,6 +29,7 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

use RuntimeException;

use function class_exists;
use function sprintf;

Expand Down

0 comments on commit b211fe1

Please sign in to comment.