Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 81ed1bc

Browse files
committed
build: add ruff linter
1 parent af86117 commit 81ed1bc

File tree

7 files changed

+65
-71
lines changed

7 files changed

+65
-71
lines changed

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ venv.bak/
110110

111111
# macOSX
112112
.DS_Store
113+
114+
# ruff
115+
.ruff_cache

‎commitizen/commands/init.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from commitizen.git import get_latest_tag_name, get_tag_names, smart_open
1616
from commitizen.version_types import VERSION_TYPES
1717

18+
1819
class ProjectInfo:
1920
"""Discover information about the current folder."""
2021

@@ -67,6 +68,7 @@ def tags(self) -> Optional[List]:
6768
def is_pre_commit_installed(self) -> bool:
6869
return shutil.which("pre-commit") is not None
6970

71+
7072
class Init:
7173
def __init__(self, config: BaseConfig, *args):
7274
self.config: BaseConfig = config

‎poetry.lock‎

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ version_files = [
77
".pre-commit-config.yaml:rev:.+Commitizen"
88
]
99

10-
[tool.black]
11-
line-length = 88
12-
include = '\.pyi?$'
13-
exclude = '''
14-
/(
15-
\.git
16-
| \.hg
17-
| \.mypy_cache
18-
| \.tox
19-
| \.venv
20-
| _build
21-
| buck-out
22-
| build
23-
| dist
24-
# The following are specific to Black, you probably don't want those.
25-
| blib2to3
26-
| tests/data
27-
| profiling
28-
)/
29-
'''
30-
3110
[tool.poetry]
3211
name = "commitizen"
3312
version = "2.42.1"
@@ -81,9 +60,8 @@ pytest-regressions = "^2.4.0"
8160
pytest-freezer = "^0.4.6"
8261
# code formatter
8362
black = "^22.10"
84-
isort = "^5.10.0"
8563
# linter
86-
flake8 = "^3.6"
64+
ruff = "^0.0.262"
8765
pre-commit = "^2.6.0"
8866
mypy = "^0.931"
8967
types-PyYAML = "^5.4.3"
@@ -112,10 +90,6 @@ pep621 = "commitizen.providers:Pep621Provider"
11290
poetry = "commitizen.providers:PoetryProvider"
11391
scm = "commitizen.providers:ScmProvider"
11492

115-
[tool.isort]
116-
profile = "black"
117-
known_first_party = ["commitizen", "tests"]
118-
11993
[tool.coverage]
12094
[tool.coverage.report]
12195
show_missing = true
@@ -138,6 +112,7 @@ known_first_party = ["commitizen", "tests"]
138112
omit = [
139113
'env/*',
140114
'venv/*',
115+
'.venv/*',
141116
'*/virtualenv/*',
142117
'*/virtualenvs/*',
143118
'*/tests/*'
@@ -146,3 +121,30 @@ known_first_party = ["commitizen", "tests"]
146121
[build-system]
147122
requires = ["poetry_core>=1.0.0"]
148123
build-backend = "poetry.core.masonry.api"
124+
125+
[tool.pytest.ini_options]
126+
addopts = "--strict-markers"
127+
128+
[tool.ruff]
129+
line-length = 88
130+
ignore = [
131+
"E501",
132+
"D1",
133+
"D415",
134+
]
135+
136+
[tool.ruff.isort]
137+
known-first-party = ["commitizen", "tests"]
138+
139+
[tool.ruff.pydocstyle]
140+
convention = "google"
141+
142+
[tool.mypy]
143+
files = "commitizen"
144+
ignore_missing_imports = true
145+
disallow_untyped_decorators = true
146+
disallow_subclassing_any = true
147+
warn_return_any = true
148+
warn_redundant_casts = true
149+
warn_unused_ignores = true
150+
warn_unused_configs = true

‎scripts/format‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export PREFIX="poetry run python -m "
55

66
set -x
77

8-
${PREFIX}isort commitizen tests
8+
# ${PREFIX}isort commitizen tests
9+
${PREFIX}ruff commitizen tests --fix
910
${PREFIX}black commitizen tests

‎scripts/test‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ export REGEX='^(?![.]|venv).*'
66

77
${PREFIX}pytest -n 3 --dist=loadfile --cov-report term-missing --cov-report=xml:coverage.xml --cov=commitizen tests/
88
${PREFIX}black commitizen tests --check
9-
${PREFIX}isort --check-only commitizen tests
10-
${PREFIX}flake8 commitizen/ tests/
9+
${PREFIX}ruff commitizen/ tests/
1110
${PREFIX}mypy commitizen/ tests/
12-
${PREFIX}pydocstyle --convention=google --add-ignore=D1,D415 --match-dir='"${REGEX}"'
1311
${PREFIX}commitizen -nr 3 check --rev-range origin/master..

‎setup.cfg‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /