Skip to content

Commit

Permalink
fix octal rule for time format
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasmhughes authored and roaldnefs committed Jan 6, 2023
1 parent 7fecc8f commit cc6e617
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion saltlint/rules/YamlHasOctalValueRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class YamlHasOctalValueRule(Rule):
tags = ['formatting']
version_added = 'v0.0.6'

bracket_regex = re.compile(r"^[^:]+:\s{0,}0[0-9]{1,}\s{0,}((?={#)|(?=#)|(?=$))")
bracket_regex = re.compile(r"^.*(?:\s|[^\d]{2}:)0\d+(?:[\s#{]|$)")

def match(self, file, line):
return self.bracket_regex.search(line)
13 changes: 12 additions & 1 deletion tests/unit/TestYamlHasOctalValueRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,20 @@
# MAC addresses shouldn't be matched, for more information see:
# https://github.com/warpnet/salt-lint/issues/202
infoblox_remove_record:
infoblox_remove_record1:
infoblox_host_record.absent:
- mac: 4c:f2:d3:1b:2e:05
infoblox_remove_record2:
infoblox_host_record.absent:
- mac: 05:f2:d3:1b:2e:4c
# Time values should not trigger this rule
some_calendar_entry:
file.managed:
- name: /tmp/my_unit_file
- contents: |
OnCalendar=Sun 18:00
'''

BAD_NUMBER_STATE = '''
Expand Down

0 comments on commit cc6e617

Please sign in to comment.