Update tooling to match other CFPB packages#3
Conversation
Updates our tooling to match other CFPB-maintained packages: - Use Ruff exclusively for formatting, linting, and import-sorting. Ruff can replace Black and isort, and is faster. - Add Bandit for static security analysis. - Add setuptools_scm for versioning. We won't have to manually update a version number in pyproject.toml. - Add a pre-commit config. - Run `ruff check --fix` for linting fixes. See cfpb/wagtail-flags#77 for a similar update
| for row_index, row in enumerate(value.rows): # noqa: B007 | ||
| for column_index, child in enumerate(row): # noqa: B007 |
There was a problem hiding this comment.
ruff suggested changing to _row_index and _column_index since they weren't used inside the loop, but I wasn't sure if that change would have an effect, so I ignored the lines. I can change them if that seems like an OK change.
There was a problem hiding this comment.
I suspect this could just be
for row in value.rows:
for child in row:The purpose of Python's built-in enumerate is to generate numeric indexes as you iterate over an iterable, useful for various purposes including debugging. Since we're not using those indexes (row_index and column_index), there's no reason to use enumerate at all. Maybe this was here because of some long-ago debugging? @willbarton do you remember?
@niqjohnson maybe try removing the enumerate and index variables entirely and see if tests still pass.
There was a problem hiding this comment.
I suspect it's from an earlier iteration of this code where the index served as part of the "path" to where a block value exists within the table. But I agree, it's not being used, so we can jettison enumerate entirely.
There was a problem hiding this comment.
Thanks, @chosak and @willbarton. All the tests still pass without the enumeration, which I removed in db89bf7.
Updates our tooling to match other CFPB-maintained packages. See cfpb/wagtail-flags#77 for a similar update.
The actual impetus for this is that when running
tox -e lint, black and isort wanted to make conflicting changes to a handful of files. Instead of fighting with that, I figured it was a good time to bring this package in line with the tooling in our other packages before updating it for Wagtail 7.Additions
pyproject.tomlRemovals
Changes
Testing
toxChecklist