Output Filters Explained?
I am loving WebStorm and i am trying to streamline my development environment. I have 2 external tools I use to make sure my code quality it up to snuff :) Google JSLint and fixjsstyle.
I am trying to create output filters for them to enable hyperlinks in the console window. I might be a little confused about this feature of maybe I am doing it wrong.
Here is the example output from the linter:
/usr/local/bin/gjslint --strict /Users/jmorrin/Dropbox/Development/james/labs/framework/WebReviewer/js/app/DataSource.js
----- FILE : /Users/jmorrin/Dropbox/Development/james/labs/framework/WebReviewer/js/app/DataSource.js -----
Line 4, E:0005: Illegal tab in whitespace before "]"
Line 7, E:0110: Line too long (81 characters).
Line 14, E:0120: Binary operator should go on previous line ","
Line 15, E:0120: Binary operator should go on previous line ","
Line 15, E:0110: Line too long (81 characters).
Line 18, E:0120: Binary operator should go on previous line ","
Line 19, E:0120: Binary operator should go on previous line ","
Line 20, E:0120: Binary operator should go on previous line ","
Line 21, E:0120: Binary operator should go on previous line ","
Line 22, E:0120: Binary operator should go on previous line ","
Line 31, E:0120: Binary operator should go on previous line ","
Found 11 errors, including 0 new errors, in 1 files (0 files OK).
Some of the errors reported by GJsLint may be auto-fixable using the script
fixjsstyle. Please double check any changes it makes and report any bugs. The
script can be run by executing:
I would love to be able to click on each line number and have it jump to the line number in the source file. I have tried playing around with the output filter but I dont think I quite understand how to use it properly since linking never seems to work correctly. What are $LINE$ and $FILE_PATH$ referring to? I am pretty sure file path will refer to the file I ran the linter on but I dont know where $LINE$ gets its value from.
Are there are docs or maybe some tutorials out there that explains this feature in depth?
Please sign in to leave a comment.
Those are special capture patterns to be used in regex i.e.
----- FILE : $FILE_PATH$ .*
Line $LINE$, .*
sorry for resurrecting this old thread, I believe I have a good reason :)
Below is a sample output from the external tool
phpcs -l --standard=Zend CategoryController.php
FILE: ...src/DD/public/app/code/local/DD/Deal/controllers/CategoryController.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 10 WARNING(S) AFFECTING 10 LINE(S)
--------------------------------------------------------------------------------
83 | WARNING | Line exceeds 80 characters; contains 90 characters
84 | WARNING | Line exceeds 80 characters; contains 97 characters
87 | WARNING | Line exceeds 80 characters; contains 81 characters
109 | WARNING | Line exceeds 80 characters; contains 120 characters
125 | WARNING | Line exceeds 80 characters; contains 104 characters
127 | WARNING | Line exceeds 80 characters; contains 89 characters
136 | WARNING | Line exceeds 80 characters; contains 105 characters
170 | WARNING | Line exceeds 80 characters; contains 83 characters
171 | WARNING | Line exceeds 80 characters; contains 92 characters
180 | WARNING | Line exceeds 80 characters; contains 86 characters
--------------------------------------------------------------------------------
Process finished with exit code 1
When I set up an output filter for Php Code Sniffer, I must use the macro $FILE_PATH$ when I want to use $LINES$. For example I use
(including the leading space) in an attempt to capture the line numbers. OKing this yields the error message "Expression must contain $FILE_PATH$ macros.
So how would I set up the output filter correctly in order to have PS jump to the offending line in the correct file? I am somewhat familiar with regular expressions but find it difficult to make sense of $LINES$ and $FILE_PATH$
AFAIK currently only classic "emacs-style" output is supported: each message should contain both file name, line number and message text. Usually tools have switch to use this mode.