Closed benbor closed 7 years ago
Hello @benbor,
Sadly, I do not understand your question. Can you try to rephrase your question? Thanks!
As far as I understand he wants GrumPHP to fail only if it's due to one of the changed lines, so just because the file you edit have some CodeSniffer errors you'll still be able to commit your unrelated, CodeSniffer-approved change in that file.
Personally I think it's near impossible to do something like that, especially for all external tasks. Some tools do report the failing line, so it could be possible to filter on that, but I can imagine the line number not always being exact for multi-line definitions, function calls, arrays etc.
Indeed, that is not possible: Since we are using external CLI tools, it mostly is only possible to run on file base. For some tasks this is possible, but they are already implemented this way.
@jyggen Yes, i meant it. And yes, you're right again, the line number not always being exact for multi-line definitions. But for some projects (very awful legacy projects) with huge files it will be silver bullet.
@veewee From my point of view, we can do it.
If external CLI tool return line numbers of fails ( for example CodeSniffer) we can parse output and after that found intersections. Of course it's will work for external CLI only which return needed data.
@benbor, It is possible to write your own formatter for almost every task. This way you can fetch the process result message and do whatever you want with it. It isn't documented at the moment, but there are some examples available: https://github.com/phpro/grumphp/tree/master/src/Formatter
Is it planning to realize feature to check lines witch was changed only? For all external tasks?