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

improve the debug logging #627

Merged
merged 11 commits into from
Mar 23, 2024
Merged

improve the debug logging #627

merged 11 commits into from
Mar 23, 2024

Conversation

fpgmaas
Copy link
Owner

@fpgmaas fpgmaas commented Mar 19, 2024

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

Improved debug logging: All imported modules and their locations were printed to a single line; this is now printed as indented json so it's easier for users to debug. For an example, see below.

In addition, the modules are now sorted after collecting them from Rust, so they now are sorted in alphabetical order in other locations in the logs too. This makes it easier to find information regarding a module in the logging output.


before

Scanning 41 files...
All imported modules: defaultdict(<class 'list'>, {'abc': [Location(file=PosixPath('python/deptry/reporters/base.py'), line=3, column=1), Location(file=PosixPath('python/deptry/dependency_getter/base.py'), line=4, column=1), Location(file=PosixPath('python/deptry/violations/base.py'), line=3, column=1)], 'contextlib': [Location(file=PosixPath('python/deptry/dependency.py'), line=5, column=1), Location(file=PosixPath('python/deptry/dependency_getter/poetry.py'), line=3, column=8)], 're': [Location(file=PosixPath('python/deptry/dependency_getter/requirements_txt.py') ...

after

Scanning 41 files...
All imported modules and their locations:
{
  "__future__": [
    "Location(file=PosixPath('python/deptry/dependency_getter/base.py'), line=1, column=1)",
    "Location(file=PosixPath('python/deptry/core.py'), line=1, column=1)",
    ...
  ],
  "abc": [
    "Location(file=PosixPath('python/deptry/dependency_getter/base.py'), line=4, column=1)",
    "Location(file=PosixPath('python/deptry/violations/base.py'), line=3, column=1)",
    "Location(file=PosixPath('python/deptry/reporters/base.py'), line=3, column=1)"
  ],
  "click": [
    "Location(file=PosixPath('python/deptry/exceptions.py'), line=5, column=1)",
    "Location(file=PosixPath('python/deptry/cli.py'), line=10, column=8)",
    "Location(file=PosixPath('python/deptry/config.py'), line=12, column=12)"
  ],
 

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.4%. Comparing base (e331e3d) to head (95654cd).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #627   +/-   ##
=====================================
  Coverage   90.3%   90.4%           
=====================================
  Files         33      33           
  Lines        964     970    +6     
  Branches     188     189    +1     
=====================================
+ Hits         871     877    +6     
  Misses        79      79           
  Partials      14      14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fpgmaas fpgmaas added this to the 0.15 milestone Mar 21, 2024
@fpgmaas fpgmaas mentioned this pull request Mar 21, 2024
4 tasks
python/deptry/imports/extract.py Outdated Show resolved Hide resolved
@fpgmaas fpgmaas merged commit 3efc505 into main Mar 23, 2024
29 checks passed
@fpgmaas fpgmaas deleted the debug-logging branch March 23, 2024 11:28
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.

None yet

2 participants