Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic new lint boilerplate generation #4942

Closed
basil-cow opened this issue Dec 22, 2019 · 3 comments · Fixed by #4994
Closed

Automatic new lint boilerplate generation #4942

basil-cow opened this issue Dec 22, 2019 · 3 comments · Fixed by #4994
Labels
C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@basil-cow
Copy link
Contributor

basil-cow commented Dec 22, 2019

When creating new lints that don't fit in the old lint categories, I usually go through kinda samey hoops of creating new files and copypasting LateLintPass/EarlyLintPass boilerplate from existing lints. Is there a script or something I can use to generate them for me (if that's possible?). I didn't find anything related in utils.

@flip1995
Copy link
Member

Nope, this has to be written by hand ATM. It could be an addition to clippy_dev though. I can think of a ./util/dev new_{late,early}_lint <LINT_NAME> which then creates a file with the boilerplate for a lint with the name <LINT_NAME>.rs and the lint definition in it.

@flip1995 flip1995 added C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels Dec 23, 2019
@bradsherman
Copy link
Contributor

I'd like to try and do this

@llogiq
Copy link
Contributor

llogiq commented Jan 5, 2020

A good addition might be a hi test file with an empty main method and a TODO comment asking to add things that should (not) be linted.

bors added a commit that referenced this issue Jan 16, 2020
Autogenerate new lints

Add option in clippy_dev to automatically generate boilerplate code for adding new lints

example:

`./util/dev new_lint --name=iter_nth_zero --type=late`

Fixes #4942
bors added a commit that referenced this issue Jan 16, 2020
Autogenerate new lints

Add option in clippy_dev to automatically generate boilerplate code for adding new lints

example:

`./util/dev new_lint --name=iter_nth_zero --type=late`

Fixes #4942

changelog: none
@bors bors closed this as completed in 8b72b72 Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants