Skip to content

Commit 9a6dbaa

Browse files
committed
Add ability to pass exclusion comment.
1 parent 9c3e085 commit 9a6dbaa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

mar.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ private function run() {
137137

138138
$totalLines++;
139139
$issues = $this->tests->testLine($line);
140+
141+
// If an exclusion arg is passed, developers can denote a nuance as being checked
142+
// on the line before. -x="@fakeBug" and then on the line before nuance, you can
143+
// include the following and it won't come up in subsequent reports:
144+
// @fakeBug
145+
$exclusionTag = $this->options->getOption('x');
146+
$exclusionTag = is_array($exclusionTag) ? array_shift($exclusionTag) : false;
147+
if ($exclusionTag && isset($lines[$index-1]) && strpos($lines[$index-1], $exclusionTag)) {
148+
continue;
149+
}
150+
140151
foreach ($issues as $section => $tests) {
141152
foreach ($tests as $test => $true) {
142153
$this->reporter->addToSection($section, $test, $filePath, $lineNumber, $line);
@@ -187,4 +198,4 @@ static public function getRealPath($path) {
187198
}
188199
}
189200
$mar = new main();
190-
?>
201+
?>

0 commit comments

Comments
 (0)