Camelcade / Perl5-IDEA

Perl5 plugins for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/7796-perl/
Other
406 stars 75 forks source link

Support inspections suppression #2071

Open morehockeystats opened 5 years ago

morehockeystats commented 5 years ago

This is a feature request.

Allow the user to manually resolve an XS or an autoload sub or a method that was not found by the parser. Such as this one of Mongo: https://github.com/Camelcade/Perl5-IDEA/issues/1650#issuecomment-349180493

Thanks,

hurricup commented 5 years ago

how do you see this?

morehockeystats commented 5 years ago

Something like ''Remove inspection for this instance"

Maybe "Mark this function as declared".

Maybe provide a means of annotation.

I use a lot of Mongo in my code, it's all littered with these warnings.

hurricup commented 5 years ago

you can always turn off inspection you don't need. Plugin is a set of instruments and not all of them are good for every project. Perl resolve will never be perfect because of language. I'm working on on improvements all the time. But call annotations does not look like a good solution. You could make and annotate getters for this. Instead of $self->{dbh}->something use $self->get_database->something. And by annotating get_database you'll get necessary result.

morehockeystats commented 5 years ago

But the inspection is useful for me in many other cases. I'd rather turn off this particular inspection on a case-by-case basis.

hurricup commented 5 years ago

I'll think about possibility to suppress for the statement/expression/method/file

morehockeystats commented 5 years ago

Here's a sample annotation I found in the JS mode: // noinspection EqualityComparisonWithCoercionJS it suppresses an inspection in a particular statement.

elcamlost commented 5 years ago

Maybe it can be somehow combined with ## no critic annotations?

hurricup commented 5 years ago

@morehockeystats that's exactly what i'm talking about @elcamlost don't know. I believe there is no 1-to-1 matching of critic and inspections

elcamlost commented 5 years ago

@hurricup for those inspections, which has no critic analogous, own namespace can be used.

my $var = $a->b->c->d; ## no critic Camelcade::UnresolvedSubs
...
hurricup commented 5 years ago

@elcamlost hmm. Looks good to me. Thanks!