Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistMergeConflictLinter.php
| Show All 25 Lines | final class ArcanistMergeConflictLinter extends ArcanistLinter { | ||||
| } | } | ||||
| public function getLintNameMap() { | public function getLintNameMap() { | ||||
| return array( | return array( | ||||
| self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'), | self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'), | ||||
| ); | ); | ||||
| } | } | ||||
| public function lintPath($path) { | protected function lintPath(ArcanistWorkingCopyPath $path) { | ||||
| $lines = phutil_split_lines($this->getData($path), false); | $lines = $path->getDataAsLines(); | ||||
| foreach ($lines as $lineno => $line) { | foreach ($lines as $lineno => $line) { | ||||
| // An unresolved merge conflict will contain a series of seven | // An unresolved merge conflict will contain a series of seven | ||||
| // '<', '=', or '>'. | // '<', '=', or '>'. | ||||
| if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) { | if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) { | ||||
| $this->raiseLintAtLine( | $this->raiseLintAtLine( | ||||
| $lineno + 1, | $lineno + 1, | ||||
| 1, | 1, | ||||
| self::LINT_MERGECONFLICT, | self::LINT_MERGECONFLICT, | ||||
| pht('This syntax indicates there is an unresolved merge conflict.')); | pht('This syntax indicates there is an unresolved merge conflict.')); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||