Skip to content

Commit e7ae26b

Browse files
authored
allow "Repeat n times" (#567)
1 parent 4510c82 commit e7ae26b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/lint/rules/algorithm-line-style.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,13 @@ export default function (
151151
if (stepSeq.items.length === 1 && initialText === 'Repeat,') {
152152
return;
153153
}
154+
if (/ times:$/.test(finalText)) {
155+
return;
156+
}
154157
if (!/^Repeat, (?:while|until) /.test(initialText)) {
155158
report({
156159
ruleId,
157-
message: `expected "Repeat" to start with "Repeat, while " or "Repeat, until "`,
160+
message: `expected "Repeat" to look like "Repeat _n_ times:", "Repeat, while ..." or "Repeat, until ..."`,
158161
...locate(first.location.start.offset),
159162
});
160163
}

test/lint-algorithms.js

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ describe('linting algorithms', () => {
248248
1. Substep.
249249
1. Repeat,
250250
1. Substep.
251+
1. Repeat _x_ times:
252+
1. Substep.
251253
1. Repeat, while foo,
252254
1. Substep.
253255
1. Repeat, until foo,

0 commit comments

Comments
 (0)