From 72e66a7b333131cf103732c502fdb324ccfa0ec0 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Sat, 10 Jun 2023 09:05:10 -0700 Subject: [PATCH] chore: configure toml-sort and sort all toml files (#70) --- .lintrunner.toml | 67 +++++++++++++------ .../.lintrunner.toml | 2 +- .../adapters/clippy_linter/.lintrunner.toml | 2 +- .../django_upgrade_linter/.lintrunner.toml | 2 +- .../pyupgrade_linter/.lintrunner.toml | 2 +- .../adapters/refurb_linter/.lintrunner.toml | 2 +- .../adapters/ruff_fix_linter/.lintrunner.toml | 2 +- .../adapters/ruff_linter/.lintrunner.toml | 2 +- .../adapters/rustfmt_linter/.lintrunner.toml | 3 +- .../toml_sort_linter/.lintrunner.toml | 3 +- pyproject.toml | 50 +++++++------- 11 files changed, 83 insertions(+), 54 deletions(-) diff --git a/.lintrunner.toml b/.lintrunner.toml index fbac2dc..f899a9e 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -15,7 +15,7 @@ command = [ 'flake8_linter', '--show-disable', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -50,7 +50,7 @@ command = [ '--show-notes', '--show-disable', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -80,13 +80,13 @@ command = [ please convert it to `noqa: XXXX`\ """, '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] [[linter]] code = 'NEWLINE' -include_patterns=['**'] -exclude_patterns=[] +include_patterns = ['**'] +exclude_patterns = [] command = [ 'python', '-m', @@ -116,7 +116,7 @@ command = [ This line has trailing spaces; please remove them.\ """, '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] [[linter]] @@ -140,7 +140,7 @@ command = [ This line has tabs; please replace them with spaces.\ """, '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] [[linter]] @@ -157,7 +157,7 @@ command = [ 'black_isort_linter', '--fast', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -188,7 +188,7 @@ command = [ '--jobs=0', '--show-disable', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -211,13 +211,13 @@ include_patterns = [ exclude_patterns = [ ] # init_command = [ -# 'python', -# 'examples/pytorch/s3_init.py', -# '--config-json=examples/pytorch/s3_init_config.json', -# '--linter=clang-format', -# '--dry-run={{DRYRUN}}', -# '--output-dir=.lintbin', -# '--output-name=clang-format', +# 'python', +# 'examples/pytorch/s3_init.py', +# '--config-json=examples/pytorch/s3_init_config.json', +# '--linter=clang-format', +# '--dry-run={{DRYRUN}}', +# '--output-dir=.lintbin', +# '--output-name=clang-format', # ] init_command = [ 'python', @@ -235,9 +235,9 @@ command = [ 'run', 'clangformat_linter', '--binary=.lintbin/clang-format', - '--fallback', # Use system clang-format as a fallback + '--fallback', # Use system clang-format as a fallback '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] is_formatter = true @@ -255,7 +255,7 @@ command = [ 'run', 'editorconfig_checker_linter', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -282,7 +282,7 @@ command = [ 'run', 'pyupgrade_linter', '--py37-plus', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -308,7 +308,7 @@ command = [ 'run', 'refurb_linter', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -335,7 +335,7 @@ command = [ 'ruff_linter', '--config=pyproject.toml', '--show-disable', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', @@ -347,3 +347,26 @@ init_command = [ 'ruff==0.0.262', ] is_formatter = true + +[[linter]] +code = 'TOML-SORT' +is_formatter = true +include_patterns = ['**/*.toml'] +exclude_patterns = [] +command = [ + 'python', + '-m', + 'lintrunner_adapters', + 'run', + 'toml_sort_linter', + '@{{PATHSFILE}}', +] +init_command = [ + 'python', + '-m', + 'lintrunner_adapters', + 'run', + 'pip_init', + '--dry-run={{DRYRUN}}', + 'toml-sort==0.23.1', +] diff --git a/examples/adapters/add_trailing_comma_linter/.lintrunner.toml b/examples/adapters/add_trailing_comma_linter/.lintrunner.toml index 34f9d65..6772229 100644 --- a/examples/adapters/add_trailing_comma_linter/.lintrunner.toml +++ b/examples/adapters/add_trailing_comma_linter/.lintrunner.toml @@ -13,7 +13,7 @@ command = [ 'run', 'add_trailing_comma_linter', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/clippy_linter/.lintrunner.toml b/examples/adapters/clippy_linter/.lintrunner.toml index f16aed5..7bddd26 100644 --- a/examples/adapters/clippy_linter/.lintrunner.toml +++ b/examples/adapters/clippy_linter/.lintrunner.toml @@ -8,5 +8,5 @@ command = [ 'run', 'clippy_linter', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] diff --git a/examples/adapters/django_upgrade_linter/.lintrunner.toml b/examples/adapters/django_upgrade_linter/.lintrunner.toml index a0e1619..c520152 100644 --- a/examples/adapters/django_upgrade_linter/.lintrunner.toml +++ b/examples/adapters/django_upgrade_linter/.lintrunner.toml @@ -13,7 +13,7 @@ command = [ 'run', 'django_upgrade_linter', '--target-version=4.1', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/pyupgrade_linter/.lintrunner.toml b/examples/adapters/pyupgrade_linter/.lintrunner.toml index 4f0cf00..08c14b0 100644 --- a/examples/adapters/pyupgrade_linter/.lintrunner.toml +++ b/examples/adapters/pyupgrade_linter/.lintrunner.toml @@ -16,7 +16,7 @@ command = [ '--keep-mock', '--keep-percent-format', '--keep-runtime-typing', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/refurb_linter/.lintrunner.toml b/examples/adapters/refurb_linter/.lintrunner.toml index 9f3c923..e8053e9 100644 --- a/examples/adapters/refurb_linter/.lintrunner.toml +++ b/examples/adapters/refurb_linter/.lintrunner.toml @@ -15,7 +15,7 @@ command = [ '--severity=FURB101:advice', '--severity=FURB102:warning', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/ruff_fix_linter/.lintrunner.toml b/examples/adapters/ruff_fix_linter/.lintrunner.toml index ff887ca..adba862 100644 --- a/examples/adapters/ruff_fix_linter/.lintrunner.toml +++ b/examples/adapters/ruff_fix_linter/.lintrunner.toml @@ -12,7 +12,7 @@ command = [ 'run', 'ruff_fix_linter', '--config=pyproject.toml', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/ruff_linter/.lintrunner.toml b/examples/adapters/ruff_linter/.lintrunner.toml index cb6f64f..e46add7 100644 --- a/examples/adapters/ruff_linter/.lintrunner.toml +++ b/examples/adapters/ruff_linter/.lintrunner.toml @@ -15,7 +15,7 @@ command = [ '--config=pyproject.toml', '--explain', '--severity=F401:advice', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/examples/adapters/rustfmt_linter/.lintrunner.toml b/examples/adapters/rustfmt_linter/.lintrunner.toml index faa3018..7a2f2e1 100644 --- a/examples/adapters/rustfmt_linter/.lintrunner.toml +++ b/examples/adapters/rustfmt_linter/.lintrunner.toml @@ -10,5 +10,6 @@ command = [ '--binary=rustfmt', '--config-path=rustfmt.toml', '--', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] +is_formatter = true diff --git a/examples/adapters/toml_sort_linter/.lintrunner.toml b/examples/adapters/toml_sort_linter/.lintrunner.toml index 601e171..49bb4a3 100644 --- a/examples/adapters/toml_sort_linter/.lintrunner.toml +++ b/examples/adapters/toml_sort_linter/.lintrunner.toml @@ -1,5 +1,6 @@ [[linter]] code = 'TOML-SORT' +is_formatter = true include_patterns = ['**/*.toml'] exclude_patterns = [] command = [ @@ -8,7 +9,7 @@ command = [ 'lintrunner_adapters', 'run', 'toml_sort_linter', - '@{{PATHSFILE}}' + '@{{PATHSFILE}}', ] init_command = [ 'python', diff --git a/pyproject.toml b/pyproject.toml index d8e3ac4..bca1bde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,20 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.isort] +profile = "black" + +[tool.mypy] +strict = true +show_error_codes = true +show_column_numbers = true +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "lintrunner_adapters.adapters.*" +warn_unused_ignores = false + [tool.poetry] name = "lintrunner-adapters" version = "0.8.0" @@ -11,12 +28,9 @@ classifiers = [ "Topic :: Software Development :: Testing", "Topic :: Software Development :: Quality Assurance", ] -packages = [{ include = "lintrunner_adapters" }] +packages = [{include = "lintrunner_adapters"}] include = ["LICENSE"] -[tool.poetry.scripts] -lintrunner_adapters = 'lintrunner_adapters.__main__:cli' - [tool.poetry.dependencies] python = "^3.7" click = "^8.1.3" @@ -26,25 +40,8 @@ lintrunner = "^0.10.0" pytest = "^7.2.0" types-pyyaml = "^6.0.12.2" -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" - -[tool.pytest.ini_options] -addopts = "--doctest-modules" - -[tool.mypy] -strict = true -show_error_codes = true -show_column_numbers = true -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "lintrunner_adapters.adapters.*" -warn_unused_ignores = false - -[tool.isort] -profile = "black" +[tool.poetry.scripts] +lintrunner_adapters = 'lintrunner_adapters.__main__:cli' [tool.pylint.messages_control] disable = [ @@ -74,6 +71,9 @@ disable = [ "unused-import", ] +[tool.pytest.ini_options] +addopts = "--doctest-modules" + [tool.refurb] python_version = "3.7" disable = ["FURB101", "FURB150"] # disable suggestions using pathlib @@ -116,3 +116,7 @@ line-length = 120 [tool.ruff.pydocstyle] convention = "google" + +[tool.tomlsort] +spaces_indent_inline_array = 4 +trailing_comma_inline_array = true