Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandezcuesta committed Sep 23, 2024
1 parent d4f7174 commit 00330c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions yamllint/rules/key_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def check(conf, token, prev, next, nextnext, context):
# This check is done because KeyTokens can be found inside flow
# sequences... strange, but allowed.
if len(context['stack']) > 0 and context['stack'][-1].type == MAP:
if next.value not in conf['ignored']:
if any(strcoll(next.value, key) < 0
for key in context['stack'][-1].keys):
yield LintProblem(
next.start_mark.line + 1, next.start_mark.column + 1,
f'wrong ordering of key "{next.value}" in mapping')
else:
context['stack'][-1].keys.append(next.value)
if any(strcoll(next.value, key) < 0
for key in context['stack'][-1].keys
if key not in conf['ignored']):
yield LintProblem(
next.start_mark.line + 1, next.start_mark.column + 1,
f'wrong ordering of key "{next.value}" in mapping')
else:
context['stack'][-1].keys.append(next.value)

0 comments on commit 00330c0

Please sign in to comment.