mistercrunch opened a new pull request, #34292:
URL: https://github.com/apache/superset/pull/34292
⏺ ## Summary
Replaced custom pylint JSON import checking with ruff's built-in
banned-api rule for faster, more consistent linting.
- **Migrated from pylint to ruff** for JSON import detection using TID251
banned-api rule
- **Added per-file-ignores** for legitimate JSON usage (scripts, config
files, etc.)
- **Removed duplicate JSONLibraryImportChecker** while keeping
TransactionChecker and SQLParsingLibraryImportChecker
- **Improved pylint pre-commit hook** to use `git merge-base` for better
rebase/merge workflow compatibility
## Changes
### Ruff Configuration
- Added `flake8-tidy-imports` banned-api rule for `json` and `simplejson`
imports
- Configured per-file-ignores for legitimate cases (scripts/, setup.py,
core config files)
- Reduced violations from 20 to 10 by excluding obvious legitimate usage
### Pylint Cleanup
- Removed `JSONLibraryImportChecker` class (now handled by ruff TID251)
- Kept `TransactionChecker` and `SQLParsingLibraryImportChecker` for
functionality not available in ruff
- Updated registration to only include remaining checkers
### Pre-commit Hook Improvement
- Changed from `origin/$TARGET_BRANCH..HEAD` to `git merge-base`
comparison
- Works consistently with both merge and rebase workflows
- More accurate detection of actually changed files
## Test Plan
- [x] Verified ruff TID251 catches JSON imports with helpful error
messages
- [x] Confirmed per-file-ignores work for excluded files
- [x] Tested custom pylint rules still work for transactions and SQL
parsing
- [x] Pre-commit hook runs without errors and uses merge-base correctly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]