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 8619096 commit ff0236fCopy full SHA for ff0236f
1 file changed
palvelutarjotin/tests/test_pre_commit_ruff_version.py
@@ -4,13 +4,16 @@
4
r"rev: v(\d+(\.\d+)+)\s*# ruff-pre-commit version"
5
)
6
7
+RUFF_VERSION_DEV_REQS_REGEX = re.compile(r"^ruff==(\d+(\.\d+)+)\s*\S$")
8
+
9
10
def get_ruff_version_from_dev_requirements() -> str | None:
11
with open("./requirements-dev.txt") as file:
12
dev_requirements = file.read()
13
for line in dev_requirements.splitlines():
- if line.startswith("ruff=="):
- return line.split("==")[1].strip()
14
+ match = RUFF_VERSION_DEV_REQS_REGEX.search(line)
15
+ if match:
16
+ return match.group(1)
17
return None
18
19
0 commit comments