Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

2.9 KB
Raw Blame
# Repo-wide ruff configuration.
#
# Per-service `[tool.ruff]` blocks were consolidated here so the CI gate
# (`ruff check services/api services/actions services/fusion services/agents`)
# behaves the same way locally and in `.github/workflows/ci.yml`.

line-length = 140
target-version = "py311"

# The archived prototype subtree. `.github/workflows/codeql.yml` carries the
# same exclusion, `scripts/check_mypy_baseline.py` excludes it from every
# coverage direction, and the project rules forbid editing anything under it —
# so a finding there is not actionable and a formatter run would be a diff
# nobody may take. 844 lint findings and ~280 unformatted files live here; they
# are excluded because they cannot be fixed, which is a different statement
# from saying the code is clean.
extend-exclude = ["plans"]

[lint]
select = ["E", "W", "F", "I", "B", "C4", "UP"]

# UP042 (`class X(str, Enum)` → `enum.StrEnum`) is a Python 3.11+ stylistic
# preference, not a correctness rule. The `(str, Enum)` pattern serializes
# the same way through Pydantic v2 / SQLAlchemy / json.dumps and migrating
# every existing model would create churn for no behavioral gain.
ignore = ["UP042"]

[lint.flake8-bugbear]
# FastAPI's canonical dependency-injection pattern is
# `param: T = Depends(...)` / `Query(...)` / `Security(...)`. Add them to the
# bugbear allow-list so B008 keeps firing on real mistakes (e.g. `= dict()`).
extend-immutable-calls = [
    "fastapi.Depends",
    "fastapi.Query",
    "fastapi.Path",
    "fastapi.Body",
    "fastapi.Header",
    "fastapi.Cookie",
    "fastapi.Form",
    "fastapi.File",
    "fastapi.Security",
]

[lint.per-file-ignores]
# SQLAlchemy declarative models use string forward references inside
# `Mapped[...]` (e.g., `Mapped["Tenant"]`). These resolve via the
# ORM registry at runtime; ruff's F821 fires anyway because it only
# does static name resolution.
"services/api/app/models/**/*.py" = ["F821"]

# Test fixtures intentionally bind names they don't reference (e.g. a
# helper that builds a plugin on disk for side effects only).
"services/*/tests/**/*.py" = ["B008"]

# The 200-rule curated detection corpus, as a data table. Both modules open
# their table with `# fmt: off`, so the formatter is already opted out of this
# layout by a decision somebody made deliberately; E501 is the linter asking
# the same question and getting a different answer. 199 lines exceed 140
# columns and every one is a single dict or string literal — 72 positive
# fixtures, 66 negative fixtures, 50 `match_when` clauses and 11 rule
# descriptions — where the width is one row of a corpus rather than a nested
# expression. Two named data modules, not `scripts/`: every other file under
# it is linted at 140 like the rest of the tree, and exactly one line
# elsewhere needed wrapping to get there.
"scripts/detection_specs.py" = ["E501"]
"scripts/detection_specs_part2.py" = ["E501"]