refactor: fix flake8-django violations (DJ001/DJ008/DJ012). Closes #681#684
Merged
regulartim merged 3 commits intointelowlproject:developfrom Jan 6, 2026
Merged
Conversation
- Add __str__ to UserProfile, Sensor, FireHolList, CowrieSession, Statistics, MassScanner, and WhatsMyIPDomain models - Move UserProfile fields before Meta class (DJ012) - Improves admin interface usability and debugging Phase 1 of Django violations fix. All tests passing (282/282).
- Replace null=True with blank=True, default='' on FireHolList.source and MassScanner.reason fields - Filter empty source strings in get_firehol_categories to prevent empty values in firehol_categories list - Create database migration to update schema Phase 2 of Django violations fix. All tests passing (282/282).
- Remove DJ001, DJ008, and DJ012 from ignore list - All Django model violations have been fixed in previous commits - Enforces Django best practices for CharField, __str__, and field ordering Phase 3 (final) of Django violations fix. All tests passing (282/282). All ruff checks passing.
Contributor
Author
|
hi @regulartim please review this PR when you get time. |
Contributor
Author
🎉 Ruff Migration Complete!With this PR, the complete Ruff migration series is finished:
Remaining Ignores in
|
Member
|
great job @opbot-xd , thanks @regulartim for reviewing |
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.
Description
Fixes all remaining flake8-django violations and enables enforcement of DJ001, DJ008, and DJ012 rules.
Changes Overview
Phase 1: DJ008/DJ012 - Model str and Field Ordering
Phase 2: DJ001 - CharField null=True Violations
Model Changes:
FireHolList.source: Changed fromnull=Truetoblank=True, default=""MassScanner.reason: Changed fromnull=Truetoblank=True, default=""Logic Updates:
Updated
get_firehol_categories()to filter empty source strings:Why this matters: The maintainer requested that empty source values shouldn't pollute the
firehol_categorieslist. This ensures that after migration fromnull=Truetodefault='', the behavior remains correct.Database Migration: Created migration
0026_fix_charfield_null_true.pyto update schema.Phase 3: Enable Enforcement
Related issues
Part of the Ruff migration series following #663, #671, #677 and #681. This is the final cleanup issue for Django-specific anti-patterns.
Type of change
Checklist
develop.Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.