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

Warn if file contains large number of items #2261

Open
clarfonthey opened this issue Dec 6, 2017 · 6 comments
Open

Warn if file contains large number of items #2261

clarfonthey opened this issue Dec 6, 2017 · 6 comments
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-guidelines Lint: Related to the Rust API Guidelines T-AST Type: Requires working with the AST

Comments

@clarfonthey
Copy link
Contributor

Basically a lint that pushes people to factor their code into multiple files. I have no idea exactly how this would be computed, but it'd be nice to have in some form.

@oli-obk oli-obk added L-guidelines Lint: Related to the Rust API Guidelines good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-AST Type: Requires working with the AST labels Dec 7, 2017
@oli-obk
Copy link
Contributor

oli-obk commented Dec 7, 2017

One needs to take care not to count items generated by a single macro invocation as more than one item. Also, this lint would need to be configurable in clippy.toml

@killercup
Copy link
Member

killercup commented Dec 7, 2017

Might also be a good idea to do some trivial analysis on similarity of names to group items together? E.g., suggest putting FooStatus, FooUpdater, FooFetcher in a foo.rs and BarQuery, BarIsta, BarError in bar.rs.

@Aadjou
Copy link

Aadjou commented May 28, 2018

this sounds cool, I am going to start working on this 🐙

@felix91gr
Copy link
Contributor

felix91gr commented Mar 2, 2019

@Aadjou, did you have any success with this lint?

The topic of "file that might need to be refactored to reduce its complexity" is something I'm very interested in, and it might have overlap with the Cognitive Complexity lint, after it gets polished enough to aggregate scores from the different functions present in one file.

@Aadjou
Copy link

Aadjou commented Apr 2, 2019

Dear @felix91gr
Sorry for the late reply. Unfortunately I did not get to finish it yet as times are very busy. Please feel free to take over!

@felix91gr
Copy link
Contributor

Sorry for the late reply.

It's okay, I hope everything's going alright :)

Please feel free to take over!

We might! I think this might belong if not to the Cognitive Complexity topic, to a very similar one. If you have ideas, feel free to ping me or oli-obk :)

At #3793 is the main discussion if you want to keep tabs on it; I'll post there once we start working on the new implementation 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-guidelines Lint: Related to the Rust API Guidelines T-AST Type: Requires working with the AST
Projects
None yet
Development

No branches or pull requests

7 participants