Page MenuHomePhabricator

Diff on `arc lint` misleading when the replacement has newlines
Closed, ResolvedPublic

Description

I don't even know if it's supported to have a lint replacement-text have a newline in it, but it seems to work fine. The only problem is the reporting is off:

% arc lint javascript/typeahead-package/search-results-popup.jsx
>>> Lint for javascript/typeahead-package/search-results-popup.jsx:


   Error  (S&RX) Ereact/jsx-closing-bracket-location
    The closing bracket must be aligned with the line containing the opening
    tag (expected column 17 on the next line)

              30         if (this.props.totalResults != null) {
              31             resultsText =
              32                 <$_ totalFound={this.props.totalResults}
    >>> -     33                     query={this.props.query}>
        +                            query={this.props.query}>
        +                        
              34                         Show all %(totalFound)s results for %(query)s
              35                 </$_>;
              36         } else {

(If you mouse over the second added line, you can see it's a bunch of spaces.)

The actual replacement we are doing is '' -> '\n ', right before the closing >. And indeed when we actually apply the fix, it shows this:

--- /home/csilvers/khan/webapp/javascript/typeahead-package/search-results-popup.jsx    2015-11-24 14:21:46.486953917 -0800
+++ /tmp/6j9pk1zr31oo4gws/19167-zotkwH  2015-11-24 14:25:00.447741309 -0800
@@ -30,7 +30,8 @@
         if (this.props.totalResults != null) {
             resultsText =
                 <$_ totalFound={this.props.totalResults}
-                    query={this.props.query}>
+                    query={this.props.query}
+                >
                         Show all %(totalFound)s results for %(query)s
                 </$_>;

But in the initial lint error display, it shows the closing > on the first + line, when it should be at the end of the second.

Revisions and Commits

Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

csilvers updated the task description. (Show Details)
csilvers added projects: Lint, Arcanist.
csilvers added a subscriber: csilvers.
eadler added a project: Restricted Project.Jan 11 2016, 9:39 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jan 11 2016, 9:42 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 4 2016, 9:10 PM
epriestley added a revision: Restricted Differential Revision.Aug 31 2017, 3:40 PM
epriestley added a revision: Restricted Differential Revision.Aug 31 2017, 4:18 PM
epriestley added a revision: Restricted Differential Revision.Aug 31 2017, 7:25 PM
epriestley added a revision: Restricted Differential Revision.Aug 31 2017, 7:38 PM
epriestley added a revision: Restricted Differential Revision.Aug 31 2017, 8:06 PM
epriestley closed this task as Resolved by committing Restricted Diffusion Commit.Aug 31 2017, 8:27 PM
epriestley added a commit: Restricted Diffusion Commit.
epriestley added a commit: Restricted Diffusion Commit.
epriestley added a commit: Restricted Diffusion Commit.
epriestley added a commit: Restricted Diffusion Commit.
epriestley added a commit: Restricted Diffusion Commit.
epriestley added a revision: Restricted Differential Revision.Sep 5 2017, 6:50 PM
epriestley added a commit: Restricted Diffusion Commit.Sep 5 2017, 8:09 PM
epriestley added a revision: Restricted Differential Revision.Sep 5 2017, 11:53 PM
epriestley added a commit: Restricted Diffusion Commit.Sep 6 2017, 12:12 AM