this post was submitted on 24 Jun 2023
0 points (NaN% liked)

Python

6357 readers
9 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

Sometimes unused class or function manages to slip into code base. Static code checkers like ruff, flake8 does not have rules for detecting such globally unused code.

I tried using vulture, but it has too many false positives to have it as part of CI/CD pipeline.

I have tried to implement my own, more reliable check for global deadcode detection.

Please let me know what you think about it.

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 year ago

Interesting. I'll have to give it a try.

Currently putting together unit tests for a project and I'm using pytest-cov to identify unused blocks of code (that I need to define tests to invoke). A lot of time code isn't used but should remain as it has a purpose for a future / anticipated need

[–] [email protected] 1 points 1 year ago

That's nice, but that's usually what testing and coverage are for.

[–] [email protected] 1 points 11 months ago

Hello, Im confuse how to use deadcode, installed it with pip install deadcode In Spyder console typed 'deadcode' or 'deadcode .', result: NameError: name 'deadcode' is not defined I want to remove unused variable. Thanks