Page MenuHomePhabricator

Fix ExternalLinter not passing file path for stdin option
AbandonedPublic

Authored by BYK on Sep 10 2014, 9:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 9:37 AM
Unknown Object (File)
Thu, Apr 25, 3:17 AM
Unknown Object (File)
Thu, Apr 11, 10:39 AM
Unknown Object (File)
Mar 28 2024, 12:22 PM
Unknown Object (File)
Mar 13 2024, 5:29 AM
Unknown Object (File)
Jan 14 2024, 4:54 PM
Unknown Object (File)
Jan 10 2024, 5:16 PM
Unknown Object (File)
Jan 7 2024, 4:25 AM

Details

Reviewers
epriestley
chad
Group Reviewers
Blessed Reviewers
Test Plan

Make sure JSHint linter works properly

Diff Detail

Repository
rARC Arcanist
Branch
fix-external-linter
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 2488
Build 2492: [Placeholder Plan] Wait for 30 Seconds

Unit TestsFailed

TimeTest
0 mstestJSHintLinter
0 mstestPuppetLintLinter
0 mstestFixLetterCase
0 mstestJSONLinter
0 mstestMergeConflictLint
View Full Test Results (2 Failed · 10 Passed · 15 Skipped)

Event Timeline

BYK retitled this revision from to Fix ExternalLinter not passing file path for stdin option.
BYK updated this object.
BYK edited the test plan for this revision. (Show Details)
BYK added reviewers: epriestley, chad.
epriestley edited edge metadata.

This is not the correct change.

When linters override supportsReadDataFromStdin(), that means they can run in a mode like this, and read input from stdin:

cat file.js | linter -

Although we may move away from this in the future, we currently try to do this if a linter supports it, because lint has a "commit hook" mode and there are no files on disk while lint is executing as a commit hook (there is a pending transaction and no working copy).

This patch makes us run this instead:

cat file.js | linter - file.js

This is not correct in the general case.

If JSHint no longer supports reading data from stdin, the correct change is to return false from supportsReadDataFromStdin(). A pointer to a changelog or commit where JSHint dropped support would be helpful.

This revision now requires changes to proceed.Sep 10 2014, 1:43 PM

Ah, damn I missed $future->write($this->getEngine()->loadData($path)); and got confused. Welp then this is definitely not the correct change yeah.

That said the piping doesn't work for me for some reason (although JSHint supports it). I'll investigate.

JSHint does have a --filename flag which is possibly what you are after?

--filename STRING  Pass in a filename when using STDIN to emulate config 
                   lookup for that file name

@joshuaspence - it does accept input from stdin but it was not working for me for some reason and I was too quick to read the code missing the actual part that passed the input. Apparently it is something related to my own system. Thanks for the heads up tho :)