From c2ed1b0942740cf6a6d061f1a058245d31490521 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 15:13:10 -0500 Subject: [PATCH 01/10] pre-commit: only run uncrustify if changed files are detected This adds the "no-run-if-empty" flag to the xargs invocation. Otherwise, if git diff names no files, the command is run once with no agument specified which leads to running on a default list of files that appears to include ignored files and files in submodules. I am uneasy about how this works (it means that `pre-commit run --all` doesn't actually check all files) but that's a separate issue. --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f7fc8c12a..aa6bda102c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,6 @@ repos: language: system - id: formatting name: Formatting - entry: sh -c "git diff --staged --name-only | xargs python3 tools/codeformat.py" + entry: sh -c "git diff --staged --name-only | xargs -r python3 tools/codeformat.py" types_or: [c, python] language: system From cc1dd73e942ed8a5d335391e3bb6dc206576d993 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 15:32:26 -0500 Subject: [PATCH 02/10] pre-commit: Have pre-commit pass the list of files to codeformat.py --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa6bda102c..a6ad210f7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,6 @@ repos: language: system - id: formatting name: Formatting - entry: sh -c "git diff --staged --name-only | xargs -r python3 tools/codeformat.py" + entry: python3 tools/codeformat.py types_or: [c, python] language: system From d0e3848b24fcc058a1c23b3f8236a7b21992ece5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 17:25:15 -0500 Subject: [PATCH 03/10] codeformat: Exclude specified files even from commandline, for pre-commit --- tools/codeformat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/codeformat.py b/tools/codeformat.py index 389bda8772..eef4682be0 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -142,7 +142,7 @@ def main(): # Expand the globs passed on the command line, or use the default globs above. files = [] if args.files: - files = list_files(args.files) + files = list_files(args.files, EXCLUSIONS) else: files = list_files(PATHS, EXCLUSIONS, TOP) From ed61e8955d37bf4780c04130f05302d85314ef1b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 17:53:18 -0500 Subject: [PATCH 04/10] codeformat: require filenames, filter them by include/exclude lists --- tools/codeformat.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/codeformat.py b/tools/codeformat.py index eef4682be0..fb2a94e49b 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -27,6 +27,7 @@ import argparse import glob +import fnmatch import itertools import os import re @@ -75,12 +76,13 @@ C_EXTS = (".c", ".h") PY_EXTS = (".py",) -def list_files(paths, exclusions=None, prefix=""): +def list_files(args, paths, exclusions=None, prefix=""): files = set() + args = [os.path.join(prefix, arg) for arg in args] for pattern in paths: - files.update(glob.glob(os.path.join(prefix, pattern), recursive=True)) + files.update(fnmatch.filter(args, os.path.join(prefix, pattern))) for pattern in exclusions or []: - files.difference_update(glob.fnmatch.filter(files, os.path.join(prefix, pattern))) + files.difference_update(fnmatch.filter(files, os.path.join(prefix, pattern))) return sorted(files) @@ -128,23 +130,19 @@ def fixup_c(filename): def main(): - cmd_parser = argparse.ArgumentParser(description="Auto-format C and Python files.") + cmd_parser = argparse.ArgumentParser(description="Auto-format C and Python files -- to be used via pre-commit only.") cmd_parser.add_argument("-c", action="store_true", help="Format C code only") cmd_parser.add_argument("-p", action="store_true", help="Format Python code only") cmd_parser.add_argument("-v", action="store_true", help="Enable verbose output") - cmd_parser.add_argument("files", nargs="*", help="Run on specific globs") + cmd_parser.add_argument("files", nargs="+", help="Run on specific globs") args = cmd_parser.parse_args() # Setting only one of -c or -p disables the other. If both or neither are set, then do both. format_c = args.c or not args.p format_py = args.p or not args.c - # Expand the globs passed on the command line, or use the default globs above. - files = [] - if args.files: - files = list_files(args.files, EXCLUSIONS) - else: - files = list_files(PATHS, EXCLUSIONS, TOP) + # Expand the arguments passed on the command line, subject to the PATHS and EXCLUSIONS + files = list_files(args.files, PATHS, EXCLUSIONS, TOP) # Extract files matching a specific language. def lang_files(exts): From 0403a2cca59ed24c0a71486e29d701220e8c4cf7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 17:53:49 -0500 Subject: [PATCH 05/10] codeformat: Run sed only on requested files When running from pre-commit, we believe the different invocations of sed were racing with each other, sometimes leaving zero-byte files in the filesystem (ow) --- tools/codeformat.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/codeformat.py b/tools/codeformat.py index fb2a94e49b..e9615ae560 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -167,10 +167,7 @@ def main(): for file in lang_files(C_EXTS): fixup_c(file) # Revert "// |" back to "//|" - subprocess.call( - "find shared-bindings ports/*/bindings -name '*.c' -exec sed -i 's/\/ |/\/|/' {} \;", - shell=True, - ) + batch(["sed", "-i", "s,^// |,//|,"], lang_files(C_EXTS)) # Format Python files with black. if format_py: From 253385d9b76cf364808e88b9b84b94d5bf22ef7b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 18:07:51 -0500 Subject: [PATCH 06/10] codeformat: use pathlib for correct(-er) processing of * vs ** in globs --- tools/codeformat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/codeformat.py b/tools/codeformat.py index e9615ae560..141ad71124 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -30,6 +30,7 @@ import glob import fnmatch import itertools import os +import pathlib import re import subprocess @@ -80,7 +81,7 @@ def list_files(args, paths, exclusions=None, prefix=""): files = set() args = [os.path.join(prefix, arg) for arg in args] for pattern in paths: - files.update(fnmatch.filter(args, os.path.join(prefix, pattern))) + files.update(arg for arg in args if pathlib.Path(arg).match(pattern)) for pattern in exclusions or []: files.difference_update(fnmatch.filter(files, os.path.join(prefix, pattern))) return sorted(files) From d3bf1fe15dd3720d6566e061a0d315add550b248 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 18:11:00 -0500 Subject: [PATCH 07/10] modifications by pre-commit --- ports/atmel-samd/eic_handler.c | 46 ++++++++++++++++---------------- ports/atmel-samd/fatfs_port.c | 8 +++--- ports/atmel-samd/ld_defines.c | 24 ++++++++--------- ports/atmel-samd/mpconfigport.h | 10 +++---- ports/atmel-samd/mphalport.c | 8 +++--- ports/atmel-samd/mphalport.h | 2 +- ports/atmel-samd/timer_handler.c | 22 +++++++-------- ports/cxd56/background.c | 9 ++++--- 8 files changed, 66 insertions(+), 63 deletions(-) diff --git a/ports/atmel-samd/eic_handler.c b/ports/atmel-samd/eic_handler.c index 7f26bdefbf..226dafc765 100644 --- a/ports/atmel-samd/eic_handler.c +++ b/ports/atmel-samd/eic_handler.c @@ -29,7 +29,7 @@ #include "common-hal/rotaryio/IncrementalEncoder.h" #include "common-hal/countio/Counter.h" #include "shared-bindings/microcontroller/__init__.h" -//#include "samd/external_interrupts.h" +// #include "samd/external_interrupts.h" #include "eic_handler.h" // Which handler should be called for a particular channel? @@ -42,31 +42,31 @@ void set_eic_handler(uint8_t channel, uint8_t eic_handler) { void shared_eic_handler(uint8_t channel) { uint8_t handler = eic_channel_handler[channel]; switch (handler) { -#if CIRCUITPY_PULSEIO - case EIC_HANDLER_PULSEIN: - pulsein_interrupt_handler(channel); - break; -#endif + #if CIRCUITPY_PULSEIO + case EIC_HANDLER_PULSEIN: + pulsein_interrupt_handler(channel); + break; + #endif -#if CIRCUITPY_PS2IO - case EIC_HANDLER_PS2: - ps2_interrupt_handler(channel); - break; -#endif + #if CIRCUITPY_PS2IO + case EIC_HANDLER_PS2: + ps2_interrupt_handler(channel); + break; + #endif -#if CIRCUITPY_ROTARYIO - case EIC_HANDLER_INCREMENTAL_ENCODER: - incrementalencoder_interrupt_handler(channel); - break; -#endif + #if CIRCUITPY_ROTARYIO + case EIC_HANDLER_INCREMENTAL_ENCODER: + incrementalencoder_interrupt_handler(channel); + break; + #endif -#if CIRCUITPY_COUNTIO - case EIC_HANDLER_COUNTER: - counter_interrupt_handler(channel); - break; -#endif + #if CIRCUITPY_COUNTIO + case EIC_HANDLER_COUNTER: + counter_interrupt_handler(channel); + break; + #endif - default: - break; + default: + break; } } diff --git a/ports/atmel-samd/fatfs_port.c b/ports/atmel-samd/fatfs_port.c index c65a73a428..e6eee20495 100644 --- a/ports/atmel-samd/fatfs_port.c +++ b/ports/atmel-samd/fatfs_port.c @@ -35,14 +35,14 @@ #endif DWORD get_fattime(void) { -#if CIRCUITPY_RTC + #if CIRCUITPY_RTC timeutils_struct_time_t tm; common_hal_rtc_get_time(&tm); return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) | - (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); -#else + (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); + #else return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2); -#endif + #endif } diff --git a/ports/atmel-samd/ld_defines.c b/ports/atmel-samd/ld_defines.c index 18f49d42c6..56e26d8dca 100644 --- a/ports/atmel-samd/ld_defines.c +++ b/ports/atmel-samd/ld_defines.c @@ -9,22 +9,22 @@ // The next line is a marker to start looking for definitions. Lines above the next line are ignored. // START_LD_DEFINES -/*RAM_SIZE=*/ RAM_SIZE; -/*FLASH_SIZE=*/ FLASH_SIZE; +/*RAM_SIZE=*/ RAM_SIZE; +/*FLASH_SIZE=*/ FLASH_SIZE; -/*BOOTLOADER_SIZE=*/ BOOTLOADER_SIZE; -/*BOOTLOADER_START_ADDR=*/ BOOTLOADER_START_ADDR; +/*BOOTLOADER_SIZE=*/ BOOTLOADER_SIZE; +/*BOOTLOADER_START_ADDR=*/ BOOTLOADER_START_ADDR; -/*CIRCUITPY_DEFAULT_STACK_SIZE=*/ CIRCUITPY_DEFAULT_STACK_SIZE; +/*CIRCUITPY_DEFAULT_STACK_SIZE=*/ CIRCUITPY_DEFAULT_STACK_SIZE; -/*CIRCUITPY_FIRMWARE_START_ADDR=*/ CIRCUITPY_FIRMWARE_START_ADDR; -/*CIRCUITPY_FIRMWARE_SIZE=*/ CIRCUITPY_FIRMWARE_SIZE; +/*CIRCUITPY_FIRMWARE_START_ADDR=*/ CIRCUITPY_FIRMWARE_START_ADDR; +/*CIRCUITPY_FIRMWARE_SIZE=*/ CIRCUITPY_FIRMWARE_SIZE; -/*CIRCUITPY_INTERNAL_CONFIG_START_ADDR=*/ CIRCUITPY_INTERNAL_CONFIG_START_ADDR; -/*CIRCUITPY_INTERNAL_CONFIG_SIZE=*/ CIRCUITPY_INTERNAL_CONFIG_SIZE; +/*CIRCUITPY_INTERNAL_CONFIG_START_ADDR=*/ CIRCUITPY_INTERNAL_CONFIG_START_ADDR; +/*CIRCUITPY_INTERNAL_CONFIG_SIZE=*/ CIRCUITPY_INTERNAL_CONFIG_SIZE; -/*CIRCUITPY_INTERNAL_NVM_START_ADDR=*/ CIRCUITPY_INTERNAL_NVM_START_ADDR; -/*CIRCUITPY_INTERNAL_NVM_SIZE=*/ CIRCUITPY_INTERNAL_NVM_SIZE; +/*CIRCUITPY_INTERNAL_NVM_START_ADDR=*/ CIRCUITPY_INTERNAL_NVM_START_ADDR; +/*CIRCUITPY_INTERNAL_NVM_SIZE=*/ CIRCUITPY_INTERNAL_NVM_SIZE; /*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR; -/*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE; +/*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE; diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index d2a529485e..c66ab99ab2 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -38,7 +38,7 @@ // HMCRAMC0_SIZE is defined in the ASF4 include files for each SAMD21 chip. #define RAM_SIZE HMCRAMC0_SIZE -#define BOOTLOADER_SIZE (8*1024) +#define BOOTLOADER_SIZE (8 * 1024) #define CIRCUITPY_MCU_FAMILY samd21 #define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21" #define SPI_FLASH_MAX_BAUDRATE 8000000 @@ -67,7 +67,7 @@ // HSRAM_SIZE is defined in the ASF4 include files for each SAM_D5X_E5X chip. #define RAM_SIZE HSRAM_SIZE -#define BOOTLOADER_SIZE (16*1024) +#define BOOTLOADER_SIZE (16 * 1024) #define CIRCUITPY_MCU_FAMILY samd51 #ifdef SAMD51 #define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51" @@ -96,7 +96,7 @@ #ifdef SAMD21 #if INTERNAL_FLASH_FILESYSTEM -#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (64*1024) +#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (64 * 1024) #else #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (0) #endif @@ -131,7 +131,7 @@ #endif #ifndef CIRCUITPY_DEFAULT_STACK_SIZE -#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024) +#define CIRCUITPY_DEFAULT_STACK_SIZE (24 * 1024) #endif #ifndef SAMD5x_E5x_BOD33_LEVEL @@ -148,7 +148,7 @@ // If CIRCUITPY is internal, use half of flash for it. #if INTERNAL_FLASH_FILESYSTEM #ifndef CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE - #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (FLASH_SIZE/2) + #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (FLASH_SIZE / 2) #endif #else #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (0) diff --git a/ports/atmel-samd/mphalport.c b/ports/atmel-samd/mphalport.c index b497b89cd8..5ebce1a857 100644 --- a/ports/atmel-samd/mphalport.c +++ b/ports/atmel-samd/mphalport.c @@ -56,15 +56,15 @@ extern uint32_t common_hal_mcu_processor_get_frequency(void); // Testing done at 48 MHz on SAMD21 and 120 MHz on SAMD51, multiplication and division cancel out. // But get the frequency just in case. #ifdef SAMD21 -#define DELAY_LOOP_ITERATIONS_PER_US ( (10U*48000000U) / common_hal_mcu_processor_get_frequency()) +#define DELAY_LOOP_ITERATIONS_PER_US ((10U * 48000000U) / common_hal_mcu_processor_get_frequency()) #endif #ifdef SAM_D5X_E5X -#define DELAY_LOOP_ITERATIONS_PER_US ( (30U*120000000U) / common_hal_mcu_processor_get_frequency()) +#define DELAY_LOOP_ITERATIONS_PER_US ((30U * 120000000U) / common_hal_mcu_processor_get_frequency()) #endif void mp_hal_delay_us(mp_uint_t delay) { - for (uint32_t i = delay*DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) { - asm volatile("nop"); + for (uint32_t i = delay * DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) { + asm volatile ("nop"); } } diff --git a/ports/atmel-samd/mphalport.h b/ports/atmel-samd/mphalport.h index adc65ade53..8b9b7fd14c 100644 --- a/ports/atmel-samd/mphalport.h +++ b/ports/atmel-samd/mphalport.h @@ -34,7 +34,7 @@ #include "supervisor/shared/tick.h" // Global millisecond tick count (driven by SysTick interrupt). -#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32()) +#define mp_hal_ticks_ms() ((mp_uint_t)supervisor_ticks_ms32()) // Number of bytes in receive buffer extern volatile uint8_t usb_rx_count; diff --git a/ports/atmel-samd/timer_handler.c b/ports/atmel-samd/timer_handler.c index 16d65334e0..eab9311d6a 100644 --- a/ports/atmel-samd/timer_handler.c +++ b/ports/atmel-samd/timer_handler.c @@ -49,31 +49,31 @@ void shared_timer_handler(bool is_tc, uint8_t index) { // Make sure to add the handler #define to timer_handler.h if (is_tc) { uint8_t handler = tc_handler[index]; - switch(handler) { + switch (handler) { case TC_HANDLER_PULSEIN: - #if CIRCUITPY_PULSEIO + #if CIRCUITPY_PULSEIO pulsein_timer_interrupt_handler(index); - #endif + #endif break; case TC_HANDLER_PULSEOUT: - #if CIRCUITPY_PULSEIO + #if CIRCUITPY_PULSEIO pulseout_interrupt_handler(index); - #endif + #endif break; case TC_HANDLER_PEW: - #if CIRCUITPY_PEW + #if CIRCUITPY_PEW pewpew_interrupt_handler(index); - #endif + #endif break; case TC_HANDLER_FREQUENCYIN: - #if CIRCUITPY_FREQUENCYIO + #if CIRCUITPY_FREQUENCYIO frequencyin_interrupt_handler(index); - #endif + #endif break; case TC_HANDLER_RGBMATRIX: - #if CIRCUITPY_RGBMATRIX + #if CIRCUITPY_RGBMATRIX _PM_IRQ_HANDLER(); - #endif + #endif break; default: break; diff --git a/ports/cxd56/background.c b/ports/cxd56/background.c index 6de6d7275b..644a5d7b0b 100644 --- a/ports/cxd56/background.c +++ b/ports/cxd56/background.c @@ -30,6 +30,9 @@ #include "supervisor/filesystem.h" #include "supervisor/shared/stack.h" -void port_background_task(void) {} -void port_start_background_task(void) {} -void port_finish_background_task(void) {} +void port_background_task(void) { +} +void port_start_background_task(void) { +} +void port_finish_background_task(void) { +} From b9a973c8e0f7287874d56ce043ed814a823b53ed Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 19:22:48 -0500 Subject: [PATCH 08/10] codeformat: Do search&replace without sed --- tools/codeformat.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/codeformat.py b/tools/codeformat.py index 141ad71124..58c5a8e39f 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -99,6 +99,10 @@ def fixup_c(filename): # Get next line. l = lines.pop(0) + # Revert "// |" back to "//| " + if l.startswith("// |"): + l = "//|" + l[4:] + # Dedent #'s to match indent of following line (not previous line). m = re.match(r"( +)#(if |ifdef |ifndef |elif |else|endif)", l) if m: @@ -167,8 +171,6 @@ def main(): batch(command, lang_files(C_EXTS)) for file in lang_files(C_EXTS): fixup_c(file) - # Revert "// |" back to "//|" - batch(["sed", "-i", "s,^// |,//|,"], lang_files(C_EXTS)) # Format Python files with black. if format_py: From 3963031ef926e0a0156a94a079d82ee4e3a38081 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 19:30:53 -0500 Subject: [PATCH 09/10] cursory documentation of pre-commit --- BUILDING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 10d7d8f4af..4738d13500 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -85,3 +85,21 @@ Example: If your port/build includes `arm-none-eabi-gdb-py`, consider using it instead, as it can be used for better register debugging with https://github.com/bnahill/PyCortexMDebug + +# Code Quality Checks + +We apply code quality checks using pre-commit. Install pre-commit once per system with + + python3 -mpip install pre-commit + +Activate it once per git clone with + + pre-commit --install + +Pre-commit also requires some additional programs to be installed through your package manager: + + * Standard Unix tools such as make, find, etc + * The gettext package, any modern version + * uncrustify version 0.71 (0.72 is also tested) + +Some pre-commit quality checks require your active attention to resolve, others (such as the formatting checks of uncrustify) are made automatically and must simply be incorporated into your code changes by committing them. From 1af6aa25ce5f2c7258d5316bc8c9f310c0374706 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Mar 2021 19:32:40 -0500 Subject: [PATCH 10/10] ok it would be nice to know how to run it --- BUILDING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 4738d13500..256996807d 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -102,4 +102,6 @@ Pre-commit also requires some additional programs to be installed through your p * The gettext package, any modern version * uncrustify version 0.71 (0.72 is also tested) +Each time you create a git commit, the pre-commit quality checks will be run. You can also run them e.g., with `pre-commit run foo.c` or `pre-commit run --all` to run on all files whether modified or not. + Some pre-commit quality checks require your active attention to resolve, others (such as the formatting checks of uncrustify) are made automatically and must simply be incorporated into your code changes by committing them.