From 2a9397de42b655eaa60705f4423c0f19cb46f591 Mon Sep 17 00:00:00 2001 From: Adi8712 Date: Fri, 25 Oct 2024 20:37:02 +0530 Subject: [PATCH] chore: added linting --- .gitignore | 2 ++ .pre-commit-config.yaml | 14 +++++++++++++ requirements.txt | 1 + ruff.toml | 46 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 ruff.toml diff --git a/.gitignore b/.gitignore index a88681399..83d6642c9 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,5 @@ package-lock.json .DS_Store **/generated.pdf + +.ruff_cache/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..979f857c5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 + hooks: + - id: ruff + args: [ --fix ] + - id: ruff-format diff --git a/requirements.txt b/requirements.txt index 4b97f144f..27a124177 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,6 +45,7 @@ numpy==1.22.3 oauthlib==3.1.0 openpyxl==3.0.7 Pillow==8.1.0 +pre-commit==3.5.0 prompt-toolkit==3.0.10 psycopg2-binary==2.8.6 pycparser==2.20 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..8dea846ed --- /dev/null +++ b/ruff.toml @@ -0,0 +1,46 @@ +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 88 +indent-width = 4 +target-version = "py38" +show-fixes = true + +[lint] +select = ["F", "E", "W", "UP", "I", "PL"] +ignore = ["F403", "F405"] +fixable = ["ALL"] +unfixable = [] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +quote-style = "double" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto"