Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Feb 18, 2018
1 parent 10edfa8 commit 4e2542e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions xiblint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main():
)
parser.add_argument("-v", "--version", action="version",
version=__version__)
parser.add_argument("--reporter", choices=("raw", "json"),
parser.add_argument("--reporter", choices=("raw", "json"),
default="raw",
help="custom reporter to use (optional)")
args = parser.parse_args()
Expand Down Expand Up @@ -61,7 +61,8 @@ def main():
print_errors(errors, reporter)

sys.exit(0 if errors.count == 0 else 1)



def process_file(file_path, checkers, reporter):
_, ext = os.path.splitext(file_path)
if ext.lower() not in [u".storyboard", u".xib"]:
Expand All @@ -72,14 +73,14 @@ def process_file(file_path, checkers, reporter):
checker(context)
return context.errors


def print_errors(errors, reporter):
if reporter == "raw":
for error_dict in errors:
print("{}:{}: error: {} [rule: {}]".format(error_dict["file"],
error_dict["line"],
error_dict["error"],
error_dict["rule"]
))
error_dict["rule"]))
elif reporter == "json":
print json.dumps(errors)

Expand Down
10 changes: 6 additions & 4 deletions xiblint/xibcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def error(self, element, message, *args):
"'{}': ".format(moniker) if moniker else '',
message.format(*args)
)
new_error_dict = {"file": self.path,
"line": element.line,
"error": new_error,
"rule": self.rule_name}
new_error_dict = {
"file": self.path,
"line": element.line,
"error": new_error,
"rule": self.rule_name
}

self.errors.append(new_error_dict)

0 comments on commit 4e2542e

Please sign in to comment.