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

各ファイル名がスネークケースであることをチェックできるようにする #546

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
10 changes: 10 additions & 0 deletions Script/CI/check_coding_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main():
check_operator_space_,
check_preprocessor_,
check_include_guard_,
check_filename_snakecase_,
]
check_funcs = []

Expand Down Expand Up @@ -678,6 +679,15 @@ def check_include_guard_(path: str, code_lines: list) -> bool:
return False


# True: path の basename がスネークケースである, False: 非スネークケース
def check_filename_snakecase_(path: str, _: list) -> bool:
basename = path.strip('/')[0]

re_snake_case = r'[a-z0-9]+[_[a-z0-9]+]*'

return (re.fullmatch(re_snake_case, basename) is not None)


# True: target が含まれる, False: なし
def is_contained_pattern_(line: str, target: str) -> bool:
pos = 0
Expand Down