Skip to content

Commit

Permalink
.github: run lint_inline_asm in CI (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
riptl authored Mar 31, 2022
1 parent f5b5491 commit f6b6cfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jobs:
name: website
path: out/website

- name: Lint inline ASM
run: python -m mkwutil.tools.lint_inline_asm --pretty ./source/**/*.c*

publish:
runs-on: ubuntu-20.04
needs: [build_windows]
Expand Down
10 changes: 6 additions & 4 deletions mkwutil/tools/lint_inline_asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def _print_line(self, source: Source, lint: LintViolation, line: int):
cprint(line_str)


def get_lint_formatter():
if os.isatty(sys.stdout.fileno()):
colorama.init()
def get_lint_formatter(pretty, ugly):
if (pretty or os.isatty(sys.stdout.fileno())) and not ugly:
colorama.init(strip=False)
return LintPrettyFormatter()
else:
return LintBasicFormatter()
Expand All @@ -160,6 +160,8 @@ def get_lint_formatter():
def main():
parser = argparse.ArgumentParser()
parser.add_argument("file", type=str, nargs="+", help="File paths to lint")
parser.add_argument("--short", action="store_true", help="Short output")
parser.add_argument("--pretty", action="store_true", help="Force enable color")
args = parser.parse_args()

dol = read_dol()
Expand All @@ -181,7 +183,7 @@ def main():
SdataAbsoluteRule,
Sdata2AbsoluteRule(dol),
]
formatter = get_lint_formatter()
formatter = get_lint_formatter(args.pretty, args.short)
for source_path in source_paths:
source = Source(source_path)
for linter in linters:
Expand Down

0 comments on commit f6b6cfa

Please sign in to comment.