Skip to content

Add Ruff rule set S to pyproject.toml. Progresses #1280#1305

Closed
regulartim wants to merge 18 commits intomainfrom
ruff_rule_s
Closed

Add Ruff rule set S to pyproject.toml. Progresses #1280#1305
regulartim wants to merge 18 commits intomainfrom
ruff_rule_s

Conversation

@regulartim
Copy link
Copy Markdown
Member

Description

This enables Ruff's S (flake8-bandit) rule set and sets sensible exceptions.

Related issues

#1280

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Chore (refactoring, dependency updates, CI/CD changes, code cleanup, docs-only changes).

Checklist

Please complete this checklist carefully. It helps guide your contribution and lets maintainers verify that all requirements are met.

Formalities

  • I have read and understood the rules about how to Contribute to this project.
  • I chose an appropriate title for the pull request in the form: <feature name>. Closes #999
  • My branch is based on develop.
  • The pull request is for the branch develop.
  • I have reviewed and verified any LLM-generated code included in this PR.

Docs and tests

  • I documented my code changes with docstrings and/or comments.
  • I have checked if my changes affect user-facing behavior that is described in the docs. If so, I also included an update to the wiki in the description of this PR.
  • Linter (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved.
  • All the tests gave 0 errors.

GUI changes

Ignore this section if you did not make any changes to the GUI.

  • I have provided a screenshot of the result in the PR.
  • I have created new frontend tests for the new component or updated existing ones.

Review process

  • We encourage you to create a draft PR first, even when your changes are incomplete. This way you refine your code while we can track your progress and actively review and help.
  • If you think your draft PR is ready to be reviewed by the maintainers, click the corresponding button. Your draft PR will become a real PR.
  • If your changes decrease the overall tests coverage (you will know after the Codecov CI job is done), you should add the required tests to fix the problem.
  • Every time you make changes to the PR and you think the work is done, you should explicitly ask for a review. After receiving a "change request", address the feedback and click "request re-review" next to the reviewer's profile picture at the top right.

regulartim and others added 18 commits April 23, 2026 07:42
…oses #1234 (#1258)

Signed-off-by: Drona Raj Gyawali <dronarajgyawali@gmail.com>
…1280 (#1288)

* Add rule set

* Add rule set

* Add rule set

* Add ruff rule FA
* Install gb-ui library

* Replace imports

* Update frontend README
* Add ruff rule

* Fix violations

* Exclude SIM108 rule
* Add rule and exception for G004

* Reorder ignores

* Fix violations
#1289)

* Enhancement: optimization in Cowrie _get_sessions #1260 - Reduced Time Complexity from O(N*M) to O(M)

* chore: simplify src_ip extraction in _get_scanners to fix PR review

* chore: remove redundant src_ip check per reviewer feedback
)

* Fix statistics source handling for proxy and IPv6

* Add merge migration for conflicting greedybear 0050 leaves

* Make statistics source migration sequential after 0050

* Set 0051 statistics migration dependency to 0050_attackeractivitybucket

* Address moderator feedback: raise exception instead of returning empty string

- Add UnableToExtractSourceIPError custom exception
- Modify get_request_source_ip() to raise exception with logging when no valid IP found
- Update all callers (utils.py, enrichment.py, command_sequence.py, cowrie_session.py) to handle exception
- Update test to expect exception behavior instead of empty string
- Statistics recording is now skipped when source IP cannot be extracted

* Fix formatting: add blank line after docstring

* Fix linter errors: remove unnecessary pass and sort imports

* Fix import order in command_sequence.py to match original
* add database index for attacker_country_code

* generate migration for attacker_country_code index

* normalize attacker_country_code to uppercase on write

* use exact lookup with upper() for country_code query

* fix migration chain after merging develop
* Add rule

* Fix violations

* Add resolve() to get absolute path
@regulartim regulartim closed this Apr 23, 2026
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.

6 participants