Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SC2086 and SC2206 to shellcheck ignore list #170

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/scripts/pr_check
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class CheckResult:


class BashChecker:

EXCLUDE_CODES = [1091, 2010, 2011, 2013, 2126]
EXCLUDE_CODES = [1091, 2010, 2011, 2013, 2086, 2126, 2206]

def __init__(self, df: DiffFile):
self._diff_file = df
Expand All @@ -63,8 +62,7 @@ class BashChecker:
line = error["line"]
msg = error["message"]
code = error["code"]
result.errors.append(
f"{file}:{line} - {msg}, refer to {SC_BASE_URL}{code}")
result.errors.append(f"{file}:{line} - {msg}, refer to {SC_BASE_URL}{code}")

return result

Expand Down Expand Up @@ -93,8 +91,7 @@ class CChecker:
if not int(errors) and not int(warnings):
return None

fix_file = Path(
f"{self._diff_file.Dpath}.EXPERIMENTAL-checkpatch-fixes")
fix_file = Path(f"{self._diff_file.Dpath}.EXPERIMENTAL-checkpatch-fixes")
if fix_file.exists():
result.fixes.extend(fix_file.read_text().split("\n"))

Expand All @@ -107,15 +104,17 @@ def new_checker(df: DiffFile):

if df.Dpath.endswith(".sh") and df.Dtype in ["A", "M"]:
return BashChecker(df)
elif df.Dtype in ["A", "M"] and (df.Dpath.endswith(".c") or df.Dpath.endswith(".h")):
elif df.Dtype in ["A", "M"] and (
df.Dpath.endswith(".c") or df.Dpath.endswith(".h")
):
return CChecker(df)


class DiffText:
def __init__(self, dt: list):
self._file_list = [DiffFile(i) for i in dt]

@ classmethod
@classmethod
def load_diff(cls, diff_from, diff_to):
cmd = f"git diff --name-status {diff_from}..{diff_to}"
code, output = sp.getstatusoutput(cmd)
Expand Down
Loading