Skip to content

Replace Flake8 with Ruff Configuration#1554

Open
ryan-morosa wants to merge 9 commits intomasterfrom
ryanmorosa/bb2-4568-ruff-config
Open

Replace Flake8 with Ruff Configuration#1554
ryan-morosa wants to merge 9 commits intomasterfrom
ryanmorosa/bb2-4568-ruff-config

Conversation

@ryan-morosa
Copy link
Copy Markdown
Contributor

@ryan-morosa ryan-morosa commented Apr 13, 2026

JIRA Ticket:
BB2-4586

What Does This PR Do?

  • Created a confluence page summarizing the changes here: https://confluence.cms.gov/spaces/BB2/pages/1547746148/BB2-4568+Investigate+move+to+Ruff+from+Flake8
  • Added ruff.toml
  • Deleted .flake8
  • Deleted flake8 extension
  • Installed ruff extension
  • Changed pre-commit-config.yaml
  • Added json config to VSCode User Settings IAW confluence page
  • Uninstalled flake8 from dev.requirements.txt
  • Installed ruff into dev.requirements.txt
  • Replaced jenkins files flake8 calls with ruff calls
  • Reformatted all files with ruff.toml config

What Should Reviewers Watch For?

  • In flake8 we had 130 characters as the max character length. I changed it to 120 characters for ruff to keep it within a recommended range online. Is this okay or do we need to have a larger discussion on this or any other standards?
  • The included changes have formatting changes with changing all double quotes to single quotes which seems to touch over 150 files. Should this be a separate PR and this only include changes with ruff configuration?
  • Do I need to update the README's with all ruff config instead of flake8? Maybe a future story to update documentation, including onboarding?
  • The rulesets and ignored rules I implemented in ruff.toml are just E,F, and W provided as an example by Ruff documentation here: https://docs.astral.sh/ruff/linter/#rule-selection. I figure we can add or subtract as we go - lmk if there any issues with that. However, once we add, we will likely have to take care of a bunch of errors that that new ruleset is flagging.

If you're reviewing this PR, please check for these things in particular:

Validation

  • Ensure you have pre-commit installed
  • Uninstall Flake8 extension and reload extensions
  • Install Ruff extension
  • Add the user settings json from the confluence page linked above to your VS Code User Settings file
  • Try going into a file and adding double quotes to something that should be single quotes
    • See that it changes back to single quotes after saving
  • Try adding and committing a change like an unused import
    • See that ruff extension highlights the error on the line with a yellow squiggly line to ensure it's working
    • See that ruff check and and ruff format run and throw an error
  • Ensure the auth flow is still working
  • Ensure the ruff check passes in the jenkins pipeline

What Security Implications Does This PR Have?

Please indicate if this PR does any of the following:

  • Adds any new software dependencies
  • Modifies any security controls
  • Adds new transmission or storage of data
  • Any other changes that could possibly affect security?
  • Yes, one or more of the above security implications apply. This PR must not be merged without the ISSO or team
    security engineer's approval.

Any Migrations?

  • Yes, there are migrations
    • The migrations should be run PRIOR to the code being deployed
    • The migrations should be run AFTER the code is deployed
    • There is a more complicated migration plan (downtime,
      etc)
  • No migrations

@ryan-morosa ryan-morosa changed the title Change formatting to single quotes Replace Flake8 with Ruff Configuration Apr 14, 2026
…f sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ryan-morosa ryan-morosa marked this pull request as ready for review April 14, 2026 22:41
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.

2 participants