Skip to content

98 implement usethis tool import linter #501

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

Closed
wants to merge 53 commits into from

Conversation

nathanjmcdougall
Copy link
Owner

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Apr 7, 2025 that may be closed by this pull request
Copy link

codspeed-hq bot commented Apr 7, 2025

CodSpeed Performance Report

Merging #501 will not alter performance

Comparing 98-implement-usethis-tool-import-linter (3cf868b) with main (868463e)

Summary

✅ 1 untouched benchmarks

Copy link

codecov bot commented Apr 7, 2025

Codecov Report

Attention: Patch coverage is 98.78049% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.25%. Comparing base (868463e) to head (3cf868b).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_integrations/file/ini/io_.py 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #501      +/-   ##
==========================================
- Coverage   97.27%   97.25%   -0.03%     
==========================================
  Files          83       85       +2     
  Lines        3966     4079     +113     
==========================================
+ Hits         3858     3967     +109     
- Misses        108      112       +4     

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

@nathanjmcdougall
Copy link
Owner Author

I think #500 is a pre-requisite to merging because otherwise the warning message here will be repeated multiple times unnecessarily:

if not root_packages:
# Couldn't find any packages, we're assuming the package name is the name
# of the project. Warn the user accordingly.
name = get_project_name()
warn_print("Could not find any importable packages.")
warn_print(f"Assuming the package name is {name}.")
root_packages = [name]

@nathanjmcdougall
Copy link
Owner Author

Based on the changes from #500 it has highlighted another issue - we might have an arbitrary number of config entries - we want to lay claim to a "family" of ConfigEntries all with the prefix importlinter:contracts: in the section name.

This is getting quite complicated, but I think it's the right choice.

The getter for an individual contract might need to use a cached function which gives all contracts values, and returns NoConfigValue if the contract doesn't exist.

So we need a way to register an abstract family of contract entries.

@nathanjmcdougall
Copy link
Owner Author

The CI isn't running anymore, rather inexplicitly. It might be because this PR has too many commits against it, so I'll try opening a new PR I think.

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.

Implement usethis tool import-linter
1 participant