Skip to content

Commit

Permalink
chore: replace autoflake/flake8/isort with ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Nov 18, 2023
1 parent d7556a6 commit 96d1a65
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 47 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ Thumbs.db

# Python
*.py[cod]
.mypy_cache/
*_cache/
.venv-*/
.venv/
__pycache__/
venv-*/
venv/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2022 Jack Cherng <jfcherng@gmail.com>
Copyright (c) 2021-2023 Jack Cherng <jfcherng@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: all
all:

.PHONY: install
install:
python -m pip install -U pip -r requirements.txt

.PHONY: ci-check
ci-check:
mypy -p plugin
ruff check --diff --preview .
black --diff --preview --check .

.PHONY: ci-fix
ci-fix:
ruff check --preview --fix .
# ruff format --preview .
black --preview .
2 changes: 1 addition & 1 deletion boot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def reload_plugin() -> None:
import sys

# Remove all previously loaded plugin modules.
# remove all previously loaded plugin modules
prefix = f"{__package__}."
for module_name in tuple(filter(lambda m: m.startswith(prefix) and m != __name__, sys.modules)):
del sys.modules[module_name]
Expand Down
10 changes: 0 additions & 10 deletions mypy.ini

This file was deleted.

71 changes: 54 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,67 @@
[tool.mypy]
# ignore_missing_imports = False
check_untyped_defs = true
strict_optional = true
mypy_path = 'typings:stubs'

[[tool.mypy.overrides]]
module = ["plugin.libs.*"]
ignore_errors = true
ignore_missing_imports = true

[tool.black]
preview = true
line-length = 120
target-version = ['py38']

# regex
exclude = '''
/(
\.git |
plugin/libs |
stubs |
typings
\.git
| \.?venv
| \.mypy_cache
| br-.*
| branch-.*
| libs
| stubs
| tests/files
| typings
)/
'''

[tool.pyright]
include = ["./"]
include = ['./']
exclude = [
"**/__pycache__/",
"**/node_modules/",
'**/__pycache__/',
'**/node_modules/',
# git-related
"**/.git/",
"**/br-*/",
"**/branch-*/",
'**/.git/',
'**/br-*/',
'**/branch-*/',
]
ignore = [
"**/.venv",
"plugin/libs/",
ignore = ['**/.venv', '**/libs']
stubPath = 'typings'
pythonVersion = '3.8'

[tool.ruff]
preview = true
select = ["E", "F", "W", "I", "UP"]
ignore = ["E203"]
line-length = 120
target-version = 'py38'
exclude = [
".git",
".mypy_cache",
".venv",
".venv-*",
"branch-*",
"libs",
"plugin/libs",
"stubs",
"tests/files",
"typings",
"vendor",
"venv",
"venv-*",
]
stubPath = "typings"
pythonVersion = "3.8"

[tool.ruff.per-file-ignores]
"boot.py" = ["E402"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
--index https://pypi.python.org/simple/

black
flake8
mypy
ruff
16 changes: 0 additions & 16 deletions tox.ini

This file was deleted.

0 comments on commit 96d1a65

Please sign in to comment.