Skip to content

Commit

Permalink
Merge pull request #201 from hkad98/PSDK-121
Browse files Browse the repository at this point in the history
PSDK-121 change linter to ruff

Reviewed-by: Jan Soubusta
             https://github.com/jaceksan
  • Loading branch information
gdgate committed Jan 16, 2023
2 parents 40fb15b + 823d432 commit d4021e2
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 53 deletions.
16 changes: 0 additions & 16 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ test_clients.py
gooddata-sdk/tests/catalog/store
.DS_Store
.vscode
.ruff_cache
14 changes: 8 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: ['--maxkb=600']
args: [ '--maxkb=600' ]
- id: check-case-conflict
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.220
hooks:
- id: flake8
- id: ruff
# Respect `exclude` and `extend-exclude` settings.
args: [ "--force-exclude" ]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
Expand All @@ -32,6 +34,6 @@ repos:
name: Copyright
description: Scan for missing copyright
entry: scripts/check_copyright.py
args: ["--update", "FILES"]
args: [ "--update", "FILES" ]
language: script
types: [text]
types: [ text ]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dev:

.PHONY: lint
lint:
flake8 .
ruff .

.PHONY: format
format:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def granularity(self) -> Union[str, None]:

def primary_label(self) -> Union[CatalogLabel, None]:
# use cast as mypy is not applying next, it claims, type is filter[CatalogLabel]
return cast(Union[CatalogLabel, None], next(filter(lambda l: l.primary, self.labels), None))
return cast(Union[CatalogLabel, None], next(filter(lambda x: x.primary, self.labels), None))

def find_label(self, id_obj: IdObjType) -> Union[CatalogLabel, None]:
obj_key = id_obj_to_key(id_obj)
Expand Down
2 changes: 1 addition & 1 deletion lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
flake8==3.9.0
ruff==0.0.220
84 changes: 56 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
# (C) 2021 GoodData Corporation
[tool.ruff]
exclude = [
".git",
".venv",
"__pycache__",
".tox",
"build",
"dist",
"gooddata-afm-client",
"gooddata-metadata-client",
"gooddata-scan-client",
"gooddata-api-client",
]
line-length = 120
select = [
# pyflakes
"F",
# pycodestyle
"E",
"W",
]

[tool.ruff.per-file-ignores]
"gooddata-pandas/gooddata_pandas/__init__.py" = ["F401"]
"gooddata-sdk/gooddata_sdk/*/__init__.py" = ["F401"]
"gooddata-sdk/gooddata_sdk/__init__.py" = ["F401"]
"gooddata-fdw/gooddata_fdw/__init__.py" = ["F401"]

[tool.black]
line-length = 120
# intentionally ignore the generated clients
Expand All @@ -10,7 +38,7 @@ profile = "black"
multi_line_output = 3
include_trailing_comma = true
line_length = 120
skip_glob = ["*/gooddata-afm-client/*","*/gooddata-metadata-client/*","*/gooddata-scan-client/*","*/gooddata-api-client/*","*/.snapshot/*"]
skip_glob = ["*/gooddata-afm-client/*", "*/gooddata-metadata-client/*", "*/gooddata-scan-client/*", "*/gooddata-api-client/*", "*/.snapshot/*"]
src_paths = [
"gooddata-afm-client",
"gooddata-metadata-client",
Expand All @@ -37,79 +65,79 @@ regex = '''
'''

[[tool.tbump.field]]
name="alpha"
default=""
name = "alpha"
default = ""

[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "v{new_version}"

[[tool.tbump.file]]
# clients setup.py
src="gooddata-*-client/setup.py"
search="VERSION = \"{current_version}\""
src = "gooddata-*-client/setup.py"
search = "VERSION = \"{current_version}\""

[[tool.tbump.file]]
# fdw setup.py
src="gooddata-fdw/setup.py"
search="version=\"{current_version}\""
src = "gooddata-fdw/setup.py"
search = "version=\"{current_version}\""

[[tool.tbump.file]]
# fdw setup.py dependency
src="gooddata-fdw/setup.py"
search="gooddata-sdk~={current_version}"
src = "gooddata-fdw/setup.py"
search = "gooddata-sdk~={current_version}"

[[tool.tbump.file]]
# pandas setup.py
src="gooddata-pandas/setup.py"
search="version=\"{current_version}\""
src = "gooddata-pandas/setup.py"
search = "version=\"{current_version}\""

[[tool.tbump.file]]
# pandas setup.py dependency
src="gooddata-pandas/setup.py"
search="gooddata-sdk~={current_version}"
src = "gooddata-pandas/setup.py"
search = "gooddata-sdk~={current_version}"

[[tool.tbump.file]]
# sdk setup.py
src="gooddata-sdk/setup.py"
search="version=\"{current_version}\""
src = "gooddata-sdk/setup.py"
search = "version=\"{current_version}\""

[[tool.tbump.file]]
# sdk setup.py dependency
src="gooddata-sdk/setup.py"
search="gooddata-.*-client~={current_version}"
src = "gooddata-sdk/setup.py"
search = "gooddata-.*-client~={current_version}"

[[tool.tbump.file]]
# clients README
src="gooddata-*-client/README.md"
src = "gooddata-*-client/README.md"

[[tool.tbump.file]]
# clients user agent
src="gooddata-*-client/gooddata_*_client/api_client.py"
src = "gooddata-*-client/gooddata_*_client/api_client.py"

[[tool.tbump.file]]
# clients config
src="gooddata-*-client/gooddata_*_client/configuration.py"
src = "gooddata-*-client/gooddata_*_client/configuration.py"

[[tool.tbump.file]]
# clients __init__.py
src="gooddata-*-client/gooddata_*_client/__init__.py"
src = "gooddata-*-client/gooddata_*_client/__init__.py"

[[tool.tbump.file]]
# clients generator configs
src=".openapi-generator/configs/gooddata-*-client.yaml"
src = ".openapi-generator/configs/gooddata-*-client.yaml"

[[tool.tbump.file]]
src="gooddata-sdk/setup.py"
search='"Documentation": "https://gooddata-sdk.readthedocs.io/en/v{current_version}"'
src = "gooddata-sdk/setup.py"
search = '"Documentation": "https://gooddata-sdk.readthedocs.io/en/v{current_version}"'

[[tool.tbump.file]]
src="gooddata-pandas/setup.py"
search='"Documentation": "https://gooddata-pandas.readthedocs.io/en/v{current_version}"'
src = "gooddata-pandas/setup.py"
search = '"Documentation": "https://gooddata-pandas.readthedocs.io/en/v{current_version}"'

[[tool.tbump.file]]
src="gooddata-fdw/setup.py"
search='"Documentation": "https://gooddata-fdw.readthedocs.io/en/v{current_version}"'
src = "gooddata-fdw/setup.py"
search = '"Documentation": "https://gooddata-fdw.readthedocs.io/en/v{current_version}"'

# You can specify a list of commands to
# run after the files have been patched
Expand Down

0 comments on commit d4021e2

Please sign in to comment.