Browse Source

feat: replace flake8, mypy, black, isort with ruff

trgiangdo 1 year ago
parent
commit
4f9a5c631d
1 changed files with 63 additions and 0 deletions
  1. 63 0
      ruff.toml

+ 63 - 0
ruff.toml

@@ -0,0 +1,63 @@
+exclude = [
+    ".git",
+    "__pycache__",
+    "setup.py",
+    "build",
+    "dist",
+    "releases",
+    ".venv",
+    ".tox",
+    ".mypy_cache",
+    ".pytest_cache",
+    ".vscode",
+    ".github",
+]
+line-length = 120
+indent-width = 4
+ignore-init-module-imports = true
+
+[lint]
+select = [
+    "E",  # pycodestyle errors
+    "F",  # pyflakes errors
+    "W",  # pycodestyle warnings
+    "C",  # mccabe complexity checker
+    "B",  # bugbear best practices checker
+    "T",  # mypy type errors
+    "B", # flake8-bugbear best practices checker
+    "I001", # isort import order
+]
+ignore = [
+    "E203",  # whitespace before ':'
+    # "E266",  # too many leading '#' for block comment
+    # "E501",  # line too long (82 > 79 characters)
+    "E722",  # do not use bare except
+    # "W503",  # line break before binary operator
+    # "F403",  # 'from module import *' used; unable to detect undefined names
+    # "F401", # module imported but unused
+    # "missing-imports",  # mypy: Missing module imports
+    "C401",  # Unnecessary generator (rewrite as a `set` comprehension)
+    "C405",  # Unnecessary list literal - rewrite as a literal
+    "C408",  # Unnecessary dict call - rewrite as a literal
+    "C409",  # Unnecessary list passed to tuple() - rewrite as a tuple literal
+    "C416",  # Unnecessary `set` comprehension (rewrite using `set()`)
+]
+
+# Allow fix for all enabled rules (when `--fix`) is provided.
+fixable = ["ALL"]
+unfixable = []
+
+[lint.per-file-ignores]
+"__init__.py" = ["F401", "F403"]  # unused import
+"_init.py" = ["F401", "F403"]  # unused import
+"taipy/config/stubs/pyi_header.py" = ["F401", "F403"]  # unused import
+"taipy/templates/*" = ["F401", "F403", "T201"]  # unused import, `print` found
+"tests/*" = ["T201"]  # `print` found
+"tools/*" = ["T201"]  # `print` found
+
+[lint.mccabe]
+# Flag errors (`C901`) whenever the complexity level exceeds 5.
+max-complexity = 18
+
+[pydocstyle]
+convention = "google"