Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Who lints the lints? #23

Closed
kentcb opened this issue May 28, 2019 · 6 comments
Closed

Who lints the lints? #23

kentcb opened this issue May 28, 2019 · 6 comments

Comments

@kentcb
Copy link

kentcb commented May 28, 2019

Vague title, but I couldn't resist it sorry.

Here's my situation: I want to use pedantic but I've also got quite a few extra lints that I want enabled. Some of those will almost certainly be included in pedantic itself at some point. Since the point of pedantic is to adhere to Google's standard, the lints I add are useful as a point of difference. However, nothing guarantees that they are a point of difference.

What's the guidance in this situation? It would be nice to know that if my lint configuration becomes redundant at some point (due to a newer pedantic release) that I would be notified, but it seems that this is not the case (I just tried adding a lint that pedantic has already enabled). Is my only recourse to manually pick through the lints I have enabled and see whether they're redundant? Seems finicky.

@srawlins
Copy link
Contributor

Similar discussion over here: dart-lang/linter#1553

@davidmorgan
Copy link
Contributor

You could put something in your presubmit if you like :) ... this is far from beautiful, could definitely be improved:

LINTS=$(\
    cat $(\
        cat .packages | \
        grep pedantic | \
        sed -e 's#.*file://##')/analysis_options*.yaml | \
        egrep '^    -' | \
        sed -e 's# ##g' | \
        sort -u; \
        cat analysis_options.yaml | \
        egrep '^    -' | \
        sed -e 's# ##g');
if [[ $(echo $LINTS | \
    tr ' ' '\n' | \
    sort -u | \
    wc -l) != $(echo $LINTS | \
    tr ' ' '\n' | \
    wc -l) ]]; then \
   echo Redundant lint with pedantic.; exit 1; \
fi

@pq
Copy link
Contributor

pq commented May 28, 2019

Thanks for kicking off the conversation @kentcb. As @srawlins mentioned, we've talked a bit about this problem but haven't settled on a solution so your input is appreciated. Do you have an ideal flow in mind? Would a presubmit suffice? Would you like feedback in the IDE?

@kentcb
Copy link
Author

kentcb commented May 29, 2019

Ideally, I'd like the problems to be surfaced in the same manner as other lints. For me, that means the PROBLEMS panel in VS Code.

Presubmits are a nice idea, but aren't portable. It's not uncommon for team members to use different operating systems and - in my experience at least - this makes the use of hooks untenable.

@pq
Copy link
Contributor

pq commented May 29, 2019

Thanks @kentcb. I've opened a feature request on the linter here: dart-lang/linter#1588. Alternatively, we could do this in the analyzer but, as @bwilkerson points out, it may not be universally desired so a simple opt-in model may be best.

Feel free to chime in with any additional thoughts there!

@matanlurey
Copy link

Closed - refer to dart-lang/linter#1588 going forward.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants