Skip to content

Add code quality CI (ruff, autopep8, pytest) - #56

Merged
benhayes21 merged 2 commits into
fix/workflow-bugsfrom
feature/code-quality-ci
Nov 5, 2026
Merged

benhayes21 merged 2 commits into
fix/workflow-bugsfrom
feature/code-quality-ci

Conversation

@benhayes21

@benhayes21 benhayes21 commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

Adds a code quality CI workflow based on OasisLMF's, and fixes the existing findings so it passes.

Closes #51

Stacked on #55 — this PR targets fix/workflow-bugs so the diff shows only the lint/CI changes. When #55 merges and its branch is deleted, GitHub will retarget this PR to main.

CI (.github/workflows/code-quality.yml)

Runs on pull requests and pushes to main / stable**:

  • Lint
    • ruff check . — rules in pyproject.toml
    • autopep8 --diff --exit-code --max-line-length 150 --ignore E402 — PEP8, as OasisLMF
  • Tests — pytest (the suite had no CI before)

Ruff config (pyproject.toml) mirrors OasisLMF's docstring rules, but selects all pyflakes (F) checks rather than OasisLMF's four, matching the flake8 coverage #51 asks for. These catch undefined names — the class of bug that broke the old Dashboard page. OasisLMF's CodeQL job is not included.

Cleanup (no behaviour changes)

  • autopep8 formatting across 24 files
  • ~200 ruff findings:
    • 33 unused imports (19 leftovers in scenariosGuide.py) and 2 unused variables (never-used st.container() placeholders)
    • docstring style: triple double quotes, summary on the first line, one-line docstrings
    • missing parameter descriptions in 9 docstrings
    • two wrong docstrings fixed: generate_eltcalc_fragment documented vis_interface for a parameter named output; PortfoliosEndpointInterface.create listed reinsurance_scope_file twice and omitted reinsurance_info_file

A short Development section in the README lists the commands to run the checks locally.

Test plan

  • ruff check . and autopep8 --diff --exit-code pass locally
  • pytest — 113 passed
  • All six pages render against a live 2.5.9 platform after the cleanup
  • requirements.txt resolves cleanly from scratch (oasislmf 2.5.9)
  • Code Quality workflow passes on this PR (lint 7s, tests 50s)

🤖 Generated with Claude Code

benhayes21 and others added 2 commits November 5, 2026 16:23
Mechanical cleanup ahead of the code quality CI:
- autopep8 formatting (150 character lines)
- remove unused imports and variables (incl. 19 leftover imports in
  scenariosGuide.py and two never-used st.container() placeholders)
- docstring style (triple double quotes, summary on the first line,
  one-line docstrings)
- document missing parameters; fix docstrings that named the wrong
  parameter (generate_eltcalc_fragment) or listed reinsurance_scope_file
  twice (PortfoliosEndpointInterface.create)

No behaviour changes: 113 tests pass and all pages render against a
live 2.5.9 platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirrors OasisLMF's code-quality workflow: ruff (rules in pyproject.toml)
and autopep8 --diff --exit-code at 150 characters. Ruff selects all
pyflakes (F) checks, as flake8 did, plus OasisLMF's docstring rules.
Also runs the pytest suite, which had no CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@benhayes21
benhayes21 merged commit ea61f45 into fix/workflow-bugs Nov 5, 2026
2 checks passed
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.

1 participant