Skip to content

Jira cleanup#22

Open
Maffooch wants to merge 19 commits intodevfrom
jira-cleanup
Open

Jira cleanup#22
Maffooch wants to merge 19 commits intodevfrom
jira-cleanup

Conversation

@Maffooch
Copy link
Copy Markdown
Owner

⚠️ Pre-Approval check ⚠️

We don't want to waste your time, so if you're unsure whether your hypothetical enhancement meets the criteria for approval, please file an issue to get pre-approval before beginning work on a PR.
Learn more here: https://github.com/DefectDojo/django-DefectDojo/blob/master/readme-docs/CONTRIBUTING.md#submission-pre-approval

Description

Describe the feature / bug fix implemented by this PR.
If this is a new parser, the parser guide may be worth (re)reading.

Test results

Ideally you extend the test suite in tests/ and dojo/unittests to cover the changed in this PR.
Alternatively, describe what you have and haven't tested.

Documentation

Please update any documentation when needed in the documentation folder)

Checklist

This checklist is for your information.

  • Make sure to rebase your PR against the very latest dev.
  • Features/Changes should be submitted against the dev.
  • Bugfixes should be submitted against the bugfix branch.
  • Give a meaningful name to your PR, as it may end up being used in the release notes.
  • Your code is Ruff compliant (see ruff.toml).
  • Your code is python 3.13 compliant.
  • If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
  • Model changes must include the necessary migrations in the dojo/db_migrations folder.
  • Add applicable tests to the unit tests.
  • Add the proper label to categorize your PR.

Extra information

Please clear everything below when submitting your pull request, it's here purely for your information.

Moderators: Labels currently accepted for PRs:

  • Import Scans (for new scanners/importers)
  • enhancement
  • performance
  • feature
  • bugfix
  • maintenance (a.k.a chores)
  • dependencies
  • New Migration (when the PR introduces a DB migration)
  • settings_changes (when the PR introduces changes or new settings in settings.dist.py)

Contributors: Git Tips

Rebase on dev branch

If the dev branch has changed since you started working on it, please rebase your work after the current dev.

On your working branch mybranch:

git rebase dev mybranch

In case of conflict:

 git mergetool
 git rebase --continue

When everything's fine on your local branch, force push to your myOrigin remote:

git push myOrigin --force-with-lease

To cancel everything:

git rebase --abort

Squashing commits

git rebase -i origin/dev
  • Replace pick by fixup on the commits you want squashed out
  • Replace pick by reword on the first commit if you want to change the commit message
  • Save the file and quit your editor

Force push to your myOrigin remote:

git push myOrigin --force-with-lease

Maffooch and others added 16 commits March 30, 2026 23:05
Add a thin facade module that wraps every jira_link.helper function
used by core code. Each wrapper delegates to dojo.jira_link.helper
when available and returns a safe default when Jira is absent. This
is the foundation for replacing direct jira_helper imports across
the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy all jira_link files to dojo/jira/, convert dojo/jira_link/ files
into backward-compat shims that re-export from dojo.jira, update
dojo/urls.py and dojo/jira_facade.py to import from the new location.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace direct jira_helper import with jira_facade calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace inline jira_helper import with jira_facade calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace direct jira_link imports in base_importer.py, options.py,
default_importer.py, and default_reimporter.py with jira_facade calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 13 jira_helper calls with jira_facade equivalents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 14 jira_helper calls with jira_facade equivalents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 12 jira_helper calls with jira_facade equivalents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Guard jira_status_reconciliation import in tasks.py with try/except.
Update management commands to import from dojo.jira.helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace direct jira_helper imports with jira_facade calls in:
- finding_group/views.py (11 calls)
- engagement/views.py (10 calls)
- product/views.py (14 calls)
- test/views.py (19 calls)
- finding/views.py (56 calls)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace jira_helper imports with jira_facade in serializers.py and
views.py. Update jira_link.queries import to dojo.jira.queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace jira_helper import with jira_facade calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 6 inline jira_helper imports in has_jira_issue,
has_jira_group_issue, and has_jira_configured properties with
jira_facade calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move 9 Jira form classes and get_jira_issue_template_dir_choices
from dojo/forms.py to dojo/jira/forms.py. Add backward-compat
re-exports in dojo/forms.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move JIRA_Instance, JIRA_Project, JIRA_Issue and their admin classes
from dojo/models.py to dojo/jira/models.py. Add app_label='dojo' Meta
to each model to preserve migrations. Use string ForeignKey references
to avoid circular imports. Add backward-compat re-exports in models.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move JIRAIssueSerializer, JIRAInstanceSerializer, JIRAProjectSerializer,
EngagementUpdateJiraEpicSerializer to dojo/jira/api/serializers.py.
Move JiraInstanceViewSet, JiraIssuesViewSet, JiraProjectViewSet to
dojo/jira/api/views.py. Add backward-compat re-exports in api_v2/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Maffooch and others added 3 commits March 31, 2026 08:50
Fix RET503 (missing explicit returns), PLC0415 (top-level imports),
E402 (module-level import order), FBT002 (boolean positional arg),
TRY300 (return in try block), and auto-fixed import sorting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Defer the import of dojo.utils.to_str_typed into the set_obj method
to break a circular import chain: dojo.models -> dojo.jira.models ->
dojo.utils -> dojo.finding.queries -> dojo.authorization -> dojo.models.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update all test mock paths from dojo.jira_link to dojo.jira
- Fix update_jira_epic view to pass raw Celery task to
  dojo_dispatch_task via jira_facade.get_epic_task()
- Fix close_engagement to use get_epic_task for close_epic dispatch

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant