Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] DLTK Validator - problem with Output Rule

I want to use DLTK Validator for coding standard validation by external validator (PHP_CodeSniffer).
I am proceeding in accordance with the instructions at DLTK Validators User Guide. I can customize output from PHP_CodeSniffer anyway. But I cannot find good pair: PHP_CodeSniffer output format and Output rule for validator. 

For example Output rule is:

%f, %n, %m

and line from validator is:

/home/ivo/homeprojects/mortars/common.php, 22, Line indented incorrectly; expected 4 spaces, found 8
.

DLTK Validator puts message on line 4 (in eclipse window), not on line 22 and whole message from external validator is visible in eclipse window (filename included).
Parsing of validator output is wrong in this case.

Can somebody help me with this?


I am not a java programmer, but I looked to code of class ExternalCheckerWildcardManager on package org.eclipse.dltk.validators.internal.externalchecker.core.
There are substitution for wild-chars (%f, %m, %l) by regular _expression_ ("[\w]?:?.+", ".*", "[0-9]+" ).
I thing, that there is something wrong and I have two comments to it.
  1. Regular _expression_ [\w]?:?.+ for filename "eats" anything. May be, that is possible to find better (or simplify it to .* if not).
  2. Generally is difficult to  write output rule for validator (with %f, %m, %l) if you don't know, haw will exactly look resulting regular _expression_. By my opinion is better way to use Named Capturing Groups (I don't know, if it is possible in Java). Output rule in this case can be (for my task on linux) something like 
(?<filename>[^\s]+)[\s]+(?<line>[0-9]{1,6})[\s]+(?<message>.*)
(File name is without white chars, line is number, massage is anything to end of line, white chars are used for separators).
for output like this:
/home/ivo/homeprojects/mortars/common.php, 22, Line indented incorrectly; expected 4 spaces, found 8
Advance user can write whole regular _expression_ and parse can only referer to parsed parts (with names filename, line and message).
Than you for any advice or reaction.
Ivo



Back to the top