Page MenuHomePhabricator

Improve `LINT_DOS_NEWLINE` behavior
ClosedPublic

Authored by joshuaspence on Sep 11 2014, 12:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 7:48 PM
Unknown Object (File)
Fri, Dec 20, 12:04 AM
Unknown Object (File)
Fri, Dec 13, 4:35 AM
Unknown Object (File)
Mon, Dec 9, 12:21 AM
Unknown Object (File)
Sun, Dec 8, 3:35 PM
Unknown Object (File)
Fri, Dec 6, 1:13 PM
Unknown Object (File)
Fri, Dec 6, 12:20 PM
Unknown Object (File)
Wed, Dec 4, 11:47 AM
Subscribers

Details

Summary

Improve the behavior of ArcanistTextLinter in dealing with LINT_DOS_NEWLINE. In particular, provide replacement text so that these linter issues can be autofixed.

Test Plan

Added a unit test.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Improve `LINT_DOS_NEWLINE` behavior.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

If the file has OS9 newlines (\r only), this will completely destroy them and mangle the file. We should only remove \r if the next character is \n.

Also, maybe it's better to emit one giant whole-file patch than one patch for each line?

This revision now requires changes to proceed.Sep 11 2014, 12:38 PM
joshuaspence edited edge metadata.
  • Don't suggest a fix if the file has OS9 newlines
  • Suggest one patch per file rather than one patch per line
epriestley edited edge metadata.

We could also suggest one patch per contiguous block of lines with bad newlines as an ideal behavior, but this should usually accomplish the same thing.

This revision is now accepted and ready to land.Sep 24 2014, 8:59 PM
This revision was automatically updated to reflect the committed changes.