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)
Thu, Sep 12, 6:49 PM
Unknown Object (File)
Thu, Sep 12, 3:12 PM
Unknown Object (File)
Mon, Sep 2, 3:06 AM
Unknown Object (File)
Sat, Aug 31, 11:56 PM
Unknown Object (File)
Sat, Aug 31, 4:27 PM
Unknown Object (File)
Fri, Aug 30, 11:38 PM
Unknown Object (File)
Fri, Aug 30, 9:24 PM
Unknown Object (File)
Fri, Aug 30, 11:13 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
Branch
arcpatch-D10472
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/lint/linter/ArcanistLinter.php:77XHP16TODO Comment
Unit
Tests Passed
Build Status
Buildable 2603
Build 2607: [Placeholder Plan] Wait for 30 Seconds

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.