Skip to content

fix: resolve all 11 SonarQube blocker issues#507

Open
will-yuponce-db wants to merge 1 commit into
mainfrom
fix/sonar-blockers
Open

fix: resolve all 11 SonarQube blocker issues#507
will-yuponce-db wants to merge 1 commit into
mainfrom
fix/sonar-blockers

Conversation

@will-yuponce-db

Copy link
Copy Markdown
Contributor

What & why

A SonarQube scan of main reported 11 BLOCKER-severity issues. All are latent bugs in unreachable or no-op code. This PR clears every one. No runtime behavior changes.

Fixes by rule

python:S930 — wrong function-call arguments (8)

  • controller/data_contracts_manager.py: removed the dead create_from_odcs() method. It called create_contract() with a signature that never existed (omitted the required owner, passed six kwargs the method doesn't accept) and would raise TypeError if ever executed. It is orphaned — the live ODCS ingestion path is create_from_odcs_dict() (used by self_service_routes). Also removed its now-unused private helpers _map_odcs_type, _map_odcs_classification, _parse_odcs_date.
  • utils/startup_tasks.py: initialize_database(settings: Settings) required a settings arg it never used (comment said "for future use"); its sole caller invoked initialize_database() with none. Dropped the unused param and the now-unused Settings import.

python:S3516 — method always returns the same value (2)

  • models/data_domains.py: the validate_tags / validate_update_tags field validators returned their input through a redundant if v is None: return v branch (both paths return v). Collapsed to a single pass-through return v.

python:S5807 — name not defined (1)

  • common/__init__.py: __all__ exported get_sql_connection, which is not defined or imported anywhere in the package. Removed the phantom entry.

Testing

  • All four modules compile (py_compile).
  • Verified no remaining references to the removed create_from_odcs, the ODCS helpers, or get_sql_connection anywhere in src/tests.
  • Re-ran the SonarQube scan on this branch to confirm the blocker count drops to 0 (see PR comment).

This pull request and its description were written by Isaac.

Clears every BLOCKER-severity finding on main:

- python:S930 (x8) wrong function-call arguments:
  - Remove the dead create_from_odcs() method in data_contracts_manager:
    it called create_contract() with a signature that never existed
    (missing required owner, six unsupported kwargs) and would raise
    TypeError if ever reached. It is orphaned -- the live ODCS path is
    create_from_odcs_dict(). Also drops its now-unused private helpers
    (_map_odcs_type/_map_odcs_classification/_parse_odcs_date).
  - initialize_database() declared a required settings param it never
    used; its only caller passed none. Drop the unused param (and the
    now-unused Settings import).
- python:S3516 (x2) data_domains tag validators always returned their
  input via a redundant 'if v is None' branch. Collapse to a single
  pass-through return.
- python:S5807 (x1) common/__init__ __all__ exported get_sql_connection,
  which is not defined anywhere. Remove the phantom entry.

No behavior change: removed code was unreachable or a no-op.

Co-authored-by: Isaac
@will-yuponce-db will-yuponce-db requested a review from a team as a code owner June 8, 2026 15:22
@will-yuponce-db

Copy link
Copy Markdown
Contributor Author

SonarQube rescan — blockers verified ✅

Re-ran sonar-scanner on fix/sonar-blockers against the local SonarQube (9.9.8 LTS):

Severity Before (main) After (this branch)
BLOCKER 11 0
Critical 612 612
Major 115 114

All 11 blockers (8× S930, 2× S3516, 1× S5807) are gone. Critical/major are untouched by design — this PR scopes to blockers only. The remaining 612 criticals are almost entirely maintainability smells (S1192 duplicated literals, S3776 cognitive complexity), not bugs.

@larsgeorge-db larsgeorge-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@larsgeorge-db larsgeorge-db enabled auto-merge (rebase) June 11, 2026 08:06
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