Skip to content

improve the debug logging#627

Merged
fpgmaas merged 11 commits intomainfrom
debug-logging
Mar 23, 2024
Merged

improve the debug logging#627
fpgmaas merged 11 commits intomainfrom
debug-logging

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)"
  ],
 

@codecov
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 requested a review from mkniewallner March 19, 2024 19:30
@fpgmaas fpgmaas added this to the 0.15 milestone Mar 21, 2024
@fpgmaas fpgmaas mentioned this pull request Mar 21, 2024
4 tasks
@fpgmaas fpgmaas merged commit 3efc505 into main Mar 23, 2024
@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.

2 participants