ArcanistLintSeverity::SEVERITY_AUTOFIX, ); } public function getLintNameMap() { return array( self::CHEADER_FOUND => pht('C compatibility header found in a C++ file'), ); } public function lintPath($path) { $path = Filesystem::resolvePath($path, $this->getProjectRoot()); $fileContent = Filesystem::readFile($path); $anyHeaderPattern = implode('|', self::$cheaders); if (!preg_match_all("/#include <($anyHeaderPattern).h>/", $fileContent, $matches, PREG_OFFSET_CAPTURE)) { return; } foreach ($matches[1] as $match) { list($header, $offset) = $match; $original = $header.'.h'; $replacement = 'c'.$header; $this->raiseLintAtOffset( $offset, self::CHEADER_FOUND, pht( 'Use C++ header <%s> instead of C compatibility header <%s>', $replacement, $original), $original, $replacement); } } }