ao icon indicating copy to clipboard operation
ao copied to clipboard

enable all the most recent ruff linter rules on torchao/float8 code

Open vkuzo opened this issue 1 year ago • 3 comments

We have a couple of linter rules that are run on an allowlist of files. Specifically:

  1. linter rule: https://github.com/pytorch/ao/blob/0ffbf856a2b61ed4dfb2c28376e8f4e801c9b962/.github/workflows/ruff_linter.yml#L42
  2. allowlist of files: https://github.com/pytorch/ao/blob/main/ruff.toml

This task is to get all of torchao.float8 into the allowlist. Specifically:

  1. add the relevant files to the allowlist (torchao/float8, benchmarks/float8, test/float8)
  2. run the ruff rule locally to have the linter fix the code for you: ruff format --check
  3. put up a PR and ensure CI is green
  4. coordinate with @vkuzo and @drisspg on when to land, as this will likely require rebases for anyone else that has open PRs on these files

I think if you time it right, it's fine to do in a single PR. If you want to minimize risk, you can also split into chunks.

Optional bonus: do this for more of torchao!

vkuzo avatar Oct 04 '24 04:10 vkuzo

cc @drisspg

vkuzo avatar Oct 04 '24 04:10 vkuzo

Looks good, I also hope that this is pretty small PR since we had this enabled previously in fp8 experimental

drisspg avatar Oct 04 '24 04:10 drisspg

a nice bonus extension would be to make it easier to run all the ruff rules locally, now there are 4 different ones in CI and it would be nice for an easy way to run them all locally which is always up to date with CI

vkuzo avatar Oct 04 '24 04:10 vkuzo

The linting has ben completed for TorchAO. pre-commit or scripts/run_ruff_fix.sh can be used to run the rules locally.

jainapurva avatar Mar 19 '25 22:03 jainapurva