-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oscar Cabrera
committed
Jun 26, 2024
1 parent
bcfb98b
commit f644000
Showing
9 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Sample workflow for validating and linting PHP code with PHP Mess Detector | ||
name: PHPMD | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'Feature/*' | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
composer- | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
tools: composer | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Run PHPStan | ||
run: composer phpmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Oscabrera\ModelRepository\CIScripts\phpMD; | ||
|
||
require_once __DIR__ . '/../Analyzer/Analyzer.php'; | ||
|
||
use Oscabrera\ModelRepository\CIScripts\Analyzer\Analyzer; | ||
|
||
class PhpMDAnalyzer extends Analyzer | ||
{ | ||
/** | ||
* @param array<int, string> $args | ||
* Constructor for the class, command is for validated in the PHP Mess Detector. | ||
*/ | ||
public function __construct(array $args) | ||
{ | ||
$this->setArgs($args); | ||
$this->setTool('PHP Mess Detector'); | ||
$this->setCommand('./vendor/bin/phpmd %FILES% ansi cleancode,codesize,controversial,design,unusedcode --exclude *vendor'); | ||
parent::__construct(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Oscabrera\ModelRepository\CIScripts; | ||
|
||
require_once __DIR__ . '/PhpMDAnalyzer.php'; | ||
|
||
use Oscabrera\ModelRepository\CIScripts\phpMD\PhpMDAnalyzer as Analyzer; | ||
|
||
/** | ||
* Analyze with PHP Mess Detector | ||
*/ | ||
$args = array_slice($_SERVER['argv'], 1); // Get arguments passed to the script | ||
exit((new Analyzer($args))->analyze() ? 0 : 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters