Page MenuHomePhabricator

Allow interpreter arguments for external linters
Needs ReviewPublic

Authored by joshuaspence on Jul 25 2017, 4:48 AM.
Tags
None
Referenced Files
F13092288: D18275.diff
Thu, Apr 25, 3:34 AM
Unknown Object (File)
Mar 23 2024, 6:33 AM
Unknown Object (File)
Feb 22 2024, 11:12 AM
Unknown Object (File)
Feb 22 2024, 9:45 AM
Unknown Object (File)
Jan 6 2024, 8:44 PM
Unknown Object (File)
Dec 26 2023, 7:55 PM
Unknown Object (File)
Dec 24 2023, 12:32 AM
Unknown Object (File)
Dec 21 2023, 12:59 AM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

I am writing a custom linter binding for a Ruby-based linter which can be run using either of the following methods:

  1. Directly: This requires that the user installs the correct version of the tool in their global environment.
  2. Indirectly: The tool can alternatively be invoked using [[http://bundler.io/v1.3/man/bundle-exec.1.html | bundle exec]] which injects magic values into the environment such that the correct version of the tool (as specified in our Gemfile.lock) is invoked, regardless of whichever version may be installed globally.

We are currently using the direct method for invoking the external linter, but this causes issues whenever we update the linter because we have to ask our users to update their global version. Instead, I'd like to switch to the indirect method of invocation. I thought that I would be able to do this by returning 'bundle exec' from the getDefaultInterpreterMethod, but this doesn't quite work because checkBinaryConfiguration calls Filesystem::binaryExists($interpreter). To allow dependency managers such as Bundler to be used for managing external linters, this diff adds a new configuration property (interpreter.arguments).

Test Plan

Added the following code to our custom external linter:

public function getDefaultInterpreter() {
  return 'bundle';
}

public function getDefaultInterpreterArguments() {
  return array('exec');
}

Diff Detail

Repository
rARC Arcanist
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 17797
Build 23901: Run Core Tests
Build 23900: arc lint + arc unit

Unit TestsFailed

TimeTest
1,019 msArcanistJSHintLinterTestCase::Unknown Unit Message ("")
In 'jshint.lint-test', expected lint to raise error on line 9 at char 0, but no error was raised. Actually raised: warning at line 3, char 8: W033 JSHintW033 error at line 7, char 1: E019 JSHintE019
534 msArcanistPuppetLintLinterTestCase::Unknown Unit Message ("")
Assertion failed, expected values to be equal (at ArcanistLinterTestCase.php:168): Some linters failed: - CommandException: Command failed with error #1! COMMAND
2,320 msArcanistRuboCopLinterTestCase::Unknown Unit Message ("")
In 'warning.lint-test', expected lint to raise warning on line 1 at char 11, but no warning was raised. Actually raised: No messages.
61 msArcanistChmodLinterTestCase::Unknown Unit Message ("")
5 assertions passed.
18 msArcanistClosureLinterTestCase::Unknown Unit Message ("")
1 assertion passed.
View Full Test Results (3 Failed · 24 Passed · 27 Skipped)