Repository navigation
feat: add SQBRPYTHON provider layout rules for providers/ - #1492
Merged
Merged
Conversation
…ounts Parse files in parallel, keep the provider count in the caller, regenerate the DuckShop edge-case findings and docs skill, and edit the providers page's layout section into shape.
…cript assignments SQBRPYTHON014 now accepts a Provider imported under an alias or reached through project base classes, reports tuple, attribute and subscript assignments in provider.py, and only parses files under providers/ or that mention providers. The providers page shows the capability-folder layout, and the violations fixture no longer hides an existing finding.
… or unknown Keep dotted base names so module attribute bases resolve, report a class as not a Provider only when every base chain resolves to project classes or builtins, and stay silent when a chain leaves the parsed sources. Any assignment with an attribute or subscript target is a statement that does not belong in provider.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Providers have no enforced shape: clients, helper functions and collaborator classes end up flat in
providers/, and nodes reach into another provider's private code. The Python rules already check the node unit layout underpython/; providers need the same single convention.Changes
SQBRPYTHON013–SQBRPYTHON015, on by default underSQBRPYTHON:013provider-layout:providers/<capability>/provider.py, with only role files (models.py,types.py,constants.py,exceptions.py),_helpers/and_classes/beside it.014provider-module-shape:provider.pyholds imports, private constants and one publicProvidersubclass. Bases are followed through imports, aliases, module attributes and project base classes; a class whose base comes from another package is never reported.015provider-import-boundaries: a provider's_helpers/and_classes/are private to it; providers import onlypython/utils/frompython/and nothing fromorchestration/.sqlbuild-pysourcerecords classes, dotted bases and assignments for the rules.SQBRPYTHONmay get new provider findings.DuckShop: the
python_rulesedge case adds a conformingcarrier_apiprovider and a violation for each rule, with updated expected findings. The main DuckShop project has noproviders/, so its findings are unchanged.Verification
cargo test -p sqlbuild-rules -p sqlbuild-pysource, including table cases for aliased, indirect, re-exported and external bases, tuple, subscript, mixed and chained assignments; clippy with-D warnings;fensu check.test_rules.pyand the rule-engine unit tests, including the DuckShop edge case.make check-cion the final head.