From 8df446c03714b9066c9ded5c96f15949cf1397c4 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 20 Nov 2024 21:06:56 -0600 Subject: [PATCH] Switch to using the latest Perl::Tidy (version 20240903). This commit just makes the changes in the scripts, but does not yet run perltidy with the new setup. That will be done in the next commit. A new `--valign-signed-numbers` option has been added in the version of Perl::Tidy and is the default. That option has been disabled to reduce the number of code changes. Although it only changes one line of the webwork2 code. It changes a lot more in the pg code. Note that the `bin/dev_scripts/run-perltidy.pl` script now insists on this specific version of perltidy instead of this version or newer. This is because every time a new version of perltidy comes out, it changes things. So developers really need to be using the same version or it will not be consistent with the github workflow result. Also, the version requirement in the check_modules.pl script has been removed. Only developers need a specific version of perltidy. Those running webwork2 can use other versions. This is only used for formatting problems in the PG problem editor, and using other versions may result in slightly different formatting there, but that is not so consequential that we need to require a specific version. Note that this change depends on the corresponding pg pull request, because in that pull request the `-vxl='q'` option has been removed. Otherwise version 20220613 or newer of perltidy would still be needed. --- .github/workflows/check-formats.yml | 2 +- .perltidyrc | 43 +++++++++++++++-------------- bin/dev_scripts/run-perltidy.pl | 5 ++-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/check-formats.yml b/.github/workflows/check-formats.yml index e94ca09ae2..092dabe309 100644 --- a/.github/workflows/check-formats.yml +++ b/.github/workflows/check-formats.yml @@ -20,7 +20,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install dependencies - run: cpanm -n Perl::Tidy@20220613 + run: cpanm -n Perl::Tidy@20240903 - name: Run perltidy shell: bash run: | diff --git a/.perltidyrc b/.perltidyrc index 4620751c6f..c9423a890d 100644 --- a/.perltidyrc +++ b/.perltidyrc @@ -1,23 +1,24 @@ # PBP .perltidyrc file --l=120 # Max line width is 120 cols --et=4 # Use tabs instead of spaces. --i=4 # Indent level is 4 cols --ci=4 # Continuation indent is 4 cols --b # Write the file inline and create a .bak file --vt=0 # Minimal vertical tightness --cti=0 # No extra indentation for closing brackets --pt=2 # Maximum parenthesis tightness --bt=1 # Medium brace tightness --sbt=1 # Medium square bracket tightness --bbt=1 # Medium block brace tightness --nsfs # No space before semicolons --nolq # Don't outdent long quoted strings --mbl=1 # Do not allow multiple empty lines --ce # Cuddled else --cb # Cuddled blocks --nbbc # Do not add blank lines before full length comments --nbot # No line break on ternary --nlop # No logical padding (this causes mixed tabs and spaces) --wn # Weld nested containers --xci # Extended continuation indentation +-l=120 # Max line width is 120 cols +-et=4 # Use tabs instead of spaces. +-i=4 # Indent level is 4 cols +-ci=4 # Continuation indent is 4 cols +-b # Write the file inline and create a .bak file +-vt=0 # Minimal vertical tightness +-cti=0 # No extra indentation for closing brackets +-pt=2 # Maximum parenthesis tightness +-bt=1 # Medium brace tightness +-sbt=1 # Medium square bracket tightness +-bbt=1 # Medium block brace tightness +-nsfs # No space before semicolons +-nolq # Don't outdent long quoted strings +-mbl=1 # Do not allow multiple empty lines +-ce # Cuddled else +-cb # Cuddled blocks +-nbbc # Do not add blank lines before full length comments +-nbot # No line break on ternary +-nlop # No logical padding (this causes mixed tabs and spaces) +-wn # Weld nested containers +-xci # Extended continuation indentation -vxl='q' # No vertical alignment of qw quotes +-nvsn # No vertical alignment of signed numbers diff --git a/bin/dev_scripts/run-perltidy.pl b/bin/dev_scripts/run-perltidy.pl index 1c882f608f..70f60faece 100755 --- a/bin/dev_scripts/run-perltidy.pl +++ b/bin/dev_scripts/run-perltidy.pl @@ -63,9 +63,8 @@ =head1 OPTIONS my $webwork_root = curfile->dirname->dirname->dirname; -die "Version 20220613 or newer of perltidy is required for this script.\n" - . "The installed version is $Perl::Tidy::VERSION.\n" - unless $Perl::Tidy::VERSION >= 20220613; +die "Version 20240903 of perltidy is required for this script.\nThe installed version is $Perl::Tidy::VERSION.\n" + unless $Perl::Tidy::VERSION == 20240903; die "The .perltidyrc file in the webwork root directory is not readable.\n" unless -r "$webwork_root/.perltidyrc";