Got pyupgrade removed and ruff pylint added

This commit is contained in:
colin99d
2023-02-07 08:30:30 -05:00
parent ef12295f33
commit 44172b0123
6 changed files with 16 additions and 41 deletions

View File

@@ -43,16 +43,14 @@ jobs:
restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
- run: |
pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.236
pip install bandit black codespell mypy==0.982 safety pylint==2.15.2 packaging==22 ruff==0.0.243
pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six
- run: bandit -x ./tests -r . || true
- run: black --diff --check .
- run: codespell --ignore-words-list=commun,statics,ro,zar,zlot,jewl,ba,buil,coo,ether,hist,hsi,mape,navagation,operatio,pres,ser,yeld,shold,ist,varian,datas,ake,creat,vie,hel,ket,toke,certi,buidl,ot,te --quiet-level=2 --skip=./tests,.git,*.css,*.csv,*.html,*.ini,*.ipynb,*.js,*.json,*.lock,*.scss,*.txt,*.yaml,./build/pyinstaller,./website/config.toml
- run: ruff .
- run: mypy --ignore-missing-imports openbb_terminal
- run: shopt -s globstar && pyupgrade --py38-plus **/*.py
- run: |
pylint terminal.py openbb_terminal tests
- run: pylint terminal.py openbb_terminal tests
markdown-link-check:
name: Markdown Linting

View File

@@ -30,17 +30,15 @@ jobs:
key: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
- run: pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.212
- run: pip install bandit black codespell mypy==0.982 safety pylint==2.15.2 packaging==22 ruff==0.0.243
- run: pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six
- run: bandit -x ./tests -r . || true
- run: black --diff --check .
- run: codespell --ignore-words-list=commun,statics,ro,zar,zlot,jewl,ba,buil,coo,ether,hist,hsi,mape,navagation,operatio,pres,ser,yeld,shold,ist,varian,datas,ake,creat,vie,hel,ket,toke,certi,buidl,ot,te --quiet-level=2 --skip=./tests,.git,*.css,*.csv,*.html,*.ini,*.ipynb,*.js,*.json,*.lock,*.scss,*.txt,*.yaml,./build/pyinstaller,./website/config.toml
- run: ruff .
- run: mypy --ignore-missing-imports openbb_terminal
- run: shopt -s globstar && pyupgrade --py38-plus **/*.py
- run: safety check
- run: |
pylint terminal.py openbb_terminal tests
- run: pylint terminal.py openbb_terminal tests
test:
name: Base Tests - Ubuntu-latest - Python 3.9
runs-on: ubuntu-latest

View File

@@ -14,7 +14,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.236'
rev: 'v0.0.243'
hooks:
- id: ruff
- repo: https://github.com/codespell-project/codespell
@@ -64,11 +64,6 @@ repos:
"website/content/api/*",
]
exclude: package.lock.json
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: local
hooks:
- id: reserved_args

3
CONTRIBUTING.md vendored
View File

@@ -1100,9 +1100,8 @@ The following linters are used by our codebase:
| bandit | security analyzer |
| black | code formatter |
| codespell | spelling checker |
| flake8 | style guide enforcer |
| ruff | a fast python linter |
| mypy | static typing checker |
| pyupgrade | upgrade syntax for newer versions |
| safety | checks security vulnerabilities |
| pylint | bug and quality checker |
| markdownlint | markdown linter |

23
poetry.lock generated vendored
View File

@@ -3499,17 +3499,6 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
"backports.zoneinfo" = {version = "*", markers = "python_version >= \"3.6\" and python_version < \"3.9\""}
tzdata = {version = "*", markers = "python_version >= \"3.6\""}
[[package]]
name = "pyupgrade"
version = "2.38.4"
description = "A tool to automatically upgrade syntax for newer versions."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.dependencies]
tokenize-rt = "<5"
[[package]]
name = "pywin32"
version = "305"
@@ -4458,14 +4447,6 @@ webencodings = ">=0.4"
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest", "isort", "flake8"]
[[package]]
name = "tokenize-rt"
version = "4.2.1"
description = "A wrapper around the stdlib `tokenize` which roundtrips."
category = "dev"
optional = false
python-versions = ">=3.6.1"
[[package]]
name = "tokenterminal"
version = "1.0.1"
@@ -5083,7 +5064,7 @@ prediction = ["torch", "pytorch-lightning", "u8darts"]
[metadata]
lock-version = "1.1"
python-versions = "^3.8,<3.11, !=3.9.7"
content-hash = "6082422c6e0601e87e9df33daa3393f6d4afffdb867ecf6db74e33622ecf41fd"
content-hash = "8b59d3adb985f6b1586d40087f128c9f0224a0bc8d1152ece42f304be8ae3483"
[metadata.files]
absl-py = []
@@ -5351,7 +5332,6 @@ pytorch-lightning = []
pytrends = []
pytz = []
pytz-deprecation-shim = []
pyupgrade = []
pywin32 = []
pywin32-ctypes = []
pywinpty = []
@@ -5418,7 +5398,6 @@ textwrap3 = []
thepassiveinvestor = []
threadpoolctl = []
tinycss2 = []
tokenize-rt = []
tokenterminal = []
toml = []
tomli = []

12
pyproject.toml vendored
View File

@@ -117,7 +117,6 @@ pylint = "2.15.2"
mypy = "^0.930"
mock = "^4.0.3"
codespell = "^2.0.0"
pyupgrade = "^2.11.0"
sphinx = "^4.5.0"
myst-parser = "^0.15.2"
black = "^23.1.0"
@@ -160,8 +159,9 @@ target-version = "py38"
# This is an introductory addition of ruff. We should look to adding:
# D: pydocstyle, PD: pandas-vet
# All options here: https://github.com/charliermarsh/ruff#supported-rules
select = ["E", "W", "F", "Q", "W", "S", "UP", "I"]
ignore = ["S105", "S106", "S107"]
select = ["E", "W", "F", "Q", "W", "S", "UP", "I", "PLC", "PLE", "PLR", "PLW"]
# These ignores should be seen as temporary solutions to problems that NEED fixed
ignore = ["S105", "S106", "S107", "S110", "PLR2004", "PLR0911", "PLR0913", "PLR0912", "PLR0915"]
[tool.ruff.per-file-ignores]
"tests/*" = ["S101"]
@@ -176,6 +176,12 @@ seaborn = "sns"
combine-as-imports = true
force-wrap-aliases = true
[tool.ruff.pylint]
max-args=8
max-branches=25
max-returns=9
max-statements=30
[tool.isort]
profile = "black"
line_length = 122