Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13971439
D10472.id25349.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10472.id25349.diff
View Options
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,17 @@
}
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,
pht('You must use ONLY Unix linebreaks ("%s") in source code.', '\n'),
- "\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
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 18, 1:24 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727093
Default Alt Text
D10472.id25349.diff (1 KB)
Attached To
Mode
D10472: Improve `LINT_DOS_NEWLINE` behavior
Attached
Detach File
Event Timeline
Log In to Comment