We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d8302b commit e5a7c1bCopy full SHA for e5a7c1b
1 file changed
palvelutarjotin/tests/test_pre_commit_ruff_version.py
@@ -3,14 +3,16 @@
3
RUFF_VERSION_PRE_COMMIT_REGEX = re.compile(
4
r"rev: v(\d+(\.\d+)+)\s*# ruff-pre-commit version"
5
)
6
+RUFF_VERSION_DEV_REQS_REGEX = re.compile(r"^ruff==(\d+(\.\d+)+)\s*\S$")
7
8
9
def get_ruff_version_from_dev_requirements() -> str | None:
10
with open("./requirements-dev.txt") as file:
11
dev_requirements = file.read()
12
for line in dev_requirements.splitlines():
- if line.startswith("ruff=="):
13
- return line.split("==")[1].strip()
+ match = RUFF_VERSION_DEV_REQS_REGEX.search(line)
14
+ if match:
15
+ return match.group(1)
16
return None
17
18
0 commit comments