Skip to content

Commit

Permalink
fix: python linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Roald Nefs <info@roaldnefs.com>
  • Loading branch information
roaldnefs committed Jan 6, 2023
1 parent bf864ec commit d4fdd30
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ disable=
missing-docstring,
invalid-name,
unused-argument,
no-self-use,
useless-object-inheritance,
too-many-instance-attributes,
too-few-public-methods,
Expand All @@ -17,3 +16,4 @@ disable=
dangerous-default-value,
import-error,
fixme,
consider-using-f-string,
2 changes: 1 addition & 1 deletion saltlint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, options={}):

# Read the file contents
if os.path.exists(file):
with open(file, 'r') as f:
with open(file, 'r', encoding="UTF-8") as f:
content = f.read()
else:
content = None
Expand Down
20 changes: 10 additions & 10 deletions saltlint/formatters/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
class Formatter(BaseFormatter):

def format(self, problem):
formatstr = u"{0} {1}\n{2}:{3}\n{4}\n"
formatstr = "{0} {1}\n{2}:{3}\n{4}\n"

color = self.get_colors(self.colored)
return formatstr.format(
u'{0}[{1}]{2}'.format(color['RED'], problem.rule.id,
color['ENDC']),
u'{0}{1}{2}'.format(color['LIGHT_RED'], problem.message,
color['ENDC']),
u'{0}{1}{2}'.format(color['BLUE'], problem.filename,
color['ENDC']),
u'{0}{1}{2}'.format(color['CYAN'], str(problem.linenumber),
color['ENDC']),
u'{0}{1}{2}'.format(color['MAGENTA'], problem.line, color['ENDC'])
'{0}[{1}]{2}'.format(color['RED'], problem.rule.id,
color['ENDC']),
'{0}{1}{2}'.format(color['LIGHT_RED'], problem.message,
color['ENDC']),
'{0}{1}{2}'.format(color['BLUE'], problem.filename,
color['ENDC']),
'{0}{1}{2}'.format(color['CYAN'], str(problem.linenumber),
color['ENDC']),
'{0}{1}{2}'.format(color['MAGENTA'], problem.line, color['ENDC'])
)
24 changes: 12 additions & 12 deletions saltlint/formatters/severity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
class SeverityFormatter(BaseFormatter):

def format(self, problem):
formatstr = u"{0} {sev} {1}\n{2}:{3}\n{4}\n"
formatstr = "{0} {sev} {1}\n{2}:{3}\n{4}\n"

color = self.get_colors(self.colored)
return formatstr.format(
u'{0}[{1}]{2}'.format(color['RED'], problem.rule.id,
color['ENDC']),
u'{0}{1}{2}'.format(color['LIGHT_RED'], problem.message,
color['ENDC']),
u'{0}{1}{2}'.format(color['BLUE'], problem.filename,
color['ENDC']),
u'{0}{1}{2}'.format(color['CYAN'], str(problem.linenumber),
color['ENDC']),
u'{0}{1}{2}'.format(color['MAGENTA'], problem.line, color['ENDC']),
sev=u'{0}[{1}]{2}'.format(color['RED'], problem.rule.severity,
color['ENDC'])
'{0}[{1}]{2}'.format(color['RED'], problem.rule.id,
color['ENDC']),
'{0}{1}{2}'.format(color['LIGHT_RED'], problem.message,
color['ENDC']),
'{0}{1}{2}'.format(color['BLUE'], problem.filename,
color['ENDC']),
'{0}{1}{2}'.format(color['CYAN'], str(problem.linenumber),
color['ENDC']),
'{0}{1}{2}'.format(color['MAGENTA'], problem.line, color['ENDC']),
sev='{0}[{1}]{2}'.format(color['RED'], problem.rule.severity,
color['ENDC'])
)
2 changes: 1 addition & 1 deletion saltlint/linter/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def __init__(self, linenumber, line, filename, rule, message=None):
self.message = message or rule.shortdesc

def __repr__(self):
formatstr = u"[{0}] ({1}) matched {2}:{3} {4}"
formatstr = "[{0}] ({1}) matched {2}:{3} {4}"
return formatstr.format(self.rule.id, self.message,
self.filename, self.linenumber, self.line)
48 changes: 24 additions & 24 deletions saltlint/rules/NoIrregularSpacesRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ class NoIrregularSpacesRule(Rule):
version_added = 'v0.1.0'

irregular_spaces = [
u"\u000B", # Line Tabulation (\v) - <VT>
u"\u000C", # Form Feed (\f) - <FF>
u"\u00A0", # No-Break Space - <NBSP>
u"\u0085", # Next Line
u"\u1680", # Ogham Space Mark
u"\u180E", # Mongolian Vowel Separator - <MVS>
u"\uFEFF", # Zero Width No-Break Space - <BOM>
u"\u2000", # En Quad
u"\u2001", # Em Quad
u"\u2002", # En Space - <ENSP>
u"\u2003", # Em Space - <EMSP>
u"\u2004", # Tree-Per-Em
u"\u2005", # Four-Per-Em
u"\u2006", # Six-Per-Em
u"\u2007", # Figure Space
u"\u2008", # Punctuation Space - <PUNCSP>
u"\u2009", # Thin Space
u"\u200A", # Hair Space
u"\u200B", # Zero Width Space - <ZWSP>
u"\u2028", # Line Separator
u"\u2029", # Paragraph Separator
u"\u202F", # Narrow No-Break Space
u"\u205F", # Medium Mathematical Space
u"\u3000", # Ideographic Space
"\u000B", # Line Tabulation (\v) - <VT>
"\u000C", # Form Feed (\f) - <FF>
"\u00A0", # No-Break Space - <NBSP>
"\u0085", # Next Line
"\u1680", # Ogham Space Mark
"\u180E", # Mongolian Vowel Separator - <MVS>
"\uFEFF", # Zero Width No-Break Space - <BOM>
"\u2000", # En Quad
"\u2001", # Em Quad
"\u2002", # En Space - <ENSP>
"\u2003", # Em Space - <EMSP>
"\u2004", # Tree-Per-Em
"\u2005", # Four-Per-Em
"\u2006", # Six-Per-Em
"\u2007", # Figure Space
"\u2008", # Punctuation Space - <PUNCSP>
"\u2009", # Thin Space
"\u200A", # Hair Space
"\u200B", # Zero Width Space - <ZWSP>
"\u2028", # Line Separator
"\u2029", # Paragraph Separator
"\u202F", # Narrow No-Break Space
"\u205F", # Medium Mathematical Space
"\u3000", # Ideographic Space
]

def match(self, file, line):
Expand Down

0 comments on commit d4fdd30

Please sign in to comment.