Use allow list in verible formatter script For now it contains only files unchanged by the formatter. Signed-off-by: Rafal Kapuscik <rkapuscik@antmicro.com>
diff --git a/util/verible-format-allowlist.txt b/util/verible-format-allowlist.txt new file mode 100644 index 0000000..8e19380 --- /dev/null +++ b/util/verible-format-allowlist.txt
@@ -0,0 +1,18 @@ +# Copyright lowRISC contributors. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 +# +# This is a list of files to be passed to Verible formatter +# by calling verible-format.sh + +hw/ip/adc_ctrl/dv/tests/adc_ctrl_test_pkg.sv +hw/ip/adc_ctrl/dv/env/adc_ctrl_env_pkg.sv +hw/ip/gpio/dv/tests/gpio_test_pkg.sv +hw/ip/adc_ctrl/dv/env/seq_lib/adc_ctrl_vseq_list.sv +hw/ip/adc_ctrl/dv/env/seq_lib/adc_ctrl_smoke_vseq.sv +hw/ip/prim_xilinx/rtl/prim_xilinx_buf.sv +hw/ip/pwm/dv/tests/pwm_test_pkg.sv +hw/ip/pwm/dv/env/pwm_env_pkg.sv +hw/ip/pwm/dv/env/seq_lib/pwm_smoke_vseq.sv +hw/ip/pwm/dv/env/seq_lib/pwm_vseq_list.sv +hw/ip/gpio/dv/env/seq_lib/gpio_vseq_list.sv
diff --git a/util/verible-format.sh b/util/verible-format.sh index c6c9f7f..e739842 100755 --- a/util/verible-format.sh +++ b/util/verible-format.sh
@@ -22,7 +22,7 @@ --port_declarations_indentation=indent \ --inplace" -if [ -z $VERIBLE_VERSION ]; then +if [[ -z $VERIBLE_VERSION ]]; then echo "verible-verilog-format either not installed or not visible in PATH" exit 1 fi @@ -31,13 +31,31 @@ # overwriting of uncomitted changes git add -u -# get all system verilog files and pipe through style formatter -find . -type f -name "*.sv" -o -name "*.svh" | \ - xargs -n 1 -P $NUM_PROCS verible-verilog-format \ - $VERIBLE_ARGS +# By default format only files in allow list +MODE=${MODE:-allowlist} + +case $MODE in + allowlist) + FILES_TO_FORMAT=`grep -v '^#' util/verible-format-allowlist.txt` + ;; + + all) + # get all system verilog files and pipe through style formatter + FILES_TO_FORMAT=`find . -type f -name "*.sv" -o -name "*.svh"` + ;; + + *) + echo "verible-format.sh: Unknown mode $MODE" + exit 1 + ;; +esac + +echo $FILES_TO_FORMAT | \ + xargs -n 1 -P $NUM_PROCS verible-verilog-format \ + $VERIBLE_ARGS -echo "Usign verible-verilog-format version $VERIBLE_VERSION" > $REPORT_FILE +echo "Using verible-verilog-format version $VERIBLE_VERSION" > $REPORT_FILE # report changed files git status | \