Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Maintenance-focused cleanup across Django/Python and legacy JS templates/static assets to reduce dead code, tighten scoping, and make behavior more predictable.
Changes:
- Remove unused imports and commented-out blocks across tests, views, and migrations.
- Scope previously-implicit JavaScript globals with
const/letwhile preserving neededwindow.*exports for TinyMCE config. - Make DRF
CustomModelSerializer(exclude=...)resilient to unknown field names and add a regression test.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ghostwriter/status/tests/test_views.py | Removes unused standard-library import from status view tests. |
| ghostwriter/static/js/tinymce/config.js | Avoids implicit globals for TinyMCE config objects while still exporting them on window. |
| ghostwriter/shepherd/tests/test_views.py | Removes unused imports from Shepherd view tests. |
| ghostwriter/shepherd/templates/shepherd/server_checkout.html | Scopes AJAX success callback variable with let. |
| ghostwriter/shepherd/templates/shepherd/checkout.html | Scopes AJAX success callback variable with let. |
| ghostwriter/rolodex/templates/rolodex/project_detail.html | Removes duplicate/conflicting HTML attribute usage on an anchor element. |
| ghostwriter/reporting/views.py | Removes unused Django ORM imports. |
| ghostwriter/reporting/tests/test_serializers.py | Adds test covering unknown exclude fields handling in serializers. |
| ghostwriter/reporting/tests/test_models.py | Removes unused factory import from reporting model tests. |
| ghostwriter/reporting/migrations/0038_alter_reportfindinglink_added_as_blank.py | Removes unused models import from migration. |
| ghostwriter/oplog/tests/test_models.py | Removes unused model imports; uses factory model type for direct objects.create. |
| ghostwriter/oplog/templates/oplog/oplog_list.html | Scopes previously-implicit JS variables with let in click handler. |
| ghostwriter/modules/reportwriter/report/base.py | Removes commented-out dead code related to evidence extra fields. |
| ghostwriter/modules/reportwriter/base/pptx.py | Improves loop variable naming clarity to prevent accidental shadowing/bugs. |
| ghostwriter/modules/custom_serializers.py | Initializes serializer fields before applying exclude; ignores unknown fields safely. |
| ghostwriter/modules/codenames.py | Fixes list formatting (adds missing trailing comma). |
| ghostwriter/commandcenter/migrations/0026_report_filename_template_convert_fix.py | Removes unused models import from migration. |
| ghostwriter/api/views.py | Refactors shared checkout validation into a dedicated method used by both checkout actions. |
| ghostwriter/api/tests/test_utils.py | Removes unused factories import and whitespace cleanup. |
| config/asgi.py | Removes unused import and old commented-out application code. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #867 +/- ##
=======================================
Coverage 92.21% 92.21%
=======================================
Files 384 384
Lines 23983 23987 +4
=======================================
+ Hits 22116 22120 +4
Misses 1867 1867 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We hope to greatly speed up the CI workflow by converting tests that do not touch the database to `SimpleTestCase`.
Avoid triggering a linting operation on every template factory run to improve speed of tests.
We don't currently test templates so this was unnecessary.
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.
This PR is exclusively a set of changes to clean up the codebase by: