Skip to content

Commit b9d40e8

Browse files
authored
Merge pull request #16 from SamhammerAG/KIT-4745
KIT-4745 introduce ruff initial commit
2 parents 42c2544 + 731277a commit b9d40e8

24 files changed

Lines changed: 375 additions & 293 deletions

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
33

44
# Uninstall pre-installed formatting and linting tools
55
# They would conflict with our pinned versions
6-
RUN pipx uninstall flake8
76
RUN pipx uninstall mypy

.devcontainer/devcontainer.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@
88
"vscode": {
99
"settings": {
1010
"python.pythonPath": "/usr/local/bin/python",
11-
"python.defaultInterpreterPath": "/usr/local/bin/python",
12-
"python.languageServer": "Pylance",
13-
"flake8.path": [
14-
"/usr/local/py-utils/bin/bandit",
15-
"/usr/local/py-utils/bin/pydocstyle"
16-
],
17-
"flake8.importStrategy": "fromEnvironment"
11+
"python.defaultInterpreterPath": "/usr/local/bin/python"
1812
},
1913
"extensions": [
2014
"AykutSarac.jsoncrack-vscode",
15+
"charliermarsh.ruff",
2116
"eamodio.gitlens",
2217
"Gruntfuggly.todo-tree",
2318
"matangover.mypy",
24-
"ms-python.flake8",
25-
"ms-python.isort",
2619
"ms-python.mypy-type-checker",
27-
"ms-python.pylint",
2820
"ms-python.python",
2921
"ms-python.vscode-pylance",
3022
"njpwerner.autodocstring",

.flake8

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/flake8-error-problem-matcher.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/flake8-warning-problem-matcher.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/01-ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: 01 | ai-data-preprocessing-queue | continuous integration
2+
run-name: State ${{ github.ref }}
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
paths-ignore:
8+
- README.md
9+
- LICENSE.txt
10+
- .gitignore
11+
- .vscode/**
12+
- .devcontainer/**
13+
14+
jobs:
15+
changes:
16+
name: changes
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 1
19+
outputs:
20+
ai_data_preprocessingqueue: ${{ steps.filter.outputs.ai_data_preprocessing_queue }}
21+
first_run: ${{ steps.first_run.outputs.first_run }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: SamhammerAG/first-build-action@v2.1
25+
id: first_run
26+
with:
27+
workflow: 01 | ai-data-preprocessing-queue | continuous integration
28+
branch: ${{ github.ref_name }}
29+
- uses: dorny/paths-filter@v3
30+
id: filter
31+
with:
32+
base: ${{ github.ref }}
33+
filters: |
34+
ai-data-preprocessing-queue:
35+
- '.github/workflows/01-ci.yml'
36+
- 'ai-data-preprocessing-queue/**'
37+
38+
build_python:
39+
name: Python | build
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 5
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: 3.12
47+
- name: preparation | Add linting matchers
48+
run: |
49+
echo "::add-matcher::.github/mypy-error-problem-matcher.json"
50+
- name: preparation | upgrade pip
51+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
52+
run: python -m pip install --upgrade pip
53+
- name: ai-data-preprocessing-queue | Install dependencies
54+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
55+
run: pip install -r requirements-dev.txt
56+
- name: preparation | Create failures dir
57+
run: mkdir -p ./ruff_failures
58+
- name: ai-data-preprocessing-queue | ruff check
59+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
60+
run: |
61+
ruff check --output-format github . || echo "ai_data_preprocessing_queue" >> ./ruff_failures/ruff_failures.txt
62+
- name: ai-data-preprocessing-queue | Lint typing
63+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
64+
# Must run with installed dependencies
65+
# Must be executed from root with path to project as param because
66+
# the problem matcher needs an absolute path in error message to work correctly
67+
working-directory: ./
68+
run: |
69+
mypy --config-file .mypy.ini --show-column-numbers ai-data-preprocessing-queue
70+
- name: Test ai-data-preprocessing-queue
71+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
72+
working-directory: ai-data-preprocessing-queue
73+
run: pytest --cov app --cov-report=xml tests
74+
- name: ai-data-preprocessing-queue | Report coverage
75+
if: needs.changes.outputs.ai_data_preprocessing_queue == 'true' || needs.changes.outputs.first_run == 'true'
76+
uses: MishaKav/pytest-coverage-comment@main
77+
with:
78+
title: Test coverage for changes on ai-data-preprocessing-queue
79+
pytest-xml-coverage-path: ai-data-preprocessing-queue/coverage.xml
80+
report-only-changed-files: true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
name: Build and/or publish Python 🐍 distributions 📦 to PyPI
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v4
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
1313
with:
1414
python-version: "3.12"
1515
- run: >-

.github/workflows/ci.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.pylintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
"files.trimTrailingWhitespace": true,
1010
"files.exclude": {
1111
".coverage": true,
12-
".flake8": true,
1312
".gitattributes": true,
1413
".gitignore": true,
1514
".idea": true,
1615
".mypy_cache": true,
1716
".mypy.ini": true,
18-
".pylintrc": true,
1917
"*.egg-info": true,
2018
"**/__pycache__": true,
2119
"**/.pytest_cache": true,
@@ -29,8 +27,8 @@
2927
"python.testing.pytestEnabled": true,
3028
"python.testing.unittestEnabled": false,
3129
"[python]": {
32-
"editor.defaultFormatter": "ms-python.black-formatter",
33-
"editor.formatOnSave": true
30+
"editor.formatOnSave": true,
31+
"editor.defaultFormatter": "charliermarsh.ruff"
3432
},
3533
"python.analysis.diagnosticSeverityOverrides": {
3634
"reportPrivateUsage": "information",

0 commit comments

Comments
 (0)