Skip to content

Commit ba8beed

Browse files
committed
Add exclusion option.
1 parent 7bdcfff commit ba8beed

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ Give a try, use the included `testcases.php` to generate a report:
6767
*Example: -x="php,inc"*
6868
```
6969

70+
**-e**
71+
```
72+
Exclusion tags that you can add above a line that is being flagged. Most useful for nuances which will remain in subsequent reports.
73+
*Example: -e="@ignoreNextLine"*
74+
Code:
75+
// @ignoreNextLine
76+
foreach ($array as &$byRef) {
77+
78+
```
79+
7080
**--php**
7181
```
7282
File path to the PHP binary to use for syntax checking.

classes/options.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class options {
5555
'f' => [
5656
'option' => self::OPTION_REQUIRED,
5757
'value' => self::VALUE_REQUIRED,
58-
'comment' => 'Path to the file or folder to run against.',
58+
'comment' => 'Path to the files or folders to run against.',
5959
'description' => 'The location of the file or folder to use for generating the report. A fully qualified path is recommended. Relative paths will be based off the php7mar folder.',
60-
'example' => '-f="/path/to/folder"'
60+
'example' => '-f="/path/to/folder,path/to/file"',
6161
],
6262
'r' => [
6363
'option' => self::OPTION_OPTIONAL,
@@ -78,6 +78,13 @@ class options {
7878
'syntax'
7979
]
8080
],
81+
'e' => [
82+
'option' => self::OPTION_OPTIONAL,
83+
'value' => self::VALUE_REQUIRED,
84+
'comment' => 'Exclusion tag to ignore next line nuance.',
85+
'description' => 'Add // @excludeNextLine on the line above a nuance, for instance, and it will not come up in subsequent results.',
86+
'example' => '-t="@excludeNextLine"'
87+
],
8188
'x' => [
8289
'option' => self::OPTION_OPTIONAL,
8390
'value' => self::VALUE_REQUIRED,

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
],
2020
"require": {
2121
"php": ">=5.4.0"
22-
}
22+
},
23+
"bin": [
24+
"mar.php"
25+
]
2326
}

mar.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ private function run() {
142142
// on the line before. -x="@fakeBug" and then on the line before nuance, you can
143143
// include the following and it won't come up in subsequent reports:
144144
// @fakeBug
145-
$exclusionTag = $this->options->getOption('x');
146-
$exclusionTag = is_array($exclusionTag) ? array_shift($exclusionTag) : false;
145+
$exclusionTag = $this->options->getOption('e');
147146
if ($exclusionTag && isset($lines[$index-1]) && strpos($lines[$index-1], $exclusionTag)) {
148147
continue;
149148
}

0 commit comments

Comments
 (0)