Page MenuHomePhabricator

D10472.id25314.diff
No OneTemporary

D10472.id25314.diff

diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -17,7 +17,7 @@
}
public function getInfoDescription() {
- return pht('Use `jshint` to detect issues with Javascript source files.');
+ return pht('Use `jshint` to detect issues with JavaScript source files.');
}
public function getLinterName() {
diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php
--- a/src/lint/linter/ArcanistLinter.php
+++ b/src/lint/linter/ArcanistLinter.php
@@ -73,12 +73,15 @@
return 1.0;
}
+ /**
+ * TODO: This should be `final`.
+ */
public function setCustomSeverityMap(array $map) {
$this->customSeverityMap = $map;
return $this;
}
- public function setCustomSeverityRules(array $rules) {
+ final public function setCustomSeverityRules(array $rules) {
$this->customSeverityRules = $rules;
return $this;
}
@@ -192,17 +195,17 @@
return $map[$code];
}
- $map = $this->getLintSeverityMap();
- if (isset($map[$code])) {
- return $map[$code];
- }
-
foreach ($this->customSeverityRules as $rule => $severity) {
if (preg_match($rule, $code)) {
return $severity;
}
}
+ $map = $this->getLintSeverityMap();
+ if (isset($map[$code])) {
+ return $map[$code];
+ }
+
return $this->getDefaultMessageSeverity($code);
}
diff --git a/src/lint/linter/ArcanistMergeConflictLinter.php b/src/lint/linter/ArcanistMergeConflictLinter.php
--- a/src/lint/linter/ArcanistMergeConflictLinter.php
+++ b/src/lint/linter/ArcanistMergeConflictLinter.php
@@ -25,8 +25,10 @@
return 'merge-conflict';
}
- public function willLintPaths(array $paths) {
- return;
+ public function getLintNameMap() {
+ return array(
+ self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'),
+ );
}
public function lintPath($path) {
@@ -45,10 +47,4 @@
}
}
- public function getLintNameMap() {
- return array(
- self::LINT_MERGECONFLICT => pht('Unresolved merge conflict'),
- );
- }
-
}
diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php
--- a/src/lint/linter/ArcanistTextLinter.php
+++ b/src/lint/linter/ArcanistTextLinter.php
@@ -123,13 +123,18 @@
}
protected function lintNewlines($path) {
- $pos = strpos($this->getData($path), "\r");
+
+ $data = $this->getData($path);
+ $pos = strpos($this->getData($path), "\r");
+
if ($pos !== false) {
$this->raiseLintAtOffset(
- $pos,
+ 0,
self::LINT_DOS_NEWLINE,
'You must use ONLY Unix linebreaks ("\n") in source code.',
- "\r");
+ $data,
+ str_replace("\r\n", "\n", $data));
+
if ($this->isMessageEnabled(self::LINT_DOS_NEWLINE)) {
$this->stopAllLinters();
}
diff --git a/src/lint/linter/__tests__/text/dos-newline.lint-test b/src/lint/linter/__tests__/text/dos-newline.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/text/dos-newline.lint-test
@@ -0,0 +1,7 @@
+The quick brown fox
+jumps over the lazy dog.
+~~~~~~~~~~
+error:1:1
+~~~~~~~~~~
+The quick brown fox
+jumps over the lazy dog.

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 19, 4:49 AM (3 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7366928
Default Alt Text
D10472.id25314.diff (3 KB)

Event Timeline