From 5c4658b3f3287200776dbafd5168e4f5dd04a067 Mon Sep 17 00:00:00 2001 From: Harlan Lieberman-Berg Date: Fri, 22 Dec 2023 06:02:32 +0000 Subject: [PATCH] feat: switch to ruff for linting (#90) This will greatly increase the speed of the linting; it's setup to be 1:1 compatible with flake8 at the moment. We have the option to also require formatting checks here, but for the moment, it sticks only to linting. --- .github/workflows/pythonpackage.yml | 9 +++------ .ruff.toml | 1 + setup.py | 5 +++++ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .ruff.toml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c3c04f6..caaf647 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,13 +27,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + python -m pip install -e .[dev] -r requirements.txt + - name: Lint with ruff run: | - # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 . --count --max-complexity=14 --max-line-length=127 --show-source --statistics + ruff check . --statistics # - name: Test with pytest # run: | # pytest diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..46121f3 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1 @@ +line-length = 127 diff --git a/setup.py b/setup.py index 1afd97e..fd3debf 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,11 @@ license='GPL-3.0', packages=find_packages(), include_package_data=True, + extras_require={ + 'dev': [ + 'ruff', + ] + }, install_requires=[ 'Click >= 7.0', 'beancount >= 2.3.5',