Skip to content

Commit 3140516

Browse files
authored
Merge pull request #55 from bochkovprivate/master
Fix Technical Debt Plugin configuration parameters
2 parents 506af65 + acf25af commit 3140516

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

docs/en/plugins/technical_dept.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ Configuration
77
-------------
88

99
### Options
10-
11-
* **searches** - Optional - Case-insensitive array of terms to search for. Defaults to TODO, TO DO, FIXME and FIX ME.
10+
* **allowed_errors** [int, optional] - The error limit for a successful build (default: 0). -1 disables errors. Setting allowed_errors in conjunction with zero_config will override zero_config.
11+
* **suffixes** [array, optional] - An array of file extensions to check (default: 'php')
12+
* **directory** [string, optional] - directory to inspect (default: build root)
13+
* **ignore** [array, optional] - directory to ignore (default: inherits ignores specified in setup)
14+
* **searches** [array, optional] - Optional - Case-insensitive array of terms to search for. Defaults to TODO, TO DO, FIXME and FIX ME.

src/PHPCensor/Plugin/TechnicalDebt.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ public function __construct(Builder $builder, Build $build, array $options = [])
7575
if (isset($options['zero_config']) && $options['zero_config']) {
7676
$this->allowed_errors = -1;
7777
}
78+
79+
$this->setOptions($options);
80+
}
81+
82+
/**
83+
* Handle this plugin's options.
84+
* @param $options
85+
*/
86+
protected function setOptions($options)
87+
{
88+
foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) {
89+
if (array_key_exists($key, $options)) {
90+
$this->{$key} = $options[$key];
91+
}
92+
}
7893
}
7994

8095
/**

0 commit comments

Comments
 (0)