-
Notifications
You must be signed in to change notification settings - Fork 448
Description
Issue overview
We're often wasting CI cycles on minor stuff like improper clang-formatting, or license checks.
There are also a few things we're not catching that often bothers me while I'm diffing things (eg: trailing whitespaces in IDF / IDD files)
I think it'd be an improvement to provide a pre-commit hook that would catch these locally.
I'm specifically talking about pre-commit.com, not just a git hook. A side benefit is that this would run only on changes files instead of trying to do it for the entire repo (another benefit is that it'd handle parallelization already: pre-commit passes chunks of filenames to multiple processes)
While at it, we should modernize the python scripts, add an argument parser, etc, making it so you can either pass specific files or just default to the old behavior of running for the entire repo.
the custom checks are listed here:
EnergyPlus/scripts/dev/custom_check.sh
Lines 18 to 37 in a4c9dbe
# would be really nice to create a minimal library for our own testing to unify all the common stuff | |
# like walking directories, etc. | |
echo "Running Custom-Check: license-check"; python3 "$REPO_ROOT"/scripts/dev/license-check.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_stray_fields_in_idd"; python3 "$REPO_ROOT"/scripts/dev/check_stray_fields_in_idd.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: verify_idfs_in_cmake"; python3 "$REPO_ROOT"/scripts/dev/verify_idfs_in_cmake.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_non_utf8"; python3 "$REPO_ROOT"/scripts/dev/check_non_utf8.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: verify_file_encodings"; python3 "$REPO_ROOT"/scripts/dev/verify_file_encodings.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: validate_idd_units"; python3 "$REPO_ROOT"/scripts/dev/validate_idd_units.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: find_byref_bool_override"; python3 "$REPO_ROOT"/scripts/dev/find_byref_bool_override.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_tabs"; python3 "$REPO_ROOT"/scripts/dev/check_for_tabs.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_bom_in_idfs"; python3 "$REPO_ROOT"/scripts/dev/check_for_bom_in_idfs.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: verify_cmake_dirs"; python3 "$REPO_ROOT"/scripts/dev/verify_cmake_dirs.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: find_included_cc_files"; python3 "$REPO_ROOT"/scripts/dev/find_included_cc_files.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: analyze_state"; python3 "$REPO_ROOT"/scripts/dev/analyze_state.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_c_style_comments"; python3 "$REPO_ROOT"/scripts/dev/check_for_c_style_comments.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_constexpr"; python3 "$REPO_ROOT"/scripts/dev/check_constexpr.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_switch_case_parentheses"; python3 "$REPO_ROOT"/scripts/dev/check_for_switch_case_parentheses.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_malformed_enums"; python3 "$REPO_ROOT"/scripts/dev/check_for_malformed_enums.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_format_strings"; python3 "$REPO_ROOT"/scripts/dev/check_format_strings.py || EXIT_STATUS=$? | |
echo "Running Custom-Check: check_for_enum_scope_usage"; python3 "$REPO_ROOT"/scripts/dev/check_for_enum_scope_usage.py || EXIT_STATUS=$? |
Operating System (Multiple choices)
Any
Operating System Version
N/A
Version of EnergyPlus
25.2.0
Unmethours link or helpdesk ticket number
N/A
Defect file
No response