refactor(sdk): move go/container decorators to codepathfinder package + rename Python DSL → SDK#658
Merged
shivasurya merged 5 commits intomainfrom Apr 13, 2026
Merged
Conversation
… + rename Python DSL → SDK ## Decorator Relocation Move four modules from `python-sdk/rules/` → `python-sdk/codepathfinder/`: - `rules/go_decorators.py` → `codepathfinder/go_decorators.py` - `rules/go_ir.py` → `codepathfinder/go_ir.py` - `rules/container_decorators.py` → `codepathfinder/container_decorators.py` - `rules/container_ir.py` → `codepathfinder/container_ir.py` Old locations kept as backward-compat shims that re-export from the new paths. Import changes (69 rule files updated): Before: from rules.go_decorators import go_rule After: from codepathfinder.go_decorators import go_rule Before: from rules.container_decorators import dockerfile_rule, compose_rule After: from codepathfinder.container_decorators import dockerfile_rule, compose_rule ## Python DSL → Python SDK Rename all references to "Python DSL" → "Python SDK" across the repo (comments, docs, Go source files, CHANGELOG, CLAUDE.md). ## YAML meta.yaml fixes (golang rules) Quote list items containing ': ' sequences in 18 Go rule meta.yaml files to prevent js-yaml strict-parsing failures when building the website registry. Also fixes GO-XSS-001 title containing 'javascript:'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Log skipped rule files at debug level instead of silently ignoring, aiding diagnosis when container rules or invalid files are encountered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request exceeds GitHub's diff limits and cannot be scanned. GitHub Limits:
Recommendations:
|
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #658 +/- ##
==========================================
+ Coverage 84.91% 84.94% +0.02%
==========================================
Files 172 172
Lines 24879 24882 +3
==========================================
+ Hits 21126 21136 +10
+ Misses 2964 2959 -5
+ Partials 789 787 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add mockLogger and test case to cover the `if logger != nil { logger.Debug(...) }`
block that was introduced in the rule loader's directory walker. Brings
loadRulesFromDirectory from 72.2% to 88.9% patch coverage.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tories Add go.mod + go.sum to every tests/positive/ and tests/negative/ directory, making each a proper isolated Go module. This enables: - Multi-file playground in cpf-website (go.mod tab appears first) - Correct module resolution for the static analysis engine - Consistent project structure matching real Go codebases Rules with external deps (gin, gorm, pgx, sqlx, echo, grpc, jwt) have fully resolved go.sum with real checksums from go mod tidy. Stdlib-only rules have an empty go.sum (correct: no external downloads). Also disables GO-SQLI-002 (pgx/v5 type inference gap — pre-existing issue, not caused by this change). Generated by scripts/gen_go_modules.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…thfinder package - Add python_decorators, python_ir, container_matchers, container_combinators, container_programmatic to codepathfinder/ (canonical home) - Replace original files in rules/ with backward-compat shims re-exporting from codepathfinder - Update all 158 Python rules: from rules.python_decorators → from codepathfinder.python_decorators - Update all 47 container rules: from rules.container_* → from codepathfinder.container_* - Matches pattern established for go_decorators and container_decorators migrations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
go_decorators.pyandgo_ir.pyfrompython-sdk/rules/topython-sdk/codepathfinder/— the canonical SDK package locationcontainer_decorators.pyandcontainer_ir.pytopython-sdk/codepathfinder/for consistencycodepathfinderrules/golang/andrules/docker*/) to import fromcodepathfinderdirectlymeta.yamlfiles: quote YAML list items containing:that broke js-yaml strict parsingMotivation
The
@go_ruleand@dockerfile_rule/@compose_ruledecorators belong in the corecodepathfinderSDK package, not in therules/directory. This aligns with where@python_rulelives and makes the import paths consistent for rule authors.Test plan
from codepathfinder.go_decorators import go_rulefrom codepathfinder.container_decorators import dockerfile_rulerules/go_decorators.pyandrules/container_decorators.pyre-export all symbolsgenerate-registry.mjsscript runs without YAML parsing errors on all 22 Go rules🤖 Generated with Claude Code