Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Allowing multiple paths to be passed to the precofigured linter and f…
Browse files Browse the repository at this point in the history
…ixer.
  • Loading branch information
fmizzell committed Oct 9, 2018
1 parent ad05fdd commit a496b6b
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions src/Command/TestCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testPhpunit(array $args)
/**
* Proxy to phpcs.
*/
public function testLint(array $args) {
public function phpcs(array $args) {
$dktl_dir = Util::getDktlDirectory();
$phpcs_command = "{$dktl_dir}/vendor/bin/phpcs";

Expand All @@ -112,7 +112,7 @@ public function testLint(array $args) {
/**
* Proxy to phpcbf.
*/
public function testLintFix(array $args) {
public function phpcbf(array $args) {
$dktl_dir = Util::getDktlDirectory();
$phpcs_command = "{$dktl_dir}/vendor/bin/phpcbf";

Expand All @@ -122,4 +122,43 @@ public function testLintFix(array $args) {
}
$task->run();
}

/**
* Preconfigured linting for paths inside of the repo.
*/
public function testLint(array $paths) {
$dktl_dir = Util::getDktlDirectory();
$project_dir = Util::getProjectDirectory();

$phpcs_command = "{$dktl_dir}/vendor/bin/phpcs";

$task = $this->taskExec("{$phpcs_command} --config-set installed_paths {$dktl_dir}/vendor/drupal/coder/coder_sniffer");
$task->run();

$task = $this->taskExec("{$phpcs_command} --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info");

foreach ($paths as $path) {
$task->arg("{$project_dir}/{$path}");
}

$task->run();
}

/**
* Preconfigured lint fixing for paths inside of the repo.
*/
public function testLintFix(array $paths) {
$dktl_dir = Util::getDktlDirectory();
$project_dir = Util::getProjectDirectory();

$phpcs_command = "{$dktl_dir}/vendor/bin/phpcbf";

$task = $this->taskExec("{$phpcs_command} --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info");

foreach ($paths as $path) {
$task->arg("{$project_dir}/{$path}");
}

$task->run();
}
}

0 comments on commit a496b6b

Please sign in to comment.