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

Track unused code #65

Open
karol-majewski opened this issue Oct 3, 2019 · 2 comments
Open

Track unused code #65

karol-majewski opened this issue Oct 3, 2019 · 2 comments

Comments

@karol-majewski
Copy link

Hello and thank you for your work.

I was wondering if you're interested in making Code Checks track how much dead code is introduced by a PR.

The problem

When making changes to a codebase, it's common to leave code that is exported but never used. It was useful once, but it's not anymore. Unless there are good reasons to leave it in the project, it should be deleted and restored from Git history if need be.

Solutions

There are tools capable of spotting such scenarios:

The problem with some of these tools is that they find too many false positives or they don't provide an escape hatch to mark something as not used now, but let's leave it there. For this reason, using them to prune dead code in a precommit/prepush task may be too aggressive.

I believe there is a use case for them though. If a CI check detected the amount of dead code has increased (and presented the Δ), then this information alone is already useful. I'm not sure if the build should fail or not, but merely being presented with such a warning could help keep our codebases cleaner.

Please let me know what you think, and thanks again for your wonderful tool.

@krzkaczor
Copy link
Member

Hey Karol,

Thanks for your kind words 😄

I can totally relate to a problem that you're describing, my first reaction would be that maybe a linter rule would suffice but your explanation makes sense.

Codechecks is totally permissionless platform - you can start creating your own "plugin" anytime you want, it doesn't require any changes to the common code. You can see examples of full community diven codechecks for example here.

That being said, I am happy to help you with development in any way possible, just let me know :) You can read some pieces of documention about writing your own checks here

PS: we should meet next time I am gonna visit Wrocław :) If you would be in Warsaw ping me!

PS2: Speaking about interesting things that you can build using ts-morph and codechecks, it would be possible detect PRs breaking public API of a library and warn reviewer about it / force major version bump. This usecase is mindblowing 💥

@karol-majewski
Copy link
Author

That being said, I am happy to help you with development in any way possible, just let me know :)

Perfect! It's Hacktoberfest, maybe I should give this one a shot.

PS2: Speaking about interesting things that you can build using ts-morph and codechecks, it would be possible detect PRs breaking public API of a library and warn reviewer about it / force major version bump. This usecase is mindblowing

Agreed! I believe api-extractor could also help with that.

PS: we should meet next time I am gonna visit Wrocław :) If you would be in Warsaw ping me!

We totally should!

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

No branches or pull requests

2 participants