Skip to content

Code maintenance#867

Merged
chrismaddalena merged 22 commits intomasterfrom
hotfix/code-quality-cleanup
Apr 14, 2026
Merged

Code maintenance#867
chrismaddalena merged 22 commits intomasterfrom
hotfix/code-quality-cleanup

Conversation

@chrismaddalena
Copy link
Copy Markdown
Collaborator

This PR is exclusively a set of changes to clean up the codebase by:

  • removing unused import
  • removing commented code
  • scoping JavaScript variables
  • making other changes to improve maintainability and readability

Copilot AI review requested due to automatic review settings April 13, 2026 23:01
Comment thread ghostwriter/api/views.py Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/let while preserving needed window.* 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.

Comment thread ghostwriter/status/tests/test_views.py
Comment thread ghostwriter/oplog/tests/test_models.py
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.21%. Comparing base (aafa978) to head (84c4e99).
⚠️ Report is 23 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.
@chrismaddalena chrismaddalena merged commit 8b34509 into master Apr 14, 2026
11 checks passed
@chrismaddalena chrismaddalena deleted the hotfix/code-quality-cleanup branch April 14, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants