Skip to content

Commit

Permalink
chore: configure toml-sort and sort all toml files (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinchuby authored Jun 10, 2023
1 parent cb49c15 commit 72e66a7
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 54 deletions.
67 changes: 45 additions & 22 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ command = [
'flake8_linter',
'--show-disable',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down Expand Up @@ -50,7 +50,7 @@ command = [
'--show-notes',
'--show-disable',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -116,7 +116,7 @@ command = [
This line has trailing spaces; please remove them.\
""",
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]

[[linter]]
Expand All @@ -140,7 +140,7 @@ command = [
This line has tabs; please replace them with spaces.\
""",
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]

[[linter]]
Expand All @@ -157,7 +157,7 @@ command = [
'black_isort_linter',
'--fast',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down Expand Up @@ -188,7 +188,7 @@ command = [
'--jobs=0',
'--show-disable',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand All @@ -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',
Expand All @@ -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

Expand All @@ -255,7 +255,7 @@ command = [
'run',
'editorconfig_checker_linter',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand All @@ -282,7 +282,7 @@ command = [
'run',
'pyupgrade_linter',
'--py37-plus',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand All @@ -308,7 +308,7 @@ command = [
'run',
'refurb_linter',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand All @@ -335,7 +335,7 @@ command = [
'ruff_linter',
'--config=pyproject.toml',
'--show-disable',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand All @@ -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',
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ command = [
'run',
'add_trailing_comma_linter',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
2 changes: 1 addition & 1 deletion examples/adapters/clippy_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ command = [
'run',
'clippy_linter',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
2 changes: 1 addition & 1 deletion examples/adapters/django_upgrade_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ command = [
'run',
'django_upgrade_linter',
'--target-version=4.1',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
2 changes: 1 addition & 1 deletion examples/adapters/pyupgrade_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ command = [
'--keep-mock',
'--keep-percent-format',
'--keep-runtime-typing',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
2 changes: 1 addition & 1 deletion examples/adapters/refurb_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ command = [
'--severity=FURB101:advice',
'--severity=FURB102:warning',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
2 changes: 1 addition & 1 deletion examples/adapters/ruff_fix_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ command = [
'run',
'ruff_fix_linter',
'--config=pyproject.toml',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
2 changes: 1 addition & 1 deletion examples/adapters/ruff_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ command = [
'--config=pyproject.toml',
'--explain',
'--severity=F401:advice',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
3 changes: 2 additions & 1 deletion examples/adapters/rustfmt_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ command = [
'--binary=rustfmt',
'--config-path=rustfmt.toml',
'--',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
is_formatter = true
3 changes: 2 additions & 1 deletion examples/adapters/toml_sort_linter/.lintrunner.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[[linter]]
code = 'TOML-SORT'
is_formatter = true
include_patterns = ['**/*.toml']
exclude_patterns = []
command = [
Expand All @@ -8,7 +9,7 @@ command = [
'lintrunner_adapters',
'run',
'toml_sort_linter',
'@{{PATHSFILE}}'
'@{{PATHSFILE}}',
]
init_command = [
'python',
Expand Down
50 changes: 27 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand All @@ -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 = [
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -116,3 +116,7 @@ line-length = 120

[tool.ruff.pydocstyle]
convention = "google"

[tool.tomlsort]
spaces_indent_inline_array = 4
trailing_comma_inline_array = true

0 comments on commit 72e66a7

Please sign in to comment.