Skip to content

Commit

Permalink
add doc missing about PHPMD converter (since v1.4.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jun 15, 2024
1 parent 141d539 commit 00453fa
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/converter/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Converter Reference

[phpcs]: https://github.com/PHPCSStandards/PHP_CodeSniffer
[phpmd]: https://github.com/phpmd/phpmd
[phplint]: https://github.com/overtrue/phplint
[phpstan]: https://github.com/phpstan/phpstan

## [phpcs](phpcs.md) converter

See official [website][phpcs]

## [phpmd](phpmd) converter

See official [website][phpmd]

## [phplint](phplint.md) converter

See official [website][phplint]
Expand Down
10 changes: 10 additions & 0 deletions docs/converter/phpmd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- markdownlint-disable MD013 -->
# PHPMD Converter

![phpmd converter](../assets/images/converter-phpmd.graphviz.svg)

## How to use

See details on demo [`examples/converters/phpmd/`][example-folder] directory into repository.

[example-folder]: https://github.com/llaville/sarif-php-sdk/blob/master/examples/converters/phpmd/
7 changes: 7 additions & 0 deletions examples/converters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ The SDK is now able to convert for three well-known PHP linters their output to
- PHP_CodeSniffer (see feature request <https://github.com/squizlabs/PHP_CodeSniffer/issues/3496>)
- PHPLint (see feature request <https://github.com/overtrue/phplint/issues/186>)
- PHPStan (see feature request <https://github.com/phpstan/phpstan/issues/5973>)

> [!NOTE]
> Available since release [1.4.0](https://github.com/llaville/sarif-php-sdk/releases/tag/1.4.0)
The SDK is now able to convert with a new PHP linter its output to an improved version of SARIF format.

- PHPMD (has a native [Sarif Renderer](https://github.com/phpmd/phpmd/issues/858) feature)
19 changes: 19 additions & 0 deletions resources/converter-phpmd/datasource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php declare(strict_types=1);
/**
* This file is part of the Sarif-PHP-SDK package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Laurent Laville
* @since Release 1.4.0
*/

return function (): Generator {
$classes = [
\Bartlett\Sarif\Converter\PhpMdConverter::class,
];
foreach ($classes as $class) {
yield $class;
}
};
17 changes: 17 additions & 0 deletions resources/converter-phpmd/options.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/**
* This file is part of the Sarif-PHP-SDK package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Laurent Laville
* @since Release 1.4.0
*/

return [
// @link https://graphviz.gitlab.io/docs/attrs/rankdir/
'graph.rankdir' => 'TB',
// @link https://plantuml.com/en/color
'cluster.Bartlett\Sarif\Converter.graph.bgcolor' => 'BurlyWood',
];
1 change: 1 addition & 0 deletions resources/gh-pages-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ASSETS_IMAGE_DIR="docs/assets/images"
php $SCRIPT_DIR/build.php graph-composer $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php builder-api $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php converter-phpcs $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php converter-phpmd $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php converter-phplint $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php converter-phpstan $ASSETS_IMAGE_DIR
php $SCRIPT_DIR/build.php reference-address $ASSETS_IMAGE_DIR
Expand Down

0 comments on commit 00453fa

Please sign in to comment.