Summary: We could also inject the value from the test case config but this is simpler.
Test Plan:
$ arc unit src/lint/linter/ArcanistLicenseLinter.php
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T2035
Differential Revision: https://secure.phabricator.com/D3895
abstract protected function getLicensePatterns();
public function lintPath($path) {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $copyright_holder = $working_copy->getConfig('copyright_holder');
+ $copyright_holder = $this->getConfig('copyright_holder');
+ if ($copyright_holder === null) {
+ $working_copy = $this->getEngine()->getWorkingCopy();
+ $copyright_holder = $working_copy->getConfig('copyright_holder');
+ }
if (!$copyright_holder) {
return;
protected $stopAllLinters = false;
private $customSeverityMap = array();
+ private $config = array();
public function setCustomSeverityMap(array $map) {
$this->customSeverityMap = $map;
return $this;
}
+ public function setConfig(array $config) {
+ $this->config = $config;
+ return $this;
+ }
+
+ protected function getConfig($key, $default = null) {
+ return idx($this->config, $key, $default);
+ }
+
public function getActivePath() {
return $this->activePath;
}
$linter->addPath($path);
$linter->addData($path, $data);
+ $linter->setConfig(idx($config, 'config', array()));
$engine->addLinter($linter);
$engine->addFileData($path, $data);
int main(int argv, char **argv) {
return 0;
}
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
}
/* More Comments */
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
*/
do_stuff();
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
*/
do_stuff();
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
*/
do_stuff();
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
*/
do_stuff();
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}
*/
do_stuff();
+~~~~~~~~~~
+{"config": {"copyright_holder": "Facebook, Inc."}}