From c1cb3f0e20b863144187531b974e633848f683fe Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 22 Feb 2024 13:47:35 -0800 Subject: [PATCH 1/2] Update ruff. Fix and enable PLE lints --- .pre-commit-config.yaml | 2 +- composer/profiler/utils.py | 2 +- pyproject.toml | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f89154571..5f37f27121 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.0.282 + rev: v0.2.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/composer/profiler/utils.py b/composer/profiler/utils.py index b4df8396a7..d9200ccb46 100644 --- a/composer/profiler/utils.py +++ b/composer/profiler/utils.py @@ -93,5 +93,5 @@ def export_memory_timeline_html(prof: TorchProfile, with open(path, 'w') as f: f.write(html) - log.debug('Memory timeline exported to', path, '.') + log.debug('Memory timeline exported to %s.', path) remove(tmpfile.name) diff --git a/pyproject.toml b/pyproject.toml index 1583440640..dfb5daf3e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,13 @@ line_length = 120 skip = [ "env", "wandb", "runs", "build", "node_modules" ] known_third_party = ["wandb"] -[tool.ruff] +[tool.ruff.lint] select = [ "C4", # TODO port pydocstyle # "D", # pydocstyle "PERF", + "PLE", ] ignore = [ @@ -23,6 +24,7 @@ ignore = [ "PERF2", "PERF4", ] +[tool.ruff] exclude = [ "build/**", "docs/**", From 26c15a8d96a09f8de0fa1c9e48f902d602497e99 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 22 Feb 2024 13:51:20 -0800 Subject: [PATCH 2/2] Enable LOG checks too --- composer/cli/launcher.py | 2 +- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composer/cli/launcher.py b/composer/cli/launcher.py index 3dd33aede7..b27181ccc5 100755 --- a/composer/cli/launcher.py +++ b/composer/cli/launcher.py @@ -471,7 +471,7 @@ def main(): args = _parse_args() logging.basicConfig() - log.setLevel(logging.INFO if args.verbose else logging.WARN) + log.setLevel(logging.INFO if args.verbose else logging.WARNING) processes = {} diff --git a/pyproject.toml b/pyproject.toml index dfb5daf3e6..a18efde55a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ select = [ "C4", # TODO port pydocstyle # "D", # pydocstyle + "LOG", "PERF", "PLE", ]