diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 1b1b4b41..1b325c6c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -122,6 +122,7 @@ phutil_register_library_map(array( 'ArcanistMercurialParser' => 'repository/parser/ArcanistMercurialParser.php', 'ArcanistMercurialParserTestCase' => 'repository/parser/__tests__/ArcanistMercurialParserTestCase.php', 'ArcanistMergeConflictLinter' => 'lint/linter/ArcanistMergeConflictLinter.php', + 'ArcanistMergeConflictLinterTestCase' => 'lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php', 'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php', 'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php', 'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php', @@ -294,6 +295,7 @@ phutil_register_library_map(array( 'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI', 'ArcanistMercurialParserTestCase' => 'ArcanistTestCase', 'ArcanistMergeConflictLinter' => 'ArcanistLinter', + 'ArcanistMergeConflictLinterTestCase' => 'ArcanistArcanistLinterTestCase', 'ArcanistNoEffectException' => 'ArcanistUsageException', 'ArcanistNoEngineException' => 'ArcanistUsageException', 'ArcanistNoLintLinter' => 'ArcanistLinter', diff --git a/src/lint/linter/ArcanistMergeConflictLinter.php b/src/lint/linter/ArcanistMergeConflictLinter.php index 8144bd18..f7092ff6 100644 --- a/src/lint/linter/ArcanistMergeConflictLinter.php +++ b/src/lint/linter/ArcanistMergeConflictLinter.php @@ -38,7 +38,7 @@ final class ArcanistMergeConflictLinter extends ArcanistLinter { if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) { $this->raiseLintAtLine( $lineno + 1, - 0, + 1, self::LINT_MERGECONFLICT, pht('This syntax indicates there is an unresolved merge conflict.')); } diff --git a/src/lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php b/src/lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php new file mode 100644 index 00000000..beed0190 --- /dev/null +++ b/src/lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php @@ -0,0 +1,12 @@ +executeTestsInDirectory( + dirname(__FILE__).'/mergeconflict/', + new ArcanistMergeConflictLinter()); + } + +} diff --git a/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test b/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test new file mode 100644 index 00000000..3e30be52 --- /dev/null +++ b/src/lint/linter/__tests__/mergeconflict/mergeconflict.lint-test @@ -0,0 +1,10 @@ +{ + "foo": "bar", +<<<<<<< HEAD + "bar": "baz" +======= + "baz": "foo" +>>>>>>> branch2 +} +~~~~~~~~~~ +error:5:1