Closed ierceg closed 7 years ago
@neboysa you didn't even let me know that this was done! But now I have a request (of course! ;) Can we make this work:
// lazy ignore rule1 rule2 rule3 ; and comments still work as well!
instead of specifying each rule on a separate line. We could even use a different syntax, more in line with standard C/C++ pragmas (e.g. // #lazy ignore(rule1, rule2, rule3) and now whatever I write here is ignored
) or simply split the rule params with space (.split(' ')
) and ignore everything after the first one starts with ;
or the last one that contains ;
What I like about the implementation is that it's not related to any particular engine - anything that returns ruleId
will work. But the style of comments is tightly coupled to the style of comments used in a language, right? So in YAML we can't specify # lazy ignore whatever
and expect it to work, right? That needs fixing. We need a "comments linter" engine anyway and that one will have to figure out the comments from all the different languages so there is a core reusable component there.
You can also write:
// lazy ignore-once ruleId
and rule will be ignored just once (on first occurrence after the above directive).
I vote for following syntax:
// lazy ignore rule1 rule2 rule3 ; this is not analyzed
Its kind of sexy & simple...
?
@ierceg I am not sure I understand this about comments being tightly coupled to the style of comments in a language...
Right now, directives can be in one of these forms:
// lazy ignore rule
/* lazy ignore rule */
# lazy ignore rule
So, we are supporting C-style (// /* */
) and YAML style (#
) comments.
Plus a hack: for example in HTML file (that doesn't support any of these comment styles) you can write:
<!-- // lazy ignore rule -->
That -once
thing is just great!
Re tightly coupled, that's what I meant: different languages have different ways of creating comments but /* */
, //
and #
seem to cover 95+% (no old Pascal comments though ;)
So let's just do multi-rule syntax as you proposed.
This has been solved I think @neboysa ?
Yep. Resolved.
Sent from my ZX Spectrum.
On Mon, Jan 16, 2017 at 7:12 PM +0100, "Ivan Erceg" notifications@github.com wrote:
This has been solved I think @neboysa ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Currently users have to know the underlying engine implementation to correctly define their pragmas but shouldn't they be able to define them on lazy level and then have lazy (that is, its underlying engines) figure out the desired outcome no matter the details?
For example in some engines we have to turn off class-method-use-this warning with:
This should really be expressed as (made up, changed pragma name to show that there is no 1:1 mapping):