Page MenuHomePhabricator

CustomLinter Fails
Closed, InvalidPublic

Description

Situation

In my company, some developer needs to work in a windows environment. Therefore I need a basic custom linter based on the ArcanistTextLinter.
So I started asking in Q220 how this works in general.
I copied an exisiting Linter, customized it an saved it in the arcanist extensions directory.
After editing my .arclint file arc linters command works as expected and finds the new linter.

The Error

If I try to lint some files i get the following error:

$ arc lint WindowsPowerShell/Modules/VCRTools/Write-Message2.ps1 --trace
libphutil loaded from '/home/admwkiv924/phab/libphutil/src'.
arcanist loaded from '/home/admwkiv924/phab/arcanist/src'.
Config: Reading user configuration file "/home/admwkiv924/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/admwkiv924/workspace/phabricator/vcr-powercli/.arcconfig".
Working Copy: Path "/home/admwkiv924/workspace/phabricator/vcr-powercli" is part of `git` working copy "/home/admwkiv924/workspace/phabricator/vcr-powercli".
Working Copy: Project root is at "/home/admwkiv924/workspace/phabricator/vcr-powercli".
Config: Did not find local configuration at "/home/admwkiv924/workspace/phabricator/vcr-powercli/.git/arc/config".
Examining paths for linter 'powerhsell'.
Found 1 matching paths for linter 'powerhsell'.
[2015-11-25 13:06:16] ERROR 2: md5_file(/home/admwkiv924/phab/arcanist/src//home/admwkiv924/phab/arcanist/src/extensions/ArcanistPowerShellLinter.php): failed to open stream: No such file or directory at [/home/admwkiv924/phab/arcanist/src/lint/engine/ArcanistLintEngine.php:204]
arcanist(head=master, ref.master=9e78d15fc0c7, custom=1), phutil(head=master, ref.master=5538909d6468)
  #0 md5_file(string) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:204]
  #1 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:334]
  #2 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
>>> [0] <lint> Basic PowerShell Linter <paths = 1>
<<< [0] <lint> 343 us
>>> [1] <lint> Basic PowerShell Linter <paths = 1>
<<< [1] <lint> 96 us
>>> [2] <exec> $ git rev-parse --git-dir
<<< [2] <exec> 3,799 us
 OKAY  No lint warnings.

At first I thought I did something wrong with the lint file itself, or messed up with my environment. So I moved to a new system and tried it again but with the same result. I also tried it in a windows and linux environment with the same results.
According to the line beginning with [2015-11-25 13:06:16] ERROR 2: it seems like the directory is wrong. Maybe because of some configuration errors or parsing in ArcanistLinterEngine:

ArcanistLinterEngine: Lines202 ff
if ($symbol) {
        $version .= ':'.md5_file(
          phutil_get_library_root($symbol['library']).'/'.$symbol['where']);
      }

So I hope this are enough details to work with :D

Event Timeline

OCram updated the task description. (Show Details)
OCram added a project: Lint.
OCram added a subscriber: OCram.

If you look at the error message and the path you can see what the issue is:

md5_file(/home/admwkiv924/phab/arcanist/src//home/admwkiv924/phab/arcanist/src/extensions/ArcanistPowerShellLinter.php): failed to open stream: No such file or directory at [/home/admwkiv924/phab/arcanist/src/lint/engine/ArcanistLintEngine.php:204]

If you look at the error message and the path you can see what the issue is:

md5_file(/home/admwkiv924/phab/arcanist/src//home/admwkiv924/phab/arcanist/src/extensions/ArcanistPowerShellLinter.php): failed to open stream: No such file or directory at [/home/admwkiv924/phab/arcanist/src/lint/engine/ArcanistLintEngine.php:204]

But the file exists. Its the default ArcanistLintEngine file in the arcanist repo. And yes, I a also noticed weird looking / parsed path. Where does it come from?

You have the path to the library directory twice, print out the variables
that you use in the md5 function.

Hmm strange, I do not use any md5 function. I simply copied the ArcanistTextLinter and changed it to work with files containing \r\n line ends. Thats the reason why I do not know where the md5 function all or the variables come from ^^

chad claimed this task.
chad added a subscriber: chad.

Closing as this is outside what the upstream provides support for (custom development). Generally Maniphest is for feature requests and bug reporting. Ponder, IRC, Conpherence are open areas for general use discussion.

In T9848#145894, @OCram wrote:

Hmm strange, I do not use any md5 function. I simply copied the ArcanistTextLinter and changed it to work with files containing \r\n line ends. Thats the reason why I do not know where the md5 function all or the variables come from ^^

Based on my understanding of what your linter does, it sounds like T5105 is what you want.

In T9848#145894, @OCram wrote:

Hmm strange, I do not use any md5 function. I simply copied the ArcanistTextLinter and changed it to work with files containing \r\n line ends. Thats the reason why I do not know where the md5 function all or the variables come from ^^

Based on my understanding of what your linter does, it sounds like T5105 is what you want.

Not exactly. My Problem is, I can add any custom linter for example: an exact copy for an existing (with a new class name), an empty one with no functional purpose and I always get the md5 error like shown. So I wanted to point out, if there is a problem with custom linters in general or if I don't unterstand anything right.

I know that upstream can't offer support for fixing this, but would you be at all willing to accept a patch that addresses this issue?

(As an aside, I'm sorry if commenting on an old task is a poor place to ask this question and would appreciate any suggestions about a better place to ask)

If it is impossible to reproduce this issue without writing custom code, we won't accept a patch for it.

If it is possible to reproduce this issue without writing custom code, file a bug report with reproduction steps by following Contributing Bug Reports and Providing Reproduction Steps. We will fix the issue or accept a patch for it after we have a valid, reproducible bug report.