Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add report generation scripts #28

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bespoke-phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if (count($_SERVER['argv']) >1) {
die;
}

$_SERVER['argv'][] = '-s'; // Include sniff codes
$_SERVER['argv'][] = 'app'; // scan app folder

// Use rules defined in project root or by default what defined in bespoke standards
Expand Down
23 changes: 23 additions & 0 deletions bespoke-phpcs-report-source
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (count($_SERVER['argv']) > 1) {
echo "⚠️ Sorry. Parameters are currently not supported." . PHP_EOL;
die;
}

// source
$_SERVER['argv'][] = '--report=source';

$_SERVER['argv'][] = 'app'; // scan app folder

// Use rules defined in project root or by default what defined in bespoke standards
if (file_exists(__DIR__ . '/../../../phpcs.xml')) {
$_SERVER['argv'][] = '--standard=phpcs.xml';
} else {
$_SERVER['argv'][] = '--standard=' . __DIR__ . '/ruleset.xml'; // rules
}
$_SERVER['argv'][] = '--extensions=php'; // only php files
$_SERVER['argv'][] = '--encoding=utf-8';

include __DIR__ . '/../../bin/phpcs';
23 changes: 23 additions & 0 deletions bespoke-phpcs-report-summary
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (count($_SERVER['argv']) > 1) {
echo "⚠️ Sorry. Parameters are currently not supported." . PHP_EOL;
die;
}

// Summary
$_SERVER['argv'][] = '--report=summary';

$_SERVER['argv'][] = 'app'; // scan app folder

// Use rules defined in project root or by default what defined in bespoke standards
if (file_exists(__DIR__ . '/../../../phpcs.xml')) {
$_SERVER['argv'][] = '--standard=phpcs.xml';
} else {
$_SERVER['argv'][] = '--standard=' . __DIR__ . '/ruleset.xml'; // rules
}
$_SERVER['argv'][] = '--extensions=php'; // only php files
$_SERVER['argv'][] = '--encoding=utf-8';

include __DIR__ . '/../../bin/phpcs';
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"bin": [
"bespoke-phpcbf",
"bespoke-phpcs",
"bespoke-phpcs-report-source",
"bespoke-phpcs-report-summary",
"bespoke-phplint"
],
"require": {
Expand Down
3 changes: 1 addition & 2 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
<exclude-pattern>./vendor/*</exclude-pattern>
<exclude-pattern>*/thirdparty/*</exclude-pattern>

<!-- Show progress and output sniff names on violation, add colours, and run in parallel mode -->
<!-- Show progress, and add colours, and run in parallel mode -->
<arg value="p" />
<arg name="colors" />
<arg value="s" />
<arg name="parallel" value="10" />

<!-- Use PSR-2 as a base standard -->
Expand Down
Loading