From 8225586cc56d68ba78ca184b2cd321a107ef48fa Mon Sep 17 00:00:00 2001 From: UtkarshMishra-Microsoft Date: Fri, 13 Dec 2024 18:02:12 +0530 Subject: [PATCH] Add linting configuration files --- .flake8 | 4 ++++ .github/workflows/pylint.yml | 35 +++++++++++++++++++++++++++++++++++ .pylintrc | 24 ++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .flake8 create mode 100644 .github/workflows/pylint.yml create mode 100644 .pylintrc diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..7ce8ed9d --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 120 +exclude = .venv, _pycache_, migrations +ignore = E501,F401,F811,F841,E203,E231,W503 \ No newline at end of file diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 00000000..6cf3e839 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,35 @@ +name: Code Quality Workflow + +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + + steps: + # Step 1: Checkout code + - name: Checkout code + uses: actions/checkout@v4 + + # Step 2: Set up Python environment + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + # Step 3: Run all code quality checks + - name: Run Code Quality Checks + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + echo "Fixing imports with Isort..." + python -m isort --verbose . + echo "Formatting code with Black..." + python -m black --verbose . + echo "Running Flake8..." + python -m flake8 --config=.flake8 --verbose . + echo "Running Pylint..." + python -m pylint --rcfile=.pylintrc --verbose . \ No newline at end of file diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..1ea8afa3 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,24 @@ +[MASTER] +ignore=__pycache__, migrations, .venv + +[MESSAGES CONTROL] + +disable=parse-error,missing-docstring,too-many-arguments,line-too-long + +[FORMAT] + +max-line-length=120 + +[DESIGN] + +max-args=10 +max-locals=25 +max-branches=15 +max-statements=75 + +[REPORTS] +output-format=colorized +reports=no + +[EXCEPTIONS] +overgeneral-exceptions=builtins.Exception,builtins.BaseException \ No newline at end of file