Skip to content

Commit

Permalink
add regex for alternate typo of onchanges (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasmhughes authored Dec 16, 2022
1 parent 42669e8 commit 71c6e78
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion saltlint/rules/TypoOnchangesRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ class TypoOnchangesRule(TypographicalErrorRule):
shortdesc = '"onchange" looks like a typo. Did you mean "onchanges"?'
description = '"onchange" looks like a typo. Did you mean "onchanges"?'
version_added = 'v0.6.0'
regex = re.compile(r"^\s+- onchange(|_in|_any):")
regex = re.compile(r"^\s+- (on_?change(|_in|_any)|on_changes(|_in|_any)):")
16 changes: 15 additions & 1 deletion tests/unit/TestTypoOnchangesRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
- onchange_any:
- yetanotherfile
- onemorefile
- on_change:
- otherfile
- on_change_in:
- anotherfile
- on_change_any:
- yetanotherfile
- onemorefile
- on_changes:
- otherfile
- on_changes_in:
- anotherfile
- on_changes_any:
- yetanotherfile
- onemorefile
'''

class TestTypoOnchangesRule(unittest.TestCase):
Expand All @@ -56,4 +70,4 @@ def test_statement_positive(self):

def test_statement_negative(self):
results = self.runner.run_state(BAD_ONCHANGES_LINE)
self.assertEqual(3, len(results))
self.assertEqual(9, len(results))

0 comments on commit 71c6e78

Please sign in to comment.