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') }} restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
- run: | - 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 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: bandit -x ./tests -r . || true
- run: black --diff --check . - 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: 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: ruff .
- run: mypy --ignore-missing-imports openbb_terminal - 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: markdown-link-check:
name: Markdown Linting name: Markdown Linting

View File

@@ -30,17 +30,15 @@ jobs:
key: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} key: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ 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: 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: bandit -x ./tests -r . || true
- run: black --diff --check . - 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: 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: ruff .
- run: mypy --ignore-missing-imports openbb_terminal - run: mypy --ignore-missing-imports openbb_terminal
- run: shopt -s globstar && pyupgrade --py38-plus **/*.py
- run: safety check - run: safety check
- run: | - run: pylint terminal.py openbb_terminal tests
pylint terminal.py openbb_terminal tests
test: test:
name: Base Tests - Ubuntu-latest - Python 3.9 name: Base Tests - Ubuntu-latest - Python 3.9
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

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

3
CONTRIBUTING.md vendored
View File

@@ -1100,9 +1100,8 @@ The following linters are used by our codebase:
| bandit | security analyzer | | bandit | security analyzer |
| black | code formatter | | black | code formatter |
| codespell | spelling checker | | codespell | spelling checker |
| flake8 | style guide enforcer | | ruff | a fast python linter |
| mypy | static typing checker | | mypy | static typing checker |
| pyupgrade | upgrade syntax for newer versions |
| safety | checks security vulnerabilities | | safety | checks security vulnerabilities |
| pylint | bug and quality checker | | pylint | bug and quality checker |
| markdownlint | markdown linter | | 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\""} "backports.zoneinfo" = {version = "*", markers = "python_version >= \"3.6\" and python_version < \"3.9\""}
tzdata = {version = "*", markers = "python_version >= \"3.6\""} 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]] [[package]]
name = "pywin32" name = "pywin32"
version = "305" version = "305"
@@ -4458,14 +4447,6 @@ webencodings = ">=0.4"
doc = ["sphinx", "sphinx-rtd-theme"] doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest", "isort", "flake8"] 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]] [[package]]
name = "tokenterminal" name = "tokenterminal"
version = "1.0.1" version = "1.0.1"
@@ -5083,7 +5064,7 @@ prediction = ["torch", "pytorch-lightning", "u8darts"]
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.8,<3.11, !=3.9.7" python-versions = "^3.8,<3.11, !=3.9.7"
content-hash = "6082422c6e0601e87e9df33daa3393f6d4afffdb867ecf6db74e33622ecf41fd" content-hash = "8b59d3adb985f6b1586d40087f128c9f0224a0bc8d1152ece42f304be8ae3483"
[metadata.files] [metadata.files]
absl-py = [] absl-py = []
@@ -5351,7 +5332,6 @@ pytorch-lightning = []
pytrends = [] pytrends = []
pytz = [] pytz = []
pytz-deprecation-shim = [] pytz-deprecation-shim = []
pyupgrade = []
pywin32 = [] pywin32 = []
pywin32-ctypes = [] pywin32-ctypes = []
pywinpty = [] pywinpty = []
@@ -5418,7 +5398,6 @@ textwrap3 = []
thepassiveinvestor = [] thepassiveinvestor = []
threadpoolctl = [] threadpoolctl = []
tinycss2 = [] tinycss2 = []
tokenize-rt = []
tokenterminal = [] tokenterminal = []
toml = [] toml = []
tomli = [] tomli = []

12
pyproject.toml vendored
View File

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