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

Exclude development tools from unused dependencies detection #365

Merged
merged 17 commits into from
Sep 18, 2023

Conversation

zz1874
Copy link
Collaborator

@zz1874 zz1874 commented Sep 7, 2023

Description

Closes #117

This PR addresses the issue of handling tools (development dependencies) that are reported as "unused" in the project's dependencies. The solution involves introducing a default_ignore_unused list that includes common development tools known not to be imported directly in the project's scripts.

There are two scenarios:

  • If the user does not provide their own ignore_unused option, Fawltydeps will use this default_ignore_unused list as its default, automatically detecting and ignoring the specified development tools.
  • If the user provides their own ignore_unused option, it will overwrite the default one, and Fawltydeps will use the user-defined list instead.

Changes Made

  • Added a default_ignore_unused list to specify default development tools to be ignored.
  • Updated unit tests test_cmdline_on_ignored_undeclared_option to include check_unused_action_on_default_ignored_unused_dep__outputs_nothing (automatically detect using default ignore_unused list) and check_unused_action_on_overriden_ignored_unused_dep__outputs_nothing (using user defined ignore_unused list)
  • Updated integration tests for real projects

Copy link
Member

@jherland jherland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, except for a couple of minor changes outlined below (most of my comments are just copies of one change).

In addition to this, I'd like to see an update to the documentation of the --ignore-unused option, to reflect the new default/behavior.

I'm not sure if we should also update the help text:

$ fawltydeps --help
...
  --ignore-unused DEP_NAME [DEP_NAME ...]
                        Dependencies to ignore when looking for unused dependencies, e.g. --ignore-unused pylint black
...

fawltydeps/settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
tests/test_cmdline.py Outdated Show resolved Hide resolved
tests/test_cmdline.py Outdated Show resolved Hide resolved
tests/test_cmdline.py Outdated Show resolved Hide resolved
tests/test_cmdline.py Outdated Show resolved Hide resolved
tests/test_cmdline.py Outdated Show resolved Hide resolved
tests/test_settings.py Outdated Show resolved Hide resolved
tests/test_settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
fawltydeps/settings.py Show resolved Hide resolved
fawltydeps/settings.py Outdated Show resolved Hide resolved
@jherland jherland self-requested a review September 18, 2023 13:11
Copy link
Member

@jherland jherland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No further objections, your honor. 😉

Great work! 🚀

@zz1874 zz1874 merged commit d8b1b27 into main Sep 18, 2023
@zz1874 zz1874 deleted the zhihan/add-default-unused-dependencies branch September 18, 2023 13:19
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

Successfully merging this pull request may close these issues.

How to handle tools (not imported) that end up being reported as "unused" dependencies
3 participants