Skip to content

Add CI lint workflow and fix all ruff lint + format errors#50

Open
austrian-code-wizard wants to merge 3 commits into
mainfrom
test-failing-ci-lint-2
Open

Add CI lint workflow and fix all ruff lint + format errors#50
austrian-code-wizard wants to merge 3 commits into
mainfrom
test-failing-ci-lint-2

Conversation

@austrian-code-wizard

@austrian-code-wizard austrian-code-wizard commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Summary

This PR adds a GitHub Actions CI workflow (.github/workflows/lint.yml) that runs ruff check and ruff format --check on PRs and pushes to main. It also fixes all pre-existing ruff lint errors and applies ruff format across the entire codebase so CI passes cleanly.

Lint fixes applied:

  • F401 (unused imports): Removed unused imports in setup.py, notebooks/collie_feedback_gen.ipynb, src/feedback/gpt_content.py, src/feedback/gpt_style.py, src/feedback/manual.py, src/lcdpo.py, src/train.py, tests/test_metrics.py
  • E731 (lambda assignments): Converted metric = lambda ... to def metric(...) in src/eval.py and src/train.py
  • F541 (f-strings without placeholders): Removed extraneous f prefixes in src/modal/app.py and src/sample.py
  • E402 (import ordering): Moved np.random.seed(42) after all imports in src/sample.py
  • E701 (multiple statements on one line): Split inline else: in src/train.py
  • E712 (boolean comparisons): Replaced == True / == False with idiomatic assertions in tests/test_metrics.py

Formatting applied (ruff format):

  • Applied ruff format to all 29 files that were not conformant — line wrapping, quote normalization, trailing commas, whitespace cleanup, etc. These are purely cosmetic changes with no semantic impact.

The deliberate unused imports in src/logger.py (originally added to test CI failure detection) have been removed as part of the fixes.

Review & Testing Checklist for Human

  • Verify the lambda-to-def conversions in src/eval.py and src/train.py preserve correct closure/scoping behavior (the metric function references feedback.metric and feedback.metric_value from the enclosing scope)
  • Confirm np.random.seed(42) being moved after all imports in src/sample.py doesn't change execution order in any import-time side-effect scenario
  • Check that removed imports (langdetect.detect, re in tests, EOS_EMOJI_REGEX in manual.py, Metric in gpt_content/gpt_style, Optional in lcdpo, dump_arg_dicts in train, find_packages in setup) are truly unused
  • Spot-check a few of the ruff format changes in the larger files (e.g. src/feedback/collie.py, src/eval.py) to confirm no unintended semantic changes crept in through line-wrapping or string reformatting

Test plan: CI lint job passing is the primary validation. No runtime behavior should change — all fixes are cosmetic (unused import removal, style fixes, boolean comparison idioms, formatting).

Notes

  • The workflow runs on Python 3.11 with the latest ruff version
  • Both ruff check and ruff format --check now pass in CI

Link to Devin session: https://staging.itsdev.in/sessions/1ce0ad01211c45779eeb3d574e6ba972
Requested by: @austrian-code-wizard

@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Test: Add CI lint workflow (intentionally failing) Add CI lint workflow and fix all existing ruff lint errors Apr 6, 2026
Co-Authored-By: Moritz Stephan <moritz.stephan@gmx.at>
@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Add CI lint workflow and fix all existing ruff lint errors Add CI lint workflow and fix all ruff lint + format errors Apr 6, 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.

1 participant