Skip to content

Instantly share code, notes, and snippets.

@ProxiBlue
Created January 27, 2021 01:58
Show Gist options
  • Save ProxiBlue/ee376aa9a4f32204976e7c7a7e2d3499 to your computer and use it in GitHub Desktop.
Save ProxiBlue/ee376aa9a4f32204976e7c7a7e2d3499 to your computer and use it in GitHub Desktop.
pipeline php sniffs
rm composer.json
rm composer.lock
composer require magento-ecg/coding-standard mandrill/mandrill
[ -d "code_sniff" ] || mkdir code_sniff
phpcs --config-set ignore_warnings_on_exit 1
phpcs --config-set ignore_errors_on_exit 1
phpcs --report-file=./code_sniff/sniff.txt --standard=./vendor/magento-ecg/coding-standard/Ecg ${PATH_TO_SNIFF}
php_cwd=`php << 'EOF'
<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/mandrill/mandrill/src/Mandrill.php';
try {
$mandrill = new Mandrill();
$message = array(
'text' => file_get_contents( __DIR__ . "/code_sniff/sniff.txt" ),
'subject' => "PHPCS SNIFF: $BUDDY_PROJECT_NAME ( $BUDDY_PIPELINE_NAME ) ",
'from_email' => "${EMAIL}",
'from_name' => "${EMAIL}",
'to' => array(
array(
'email' => "${EMAIL}",
'name' => "${EMAIL}",
'type' => 'to'
)
)
);
$result = $mandrill->messages->send($message);
print_r($result);
} catch(Mandrill_Error $e) {
echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
throw $e;
}
?>
EOF`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment