Skip to content

Commit ced5486

Browse files
chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.16.0 (#449)
Co-authored-by: M.P. Korstanje <rien.korstanje@gmail.com>
1 parent 4be93a0 commit ced5486

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

python/.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.15.22
3+
rev: v0.16.0
44
hooks:
55
- id: ruff-check
66
args: [--fix]

python/src/cucumber_expressions/ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(
4646
end: int,
4747
):
4848
if nodes is None and token is None:
49-
raise Exception("Either nodes or token must be defined")
49+
raise ValueError("Either nodes or token must be defined")
5050
self._ast_type = ast_type
5151
self._nodes = nodes
5252
self._token = token

python/src/cucumber_expressions/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def rewrite_to_regex(self, node: Node):
4949
if node.ast_type == NodeType.EXPRESSION:
5050
return self.rewrite_expression(node)
5151
# Can't happen as long as the switch case is exhaustive
52-
raise Exception(node.ast_type)
52+
raise ValueError(node.ast_type)
5353

5454
@staticmethod
5555
def escape_regex(expression) -> str:

python/src/cucumber_expressions/expression_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def parse_token(
216216
if consumed:
217217
return Result(consumed, ast)
218218
# If configured correctly this will never happen
219-
raise Exception("No eligible parsers for " + str(tokens))
219+
raise ValueError("No eligible parsers for " + str(tokens))
220220

221221
def parse_tokens_until(
222222
self,
@@ -236,7 +236,7 @@ def parse_tokens_until(
236236
if result.consumed == 0:
237237
# If configured correctly this will never happen
238238
# Keep in order to avoid infinite loops
239-
raise Exception("No eligible parsers for " + str(tokens))
239+
raise ValueError("No eligible parsers for " + str(tokens))
240240
current += result.consumed
241241
ast.append(result.ast_node)
242242
return current - start_at, ast

python/src/cucumber_expressions/parameter_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _get_regexp_source(regexp_pattern: Pattern) -> str:
9393
)
9494
if invalid_flag.real in _regexp_flags:
9595
raise CucumberExpressionError(
96-
f"ParameterType Regexps can't use flag: {str(invalid_flag)}",
96+
f"ParameterType Regexps can't use flag: {invalid_flag!s}",
9797
)
9898
return regexp_pattern.pattern
9999

python/src/cucumber_expressions/tree_regexp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_group_builder(self, regexp):
3838
elif char == ")" and not escaping and not char_class:
3939
group_builder = stack.pop()
4040
if not group_builder:
41-
raise Exception("Empty stack!")
41+
raise ValueError("Empty stack!")
4242
group_start = group_start_stack.pop()
4343
group_start = group_start or 0
4444
if group_builder.capturing:

0 commit comments

Comments
 (0)