Skip to content

Commit 5fc6ec5

Browse files
committed
Flake8 linting
1 parent c391a23 commit 5fc6ec5

File tree

4 files changed

+28
-53
lines changed

4 files changed

+28
-53
lines changed

.github/workflows/pylint.yml

-23
This file was deleted.

.github/workflows/python-app.yml

+22-26
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
4-
name: Python application
1+
name: Lint and Test
52

63
on:
74
push:
8-
branches: [ "main" ]
5+
branches: ["main"]
96
pull_request:
10-
branches: [ "main" ]
7+
branches: ["main"]
118

129
permissions:
1310
contents: read
1411

1512
jobs:
1613
build:
17-
1814
runs-on: ubuntu-latest
1915

2016
steps:
21-
- uses: actions/checkout@v4
22-
- name: Set up Python 3.12
23-
uses: actions/setup-python@v3
24-
with:
25-
python-version: "3.12"
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install flake8 pytest
30-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31-
- name: Lint with flake8
32-
run: |
33-
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pytest
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.12
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: "3.12"
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install flake8 pytest
26+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
27+
- name: Lint with flake8
28+
run: |
29+
# stop the build if there are Python syntax errors or undefined names
30+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
31+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
32+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
33+
- name: Test with pytest
34+
run: |
35+
pytest

graphbuilder.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Regular expression to detect cell references like A1, B2, or ranges like A1:B2
1212

1313
# ignore linting error for regex pattern
14-
CELL_REF_REGEX = r"('?[A-Za-z0-9_\-\[\] ]+'?![A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)|([A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)" # pylint: disable=line-too-long
14+
CELL_REF_REGEX = r"('?[A-Za-z0-9_\-\[\] ]+'?![A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)|([A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)"
1515

1616

1717
def extract_formulas_and_build_dependencies(file_path):
@@ -26,7 +26,7 @@ def extract_formulas_and_build_dependencies(file_path):
2626
graph = nx.DiGraph()
2727

2828
# Iterate over all sheets
29-
for sheet_name in wb.sheetnames: # pylint: disable=too-many-nested-blocks
29+
for sheet_name in wb.sheetnames:
3030
ws = wb[sheet_name]
3131
print(f"-- Analyzing sheet: {sheet_name} --")
3232

@@ -121,7 +121,7 @@ def visualize_dependency_graph(graph, file_path):
121121

122122

123123
if __name__ == "__main__":
124-
path_to_excel = "Book1.xlsx" # pylint: disable=invalid-name
124+
path_to_excel = "Book1.xlsx"
125125

126126
# override with command line argument
127127
import sys

requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ contourpy==1.3.0
44
cycler==0.12.1
55
dill==0.3.8
66
et-xmlfile==1.1.0
7+
flake8==7.1.1
78
fonttools==4.53.1
89
iniconfig==2.0.0
910
isort==5.13.2
@@ -17,7 +18,8 @@ packaging==24.1
1718
pillow==10.4.0
1819
platformdirs==4.3.3
1920
pluggy==1.5.0
20-
pylint==3.2.7
21+
pycodestyle==2.12.1
22+
pyflakes==3.2.0
2123
pyparsing==3.1.4
2224
pytest==8.3.3
2325
python-dateutil==2.9.0.post0

0 commit comments

Comments
 (0)