Instagram / Fixit

Advanced Python linting framework with auto-fixes and hierarchical configuration that makes it easy to write custom in-repo lint rules.
https://fixit.rtfd.io/en/latest/
Other
667 stars 62 forks source link

Improved the Handling of Errors in Rule Collection #479

Closed surge119 closed 1 month ago

surge119 commented 1 month ago

Summary

If a rule defined in a config contains an error or causes an error in Fixit, the linter will raise an unrecoverable error. This PR adds error handling to catch and log those errors as warnings, and continue linting

Test Plan

$ hatch run fixit lint ./src/fixit/api.py
WARNING:fixit.config:Failed to load rules 'fixit.rules': CollectionError: could not import rule(s) fixit.rules
🧼 1 file clean 🧼

# Run with good rules
$ hatch run fixit lint ./src/fixit/api.py
🧼 1 file clean 🧼