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

Use base classes to simplify issue finders and dependency getter #154

Merged
merged 4 commits into from
Oct 3, 2022

Conversation

mkniewallner
Copy link
Collaborator

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Description of changes

Simplify issue finders and dependency getter logic by using base classes in order to reduce duplication and respect a common format.
Commit by commit review is advised here.

@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2022

Codecov Report

Merging #154 (bfed0f5) into main (1b12183) will increase coverage by 0.3%.
The diff coverage is 90.9%.

@@           Coverage Diff           @@
##            main    #154     +/-   ##
=======================================
+ Coverage   92.9%   93.2%   +0.3%     
=======================================
  Files         43      45      +2     
  Lines       1355    1369     +14     
=======================================
+ Hits        1259    1277     +18     
+ Misses        96      92      -4     
Impacted Files Coverage Δ
deptry/issues_finder/misplaced_dev.py 29.4% <41.6%> (ø)
deptry/core.py 58.3% <50.0%> (+1.1%) ⬆️
deptry/issues_finder/transitive.py 91.6% <83.3%> (ø)
deptry/issues_finder/base.py 92.3% <92.3%> (ø)
deptry/dependency_getter/base.py 95.0% <95.0%> (ø)
deptry/dependency_getter/poetry.py 100.0% <100.0%> (ø)
deptry/dependency_getter/requirements_txt.py 97.4% <100.0%> (+0.8%) ⬆️
deptry/issues_finder/missing.py 100.0% <100.0%> (ø)
deptry/issues_finder/obsolete.py 96.5% <100.0%> (ø)
tests/dependency_getter/test_poetry.py 100.0% <100.0%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@fpgmaas
Copy link
Owner

fpgmaas commented Oct 3, 2022

Looks good to me! Merge requests that manage to remove more lines than that they add are the best 😄 Having to pass dev_dependencies to some issue_finders is an artifact of before I added the is_dev_dependency flag to Module. Maybe it would be good to add a unit test for MisplacedDevDependencyFinder, now that we are making some refactoring changes in it, e.g.

tests/issues_finder/misplaced_dev.py
from deptry.issues_finder.misplaced_dev import MisplacedDevDependenciesFinder
from deptry.module import Module


def test_simple():
    dependencies = ["bar"]
    dev_dependencies=["foo"]
    modules = [Module("foo", dev_top_levels=["foo"], is_dev_dependency=True)]
    deps = MisplacedDevDependenciesFinder(imported_modules=modules, dependencies=dependencies, dev_dependencies=dev_dependencies).find()
    assert len(deps) == 1
    assert deps[0] == "foo"

@mkniewallner mkniewallner marked this pull request as ready for review October 3, 2022 17:08
@mkniewallner mkniewallner requested a review from fpgmaas October 3, 2022 17:08
@fpgmaas fpgmaas merged commit 26e55ac into fpgmaas:main Oct 3, 2022
@mkniewallner mkniewallner deleted the some-refactoring branch November 6, 2022 21:44
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.

3 participants