Repository navigation
chore(lint): apply ruff's safe autofixes (Optional[X], __all__ order, regex flags) - #198
Merged
Merged
Conversation
Apply the mechanical, behavior-preserving fixes ruff reports so lint can eventually block in CI (secfoo-com#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 secfoo-com#165.
…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! Your changes are all correct. I pushed a commit to your branch (10151ce) that finishes the rest of #165, so you don't need another round:
After this, |
| from dataclasses import dataclass, field | ||
|
|
||
| from secfoo.report.sast import SKILL_ID | ||
| from secfoo.report.sast import SKILL_ID # noqa: F401 -- re-exported: routes/activities.py uses sast_dashboard.SKILL_ID |
Leaderboard update
Labu1 now has 3 points (rank #14). 22 more to reach Bronze. |
3 tasks
1 of 3 tasks
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 #165
What does this change, and why?
ruff check .reports a backlog of findings, so CI runs it with|| trueand lint never blocks (#114). This PR applies the mechanical, safe fixes from #165:Optional[X]->X | Noneinsrc/secfoo/cli.pyandsrc/secfoo/web/routes/assessments.py(60 annotations). The now-unusedtyping.Optionalimports are removed. Both modules usefrom __future__ import annotations, and the typer/FastAPI versions the project requires resolve PEP 604 unions on Python 3.10+.re.S->re.DOTALLin threetests/test_web/files.__all__insecfoo.agents,secfoo.skillsandsecfoo.targets.RunRepository.__enter__return annotation.The only changes are to annotations,
__all__order and regex flag names. Nothing else changes, and behavior is unchanged. The remaining rules in the issue (I001 import order, RUF100 unusednoqa, FURB188, F401) are not in this change and may still need aruff check . --fixpass.Fixes #165
Testing
Not run locally.
pytest testspassesruff check .passesThis PR was prepared with AI assistance (Claude) and reviewed by me before submitting.