diff --git a/arcanist/linter/FileNameLinter.php b/arcanist/linter/FileNameLinter.php --- a/arcanist/linter/FileNameLinter.php +++ b/arcanist/linter/FileNameLinter.php @@ -7,6 +7,10 @@ const INVALID_FILENAME_FOUND = 1; + const EXCEPTIONS = array( + // None so far + ); + public function getInfoName() { return 'lint-source-filename'; } @@ -39,9 +43,16 @@ public function lintPath($path) { $abspath = Filesystem::resolvePath($path, $this->getProjectRoot()); + $pathInfo = pathinfo($path); + + // If file is in the exception list, let it go + if (in_array($pathInfo['basename'], self::EXCEPTIONS)) { + return; + } + $fileContent = Filesystem::readFile($abspath); - if(preg_match('/[^a-z0-9_-]/', pathinfo($path, PATHINFO_FILENAME))) { + if(preg_match('/[^a-z0-9_-]/', $pathInfo['filename'])) { $this->raiseLintAtPath( self::INVALID_FILENAME_FOUND, pht('Source code file names should only contain [a-z0-9_-] chars (see '. diff --git a/arcanist/linter/IncludeGuardLinter.php b/arcanist/linter/IncludeGuardLinter.php --- a/arcanist/linter/IncludeGuardLinter.php +++ b/arcanist/linter/IncludeGuardLinter.php @@ -10,6 +10,10 @@ const INCLUDE_GUARD_INVALID = 1; + const EXCEPTIONS = array( + // none yet + ); + public function getInfoName() { return 'lint-include-guard'; } @@ -41,10 +45,16 @@ public function lintPath($path) { $abspath = Filesystem::resolvePath($path, $this->getProjectRoot()); - $fileContent = Filesystem::readFile($abspath); $pathInfo = pathinfo($path); + // If file is in list of exceptions, let it go + if (in_array($pathInfo['basename'], self::EXCEPTIONS)) { + return; + } + + $fileContent = Filesystem::readFile($abspath); + // Get the path components. They are relative to project root. $guard = explode('/', $pathInfo['dirname']); // Add the file name (without extension) to the path components.