Legoktm has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/402661 )
Change subject: Support ignoring entire directories
......................................................................
Support ignoring entire directories
Change-Id: Iab9ba6a8a5a48cd660e5fe432b7af66d301eec86
---
M README.md
M src/CheckCommand.php
2 files changed, 22 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/minus-x
refs/changes/61/402661/1
diff --git a/README.md b/README.md
index 37680de..40f9d89 100644
--- a/README.md
+++ b/README.md
@@ -21,13 +21,16 @@
`minus-x fix .`
-If you need to whitelist a specific file, create a `.minus-x.json` in
-the repository root:
+If you need to whitelist a specific file or directory, create a
+`.minus-x.json` in the repository root:
```
{
"ignore": [
"./bin/executable"
+ ],
+ "ignoreDirectories": [
+ "extensions"
]
}
```
diff --git a/src/CheckCommand.php b/src/CheckCommand.php
index 19840f6..c2df7c3 100644
--- a/src/CheckCommand.php
+++ b/src/CheckCommand.php
@@ -36,7 +36,7 @@
*
* @var string[]
*/
- protected $ignoredDirs = [
+ protected $defaultIgnoredDirs = [
'.git',
'vendor',
'node_modules',
@@ -58,6 +58,13 @@
* @var string[]
*/
protected $ignoredFiles = [];
+
+ /**
+ * Ignored directories from .minus-x.json
+ *
+ * @var string[]
+ */
+ protected $ignoredDirs = [];
/**
* @var InputInterface
@@ -148,6 +155,15 @@
}, $config['ignore'] );
}
+ if ( isset( $config['ignoreDirectories'] ) ) {
+ $this->ignoredDirs = array_merge(
+ $config['ignoreDirectories'],
+ $this->defaultIgnoredDirs
+ );
+ } else {
+ $this->ignoredDirs = $this->defaultIgnoredDirs;
+ }
+
if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
// On Windows, is_executable() always returns true, so
whitelist those
// files
--
To view, visit https://gerrit.wikimedia.org/r/402661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab9ba6a8a5a48cd660e5fe432b7af66d301eec86
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/minus-x
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits