chore(CI): fix pylint workflow

This commit is contained in:
Federico Aguzzi 2024-07-04 18:01:34 +02:00
parent 30ca15ca28
commit 583c32106e
4 changed files with 36 additions and 21 deletions

View File

@ -1,27 +1,23 @@
on: [push] on:
push:
paths:
- 'scrapegraphai/**'
- '.github/workflows/pylint.yml'
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Install the latest version of rye
uses: actions/setup-python@v3 uses: eifinger/setup-rye@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
run: | run: rye sync --no-lock
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
- name: Analysing the code with pylint - name: Analysing the code with pylint
run: pylint --disable=C0114,C0115,C0116 --exit-zero scrapegraphai/**/*.py scrapegraphai/*.py run: rye run pylint-ci
- name: Check Pylint score - name: Check Pylint score
run: | run: |
pylint_score=$(pylint --disable=all --enable=metrics --output-format=text scrapegraphai/**/*.py scrapegraphai/*.py | grep 'Raw metrics' | awk '{print $4}') pylint_score=$(rye run pylint-score-ci | grep 'Raw metrics' | awk '{print $4}')
if (( $(echo "$pylint_score < 8" | bc -l) )); then if (( $(echo "$pylint_score < 8" | bc -l) )); then
echo "Pylint score is below 8. Blocking commit." echo "Pylint score is below 8. Blocking commit."
exit 1 exit 1

View File

@ -84,4 +84,11 @@ dev-dependencies = [
"pytest-mock==3.14.0", "pytest-mock==3.14.0",
"-e file:.[burr]", "-e file:.[burr]",
"-e file:.[docs]", "-e file:.[docs]",
"pylint>=3.2.5",
] ]
[tool.rye.scripts]
pylint-local = "pylint scrapegraphai/**/*.py"
pylint-ci = "pylint --disable=C0114,C0115,C0116 --exit-zero scrapegraphai/**/*.py"
pylint-score-ci = "pylint --disable=all --enable=metrics --output-format=text scrapegraphai/**/.py"

View File

@ -22,7 +22,6 @@ altair==5.3.0
annotated-types==0.7.0 annotated-types==0.7.0
# via pydantic # via pydantic
anthropic==0.30.0 anthropic==0.30.0
# via langchain-anthropic # via langchain-anthropic
anyio==4.4.0 anyio==4.4.0
# via anthropic # via anthropic
@ -31,6 +30,8 @@ anyio==4.4.0
# via openai # via openai
# via starlette # via starlette
# via watchfiles # via watchfiles
astroid==3.2.2
# via pylint
async-timeout==4.0.3 async-timeout==4.0.3
# via aiohttp # via aiohttp
# via langchain # via langchain
@ -84,6 +85,8 @@ dateparser==1.2.0
# via htmldate # via htmldate
defusedxml==0.7.1 defusedxml==0.7.1
# via langchain-anthropic # via langchain-anthropic
dill==0.3.8
# via pylint
distro==1.9.0 distro==1.9.0
# via anthropic # via anthropic
# via groq # via groq
@ -93,7 +96,6 @@ dnspython==2.6.1
docutils==0.19 docutils==0.19
# via sphinx # via sphinx
email-validator==2.2.0 email-validator==2.2.0
# via fastapi # via fastapi
exceptiongroup==1.2.1 exceptiongroup==1.2.1
# via anyio # via anyio
@ -107,7 +109,6 @@ fastapi-cli==0.0.4
fastapi-pagination==0.12.25 fastapi-pagination==0.12.25
# via burr # via burr
filelock==3.15.4 filelock==3.15.4
# via huggingface-hub # via huggingface-hub
fonttools==4.53.0 fonttools==4.53.0
# via matplotlib # via matplotlib
@ -117,7 +118,6 @@ frozenlist==1.4.1
# via aiohttp # via aiohttp
# via aiosignal # via aiosignal
fsspec==2024.6.1 fsspec==2024.6.1
# via huggingface-hub # via huggingface-hub
furo==2024.5.6 furo==2024.5.6
# via scrapegraphai # via scrapegraphai
@ -153,6 +153,7 @@ graphviz==0.20.3
# via scrapegraphai # via scrapegraphai
greenlet==3.0.3 greenlet==3.0.3
# via playwright # via playwright
# via sqlalchemy
groq==0.9.0 groq==0.9.0
# via langchain-groq # via langchain-groq
grpcio==1.64.1 grpcio==1.64.1
@ -195,6 +196,8 @@ importlib-resources==6.4.0
# via matplotlib # via matplotlib
iniconfig==2.0.0 iniconfig==2.0.0
# via pytest # via pytest
isort==5.13.2
# via pylint
jinja2==3.1.4 jinja2==3.1.4
# via altair # via altair
# via burr # via burr
@ -266,6 +269,8 @@ marshmallow==3.21.3
# via dataclasses-json # via dataclasses-json
matplotlib==3.9.0 matplotlib==3.9.0
# via burr # via burr
mccabe==0.7.0
# via pylint
mdurl==0.1.2 mdurl==0.1.2
# via markdown-it-py # via markdown-it-py
minify-html==0.15.0 minify-html==0.15.0
@ -311,6 +316,8 @@ pandas==2.2.2
pillow==10.3.0 pillow==10.3.0
# via matplotlib # via matplotlib
# via streamlit # via streamlit
platformdirs==4.2.2
# via pylint
playwright==1.43.0 playwright==1.43.0
# via scrapegraphai # via scrapegraphai
# via undetected-playwright # via undetected-playwright
@ -355,6 +362,7 @@ pygments==2.18.0
# via furo # via furo
# via rich # via rich
# via sphinx # via sphinx
pylint==3.2.5
pyparsing==3.1.2 pyparsing==3.1.2
# via httplib2 # via httplib2
# via matplotlib # via matplotlib
@ -468,7 +476,10 @@ tokenizers==0.19.1
toml==0.10.2 toml==0.10.2
# via streamlit # via streamlit
tomli==2.0.1 tomli==2.0.1
# via pylint
# via pytest # via pytest
tomlkit==0.12.5
# via pylint
toolz==0.12.1 toolz==0.12.1
# via altair # via altair
tornado==6.4.1 tornado==6.4.1
@ -487,6 +498,7 @@ typing-extensions==4.12.2
# via altair # via altair
# via anthropic # via anthropic
# via anyio # via anyio
# via astroid
# via fastapi # via fastapi
# via fastapi-pagination # via fastapi-pagination
# via google-generativeai # via google-generativeai
@ -496,6 +508,7 @@ typing-extensions==4.12.2
# via pydantic # via pydantic
# via pydantic-core # via pydantic-core
# via pyee # via pyee
# via pylint
# via sf-hamilton # via sf-hamilton
# via sqlalchemy # via sqlalchemy
# via starlette # via starlette
@ -517,13 +530,11 @@ undetected-playwright==0.3.0
uritemplate==4.1.1 uritemplate==4.1.1
# via google-api-python-client # via google-api-python-client
urllib3==1.26.19 urllib3==1.26.19
# via botocore # via botocore
# via courlan # via courlan
# via htmldate # via htmldate
# via requests # via requests
# via trafilatura # via trafilatura
uvicorn==0.30.1 uvicorn==0.30.1
# via burr # via burr
# via fastapi # via fastapi

View File

@ -101,6 +101,7 @@ graphviz==0.20.3
# via scrapegraphai # via scrapegraphai
greenlet==3.0.3 greenlet==3.0.3
# via playwright # via playwright
# via sqlalchemy
groq==0.9.0 groq==0.9.0
# via langchain-groq # via langchain-groq
grpcio==1.64.1 grpcio==1.64.1