Skip to content

Commit

Permalink
Merge pull request #150 from preset-io/lint_on_ci
Browse files Browse the repository at this point in the history
chore: run lint tests on CI
  • Loading branch information
betodealmeida authored Nov 17, 2022
2 parents 172b6fb + 3893c69 commit 1905869
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
python -m pip install -r dev-requirements.txt
- name: Test with pytest
run: |
pre-commit run --all-files
pytest --cov-fail-under=100 --cov=src/preset_cli -vv tests/
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: '^docs/conf.py'

repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
Expand Down Expand Up @@ -34,7 +34,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.10.0
hooks:
- id: black
language_version: python3
Expand All @@ -46,7 +46,7 @@ repos:
# - id: blacken-docs
# additional_dependencies: [black]

- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
Expand Down Expand Up @@ -74,7 +74,7 @@ repos:
# - id: reorder-python-imports
# args: [--application-directories=.:src]
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1 # Possible releases: https://github.com/hadialqattan/pycln/tags
rev: v2.1.2 # Possible releases: https://github.com/hadialqattan/pycln/tags
hooks:
- id: pycln
args: [--config=pyproject.toml]
Expand Down
10 changes: 2 additions & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[MESSAGES CONTROL]
disable =
duplicate-code
use-implicit-booleaness-not-comparison
fixme
disable = duplicate-code,use-implicit-booleaness-not-comparison,fixme

[MASTER]
ignore=templates,docs
disable =
duplicate-code
use-implicit-booleaness-not-comparison
fixme
disable = duplicate-code,use-implicit-booleaness-not-comparison,fixme
8 changes: 8 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
aiohttp==3.8.3
aiosignal==1.2.0
appdirs==1.4.4
astroid==2.12.12
async-timeout==4.0.2
attrs==22.1.0
backoff==2.2.1
Expand All @@ -21,6 +22,7 @@ codespell==2.1.0
commonmark==0.9.1
coverage[toml]==6.4.3
cython==0.29.32
dill==0.3.6
distlib==0.3.5
filelock==3.8.0
freezegun==1.2.2
Expand All @@ -29,9 +31,12 @@ greenlet==1.1.3.post0
identify==2.5.3
idna==3.3
iniconfig==1.1.1
isort==5.10.1
jinja2==3.1.2
lazy-object-proxy==1.8.0
markupsafe==2.1.1
marshmallow==3.17.0
mccabe==0.7.0
multidict==6.0.2
nodeenv==1.7.0
numpy==1.23.1
Expand All @@ -47,6 +52,7 @@ prompt-toolkit==3.0.30
py==1.11.0
pyfakefs==4.6.3
pygments==2.12.0
pylint==2.15.5
pyparsing==3.0.9
pytest==7.1.2
pytest-cov==3.0.0
Expand All @@ -65,12 +71,14 @@ sqlparse==0.4.2
tabulate==0.8.10
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.6
typing-extensions==4.3.0
urllib3==1.26.9
virtualenv==20.16.3
wcwidth==0.2.5
websockets==10.3
wheel==0.37.1
wrapt==1.14.1
yarl==1.8.1

# The following packages are considered to be unsafe in a requirements file:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ testing =
codespell
pre-commit
pip-tools>=6.6.0
pylint>=2.11.1

[options.entry_points]
# Add here console scripts like:
Expand Down
1 change: 1 addition & 0 deletions src/preset_cli/auth/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_access_token(baseurl: Union[str, URL], api_token: str, api_secret: str)
baseurl / "v1/auth/",
json={"name": api_token, "secret": api_secret},
headers={"Content-Type": "application/json"},
timeout=60,
)
response.raise_for_status()
payload = response.json()
Expand Down
2 changes: 1 addition & 1 deletion src/preset_cli/auth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self):
self.session = Session()
self.session.hooks["response"].append(self.reauth)

def get_headers(self) -> Dict[str, str]: # pylint: disable=no-self-use
def get_headers(self) -> Dict[str, str]:
"""
Return headers for auth.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/preset_cli/auth/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, baseurl: URL, username: str, password: Optional[str] = None):
self.password = password
self.auth()

def get_headers(self) -> Dict[str, str]: # pylint: disable=no-self-use
def get_headers(self) -> Dict[str, str]:
return {"X-CSRFToken": self.csrf_token} if self.csrf_token else {}

def auth(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/api/clients/superset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ def test_get_uuids(requests_mock: Mocker) -> None:
with bundle.open("metadata.yaml", "w") as output:
output.write(b"Hello!")
with bundle.open(name, "w") as output:
output.write(yaml.dump({"uuid": uuid}).encode())
output.write(yaml.dump({"uuid": uuid}).encode()) # type: ignore
buf.seek(0)

requests_mock.get(
Expand Down

0 comments on commit 1905869

Please sign in to comment.