Skip to content

[MAINT]: Add project metadata, pyright, coverage config, and editorconfig - #9

Merged
Spencer Schoenberg (spencrr) merged 4 commits into
mainfrom
spencrr/project-metadata
Apr 17, 2026
Merged

[MAINT]: Add project metadata, pyright, coverage config, and editorconfig#9
Spencer Schoenberg (spencrr) merged 4 commits into
mainfrom
spencrr/project-metadata

Conversation

@spencrr

@spencrr Spencer Schoenberg (spencrr) commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Description

Add project metadata, pyright, coverage config, and editorconfig

Breaking changes

None

Checklist

@spencrr
Spencer Schoenberg (spencrr) changed the base branch from main to spencrr/lint-project-files April 14, 2026 02:36
@spencrr Spencer Schoenberg (spencrr) changed the title spencrr/project metadata [MAINT]: Add project metadata, pyright, coverage config, and editorconfig Apr 14, 2026
@spencrr
Spencer Schoenberg (spencrr) marked this pull request as ready for review April 14, 2026 23:03
Comment thread pyproject.toml Outdated
@spencrr
Spencer Schoenberg (spencrr) force-pushed the spencrr/lint-project-files branch 2 times, most recently from cd3cace to d8dcd68 Compare April 15, 2026 23:48
Spencer Schoenberg (spencrr) added a commit that referenced this pull request Apr 15, 2026
## Description

Sets up ruff config and fixes existing project files

<details>
<summary>See fixes</summary>

```
fix: resolve all 189 ruff lint violations

Per-file-ignores for tests/ (pyproject.toml):
  S101, D100-D107, ANN001/ANN201/ANN202, PLR2004, ARG001/ARG002,
  PLC0415, SLF001, TRY003/EM101/EM102, BLE001, TRY301, S108,
  PT017/PT018, ASYNC240, PERF401, RUF015, PTH123

TC001/TC002/TC003 (45 fixes) - moved type-only imports into TYPE_CHECKING blocks:
  rampart/attacks/__init__.py, rampart/core/adapter.py,
  rampart/core/converter.py, rampart/core/execution.py,
  rampart/core/injection.py, rampart/core/prompt_driver.py,
  rampart/core/types.py, rampart/payloads/__init__.py,
  rampart/payloads/_generator.py, rampart/probes/__init__.py,
  rampart/probes/_single_turn.py, rampart/pytest_plugin/_collection.py,
  rampart/pytest_plugin/_session.py, rampart/pytest_plugin/plugin.py,
  rampart/reporting/json_file.py, rampart/surfaces/onedrive.py,
  rampart/_pyrit/llm_bridge.py, rampart/evaluators/response_contains.py,
  tests/fixtures.py

TRY003/EM101/EM102 (50 fixes) - extracted exception messages to msg variable:
  rampart/_pyrit/llm_bridge.py:86-91, rampart/converters/docx.py:63-64,
  rampart/core/execution.py:146-148, rampart/core/types.py:119-131,217-218,300,
  rampart/drivers/__init__.py:37-39, rampart/payloads/__init__.py:144,
  rampart/payloads/_store.py:82,135-138,191-192,201-202,350,
  rampart/probes/__init__.py:87-88, rampart/pytest_plugin/_session.py:104-106,
  rampart/pytest_plugin/plugin.py:111-116,200-201,
  rampart/surfaces/onedrive.py:95-97,104-107,119-121,180-182

PYI034 (9 fixes) - changed __aenter__ return type to Self:
  rampart/core/adapter.py:42, rampart/core/injection.py:41,
  rampart/surfaces/onedrive.py:171, tests/fixtures.py:43,
  tests/unit/core/test_execution.py:25, tests/unit/core/test_protocols.py:23,43,89,118

PYI036/ANN401 (9 fixes) - changed exc_tb: Any to types.TracebackType | None:
  rampart/core/adapter.py:51, rampart/core/injection.py:50,
  rampart/surfaces/onedrive.py:203, tests/fixtures.py:53,
  tests/unit/core/test_execution.py:33, tests/unit/core/test_protocols.py:30,50,96,125

D107 (8 fixes) - added __init__ docstrings:
  rampart/converters/docx.py:34, rampart/core/execution.py:182,
  rampart/drivers/static.py:25, rampart/evaluators/response_contains.py:23,
  rampart/evaluators/side_effect.py:19, rampart/evaluators/tool_called.py:26,
  rampart/reporting/json_file.py:39, rampart/surfaces/onedrive.py:51

D205 (3 fixes) - inserted blank line after docstring summary:
  rampart/core/execution.py:201, rampart/pytest_plugin/plugin.py:122,
  tests/fixtures.py:57

E501 (10 fixes) - shortened lines exceeding 88 chars:
  rampart/core/execution.py:78, rampart/core/manifest.py:88,97,
  rampart/core/result.py:137, rampart/evaluators/response_contains.py:19,
  rampart/probes/_single_turn.py:104, rampart/pytest_plugin/_session.py:106,
  tests/fixtures.py:86, tests/unit/attacks/test_xpia.py:72,
  tests/unit/core/test_result.py:1

SLF001 (8 fixes) - added public properties to OneDriveSurface (drive_id,
  folder_path, indexing_delay), updated _OneDriveInjection to use them:
  rampart/surfaces/onedrive.py:159,174,181-182,195,200

PLW2901 (2 fixes) - renamed loop variables to avoid reassignment:
  rampart/payloads/_store.py:143-144 (line -> raw_line)
  rampart/pytest_plugin/_session.py:146 (result -> original_result)

PLR2004 (1 fix) - extracted magic value to _PREVIEW_MAX_LENGTH constant:
  rampart/core/types.py:136-137

RUF006 (1 fix) - stored create_task return value:
  rampart/pytest_plugin/plugin.py:523

noqa suppressions introduced (29 total):
  rampart/_pyrit/llm_bridge.py:128,130       PLC0415  deferred pyrit imports
  rampart/converters/docx.py:41              PLC0415  lazy pyrit converter import
  rampart/core/execution.py:314              BLE001   handler safety catch
  rampart/evaluators/side_effect.py:19       ANN401   **kwargs API design
  rampart/evaluators/tool_called.py:26       ANN401   **kwargs API design
  rampart/payloads/__init__.py:92            PLR0913  factory method
  rampart/probes/__init__.py:56              PLR0913  factory method
  rampart/probes/__init__.py:98              S101     type narrowing assert
  rampart/pytest_plugin/plugin.py:223-224    SLF001   pytest item private attrs
  rampart/pytest_plugin/plugin.py:240        ARG001   pytest hook signature
  rampart/pytest_plugin/plugin.py:297        BLE001   plugin safety catch
  rampart/pytest_plugin/plugin.py:458        ARG001   pytest hook signature
  rampart/pytest_plugin/plugin.py:496        BLE001   sink teardown safety
  rampart/pytest_plugin/plugin.py:523        RUF006   fire-and-forget task
  rampart/pytest_plugin/plugin.py:528,559,580 ANN401  no public type for terminalreporter
  rampart/pytest_plugin/plugin.py:581        ARG001   pytest hook signature
  rampart/surfaces/onedrive.py:202           SLF001   inner class -> parent._upload_async
  rampart/surfaces/onedrive.py:226           SLF001   inner class -> parent._delete_async
  rampart/surfaces/onedrive.py:227           BLE001   cleanup must not raise
  tests/unit/pytest_plugin/test_plugin.py:35-51  ANN401 x6  _StashStub dict mock
  tests/unit/surfaces/test_onedrive.py:25    ANN401   sentinel default
  tests/unit/surfaces/test_onedrive.py:63    ANN401   mock dispatch return
```
</details>

## Breaking changes

None

## Checklist

- [X] `pre-commit run --all-files` passes (see #9 for `pytest tests` warnings to disappear)
- [ ] Tests added or updated for changes <!-- Please describe what tests
were added or updated -->
- [ ] Documentation updated
Comment thread pyproject.toml Outdated
@spencrr
Spencer Schoenberg (spencrr) changed the base branch from spencrr/lint-project-files to main April 17, 2026 08:38
@spencrr
Spencer Schoenberg (spencrr) requested a review from a team April 17, 2026 08:38
Comment thread tests/fixtures.py Fixed
Comment thread rampart/_pyrit/llm_bridge.py Fixed
@spencrr
Spencer Schoenberg (spencrr) merged commit 08b2254 into main Apr 17, 2026
4 checks passed
@spencrr
Spencer Schoenberg (spencrr) deleted the spencrr/project-metadata branch April 17, 2026 08:53
Spencer Schoenberg (spencrr) added a commit that referenced this pull request Apr 21, 2026
## Description

Fixes all the changes introduced by adding pyright in #9. 

## Breaking changes

None

## Checklist

- [x] `pre-commit run --all-files` passes
- [ ] Tests added or updated for changes <!-- Please describe what tests
were added or updated -->
- [ ] Documentation updated
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.

4 participants