4
* Checks files for unresolved merge conflicts.
6
final class ArcanistMergeConflictLinter extends ArcanistLinter {
8
const LINT_MERGECONFLICT = 1;
10
public function getInfoName() {
11
return pht('Merge Conflicts');
14
public function getInfoDescription() {
16
'Raises errors on unresolved merge conflicts in source files, to catch '.
17
'mistakes where a conflicted file is accidentally marked as resolved.');
20
public function getLinterName() {
21
return 'MERGECONFLICT';
24
public function getLinterConfigurationName() {
25
return 'merge-conflict';
28
public function getLintNameMap() {
30
self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'),
34
public function lintPath($path) {
35
$lines = phutil_split_lines($this->getData($path), false);
37
foreach ($lines as $lineno => $line) {
38
// An unresolved merge conflict will contain a series of seven
40
if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) {
41
$this->raiseLintAtLine(
44
self::LINT_MERGECONFLICT,
45
pht('This syntax indicates there is an unresolved merge conflict.'));