Repository navigation
Conversation
…dapter Extract helpers from the cognitive-complexity hot spots (activity report, SQL record, probe validation and run, provider discovery), replace nested conditional expressions with explicit statements, and annotate the deliberate patterns (worker catch-all, snapshot copies, probe timeout parameter, flat exchange row signature) with their reason. Pinned C901 counts are lowered. Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
This branch has not been deployed
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.
Clears the 20 open SonarCloud code smells in
engine/capture/,engine/probe.py,engine/daemon_executor.pyandfastapi/(outside the capture middleware's__call__), without changing behaviour.activity.py,sqltrace.py,probe.py(validators),introspector.py(providersbecomes a_ProviderGraphwith three collector methods). Extracted helpers keep the order of checks, messages and outputs. C901 pins intests/complexity_baseline.json:activity.py1 → 0,probe.py2 → 1,introspector.py1 → 0.run_probe(probe.py) has helpers extracted but stays above Sonar's limit; it may still be reported.tuple(dict.fromkeys(...)), the same de-duplication with a stable order. S7632:# noqa: BLE001 # reason.NOSONARand the reason:daemon_executor.pybroad catch: the future carries the exception, so the worker thread does not die.probe.pyasyncio.wait(timeout=):asyncio.timeout()would cancel the task, which must keep running.list()snapshots infastapi/capture.pyandintrospector.py: host threads can mutateloggerDictand the route and middleware lists during iteration.exchange_row(17 parameters): it is called from the capture hot path.sonar-baseline.txtis lowered once the scan reports this pull request's fixed count (after #307).Verified:
ruff check,pyrightclean;pytest -n 2overtests/engine/capture,test_probe.py,tests/fastapi,test_code_shape.py,test_import_boundary.py: 3328 passed, 14 skipped; overhead budget tests alone at-n 0: 30 passed.