Repository navigation
fix(lint): resolve the error-handling ruff findings in src - #196
Merged
Merged
Conversation
Best-effort catches that swallowed failures silently now log them at debug level and say in one line why they stay broad. subprocess.run in _git_head_commit passes check=False like its sibling, RunRepository.__enter__ returns Self, and the percentile index drops a redundant int(). Behaviour is unchanged; a new test pins the git fallbacks and the logged cloud-sync failure. Closes #168
…system.py executable Logging at debug level does not satisfy BLE001, so each broad catch that stays keeps its reason and an explicit noqa. EXE001: the script has a shebang, so give it the executable bit like check_pypi_version.py. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CodeQL flagged the new debug line as log injection because it formatted the upload's suffix. Only .pdf/.docx/.pptx can reach it, but the traceback already names the parser, so the message drops the value.
Contributor
Author
|
Thanks for the follow-up commits. Two more in
|
vsn411
added a commit
to Labu1/secfoo
that referenced
this pull request
Nov 26, 2026
…used noqa, removesuffix) - ruff check . --fix for I001, RUF100 and FURB188. - Kept the reasons where an unused noqa was removed (S608, A002); the nosec B310 comments for bandit stay. - F401 on sast_dashboard.SKILL_ID is a re-export used by routes/activities.py, so it keeps the import with a noqa instead of deleting it. - tests/fixtures is excluded from ruff: those files are byte-exact inputs checked by SHA-256, so lint must not rewrite them. - Left RunRepository.__enter__ to secfoo-com#196, which returns Self there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
Thanks, and welcome! The changes are solid. I pushed one small commit to your branch (e9331a8) so the issue's "Done when" check passes:
CI for first-time contributors waits for a maintainer to approve the run. We'll merge as soon as it's green. |
3 tasks
Leaderboard update
AyhamJo7 now has 3 points (rank #12). 22 more to reach Bronze. |
vsn411
added a commit
that referenced
this pull request
Nov 26, 2026
… regex flags) (#198) * chore(lint): apply ruff's safe autofixes Apply the mechanical, behavior-preserving fixes ruff reports so lint can eventually block in CI (#114): - UP045: Optional[X] -> X | None in cli.py and the assessments routes, dropping the now-unused typing.Optional imports - FURB167: re.S -> re.DOTALL in the dashboard tests - RUF022: sort __all__ in agents, skills and targets packages - UP037: unquote the RunRepository.__enter__ return annotation Only annotations, __all__ order and regex flag names change; there is no behavior change. Fixes #165. * chore(lint): finish #165's safe autofixes (import order, unused noqa, removesuffix) - ruff check . --fix for I001, RUF100 and FURB188. - Kept the reasons where an unused noqa was removed (S608, A002); the nosec B310 comments for bandit stay. - F401 on sast_dashboard.SKILL_ID is a re-export used by routes/activities.py, so it keeps the import with a noqa instead of deleting it. - tests/fixtures is excluded from ruff: those files are byte-exact inputs checked by SHA-256, so lint must not rewrite them. - Left RunRepository.__enter__ to #196, which returns Self there. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: aitechnology <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
1 of 3 tasks
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.
Closes #168
Resolves the error-handling ruff findings in
src/that #168 lists. On509bd9bten of the fourteen remained; themcp.pyPLW1510s and theEXE001were already gone.S110+BLE001runner.py_try_cloud_sync,_try_osv_enrichexc_info=Trueinstead ofpassBLE001docext.pyextract_text""), with a reason and a debug logBLE001web/templating.pyactive_run_countBLE001+PLW1510runner.py_git_head_commitcheck=Falselike_git_tree_dirty; the catch stays broad with a reason and a debug logPYI034storage/repository.py__enter__returnsSelf, imported fromtyping_extensionsunderTYPE_CHECKINGbecause the floor is Python 3.10RUF046web/dashboard_common.pyint()aroundround()Why
_git_head_commitkeeps a broad catch: I first narrowed it to(OSError, subprocess.SubprocessError, ValueError). That made 22 tests intests/test_responsible_ai_end_to_end.pyfail, because the conftestFakePopenhas no__exit__, sosubprocess.runraisesTypeErrorthere and only the broad catch absorbed it. Commit metadata is optional, so the broad catch with a log is the behaviour-preserving choice.Tests
New
tests/test_runner_best_effort.py:_git_head_commitreturnsNonewith nogitonPATH, and whengittimes out._try_cloud_syncdoes not raise and logscloud sync skipped for run …at debug.With
runner.pyfrom509bd9bthe logging test fails (1 of 3, as expected:mainpassed silently) and the two fallback tests pass. With this change all 3 pass.Checks
ruff check src scripts --select BLE001,S110,PLW1510,PYI034,RUF046,EXE001: no findings.ruff checkon the five touched files and the new test: clean.pytest tests: 2267 passed, 1 skipped, 5 failed. The 5 also fail on an untouched509bd9bcheckout in the same environment (Python 3.14):test_runtime_api.py::test_lines_that_used_to_500_are_skipped_and_the_rest_is_stored[deep-nesting], threetest_activity_routes.py::test_architecture_activity_page_*andtest_architecture_dashboard.py::test_dashboard_diagram_section_still_present_alongside_new_dashboard.tests/test_responsible_ai_end_to_end.py,tests/test_docext.pyand the new file: 40 passed.Not in this PR: the other ruff findings in
src/(import order,UP045, unusednoqa) and thetests/findings in #194.