From 0baa7ab118b86453246610f717464e6dd6ac9811 Mon Sep 17 00:00:00 2001 From: Abe Kornelis Date: Fri, 15 May 2026 15:25:06 +0200 Subject: [PATCH 1/3] Create minimal linter --- .gitignore | 1 + bat/BLDJAR.BAT | 9 +++++++++ bat/GetCheckStyle.PS1 | 25 +++++++++++++++++++++++++ src/checkstyle.xml | 11 +++++++++++ 4 files changed, 46 insertions(+) create mode 100644 bat/GetCheckStyle.PS1 create mode 100644 src/checkstyle.xml diff --git a/.gitignore b/.gitignore index 53379f5ed..4498ed6ea 100644 --- a/.gitignore +++ b/.gitignore @@ -239,6 +239,7 @@ rt/test/save/ZSTRMAC2.[mM][lL][cC] **/*.[xX][lL][sS] **/*.[xX][lL][sS][xX] **/*.[xX][mM][lL] +!src/**/*.[xX][mM][lL] # Backup and junk files macold/ diff --git a/bat/BLDJAR.BAT b/bat/BLDJAR.BAT index bb8bae826..ab215bb5a 100644 --- a/bat/BLDJAR.BAT +++ b/bat/BLDJAR.BAT @@ -32,6 +32,15 @@ shift /1 goto opt_loop :options_ok +rem download linter jar +if not exist "build\checkstyle" mkdir build\checkstyle +if not exist "build\checkstyle\checkstyle-all.jar" powershell -NoProfile -ExecutionPolicy Bypass -File "bat\GetCheckStyle.ps1" +if not exist "build\checkstyle\checkstyle-all.jar" goto return || rem download must have failed - cannot continue + +rem run the linter +java -jar build\checkstyle\checkstyle-all.jar -c src\checkstyle.xml src +if %ERRORLEVEL% NEQ 0 goto return + rem prepare to compile java code and create jar file if not exist ".\jar\" mkdir jar cd jar diff --git a/bat/GetCheckStyle.PS1 b/bat/GetCheckStyle.PS1 new file mode 100644 index 000000000..1c1e077de --- /dev/null +++ b/bat/GetCheckStyle.PS1 @@ -0,0 +1,25 @@ +# Suppress Invoke-WebRequest's built-in progress bar +$ProgressPreference = 'SilentlyContinue' + +# Define source URI and target location in current repository clone +$uri = "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.21.4/checkstyle-10.21.4-all.jar" +$outFile = "build\checkstyle\checkstyle-all.jar" + +# Issue status message +Write-Host "Downloading linter from checkstyle repository on github.com..." + +# Define our own progress bar +Write-Progress -Activity "Download" -Status $uri -PercentComplete 0 + +# Download linter jar and report results +try { + Invoke-WebRequest -Uri $uri -OutFile $outFile -UseBasicParsing + Write-Progress -Activity "Download" -Completed + Write-Host "Download finished." + exit 0 +} +catch { + Write-Progress -Activity "Download" -Completed + Write-Host "Download failed: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} \ No newline at end of file diff --git a/src/checkstyle.xml b/src/checkstyle.xml new file mode 100644 index 000000000..e9846ab1a --- /dev/null +++ b/src/checkstyle.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file From 7aa42e3dca930c13d7c3c5e4c27a093053779fb9 Mon Sep 17 00:00:00 2001 From: Abe Kornelis Date: Sat, 16 May 2026 17:29:11 +0200 Subject: [PATCH 2/3] Remove unneeded imports from jave code --- src/az390.java | 2 -- src/mz390.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/az390.java b/src/az390.java index 13df17ab0..6b137f93f 100644 --- a/src/az390.java +++ b/src/az390.java @@ -20,8 +20,6 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; import java.io.RandomAccessFile; import java.lang.reflect.Array; import java.math.BigDecimal; diff --git a/src/mz390.java b/src/mz390.java index 1f3225333..0919a2f17 100644 --- a/src/mz390.java +++ b/src/mz390.java @@ -20,8 +20,6 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; import java.lang.reflect.Array; import java.text.SimpleDateFormat; import java.util.Arrays; From 57bf5981e564359d2fae42ba859f9a382ee86f75 Mon Sep 17 00:00:00 2001 From: Abe Kornelis Date: Sat, 23 May 2026 12:00:56 +0200 Subject: [PATCH 3/3] Extend CheckStyle config with initial set of real validations --- bat/BLDJAR.BAT | 1 + bat/GetCheckStyle.PS1 | 20 ++++++++++-- src/checkstyle.xml | 76 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/bat/BLDJAR.BAT b/bat/BLDJAR.BAT index ab215bb5a..f1247c5b7 100644 --- a/bat/BLDJAR.BAT +++ b/bat/BLDJAR.BAT @@ -36,6 +36,7 @@ rem download linter jar if not exist "build\checkstyle" mkdir build\checkstyle if not exist "build\checkstyle\checkstyle-all.jar" powershell -NoProfile -ExecutionPolicy Bypass -File "bat\GetCheckStyle.ps1" if not exist "build\checkstyle\checkstyle-all.jar" goto return || rem download must have failed - cannot continue +java -jar build\checkstyle\checkstyle-all.jar --version rem run the linter java -jar build\checkstyle\checkstyle-all.jar -c src\checkstyle.xml src diff --git a/bat/GetCheckStyle.PS1 b/bat/GetCheckStyle.PS1 index 1c1e077de..ef58cdd90 100644 --- a/bat/GetCheckStyle.PS1 +++ b/bat/GetCheckStyle.PS1 @@ -1,9 +1,22 @@ # Suppress Invoke-WebRequest's built-in progress bar $ProgressPreference = 'SilentlyContinue' -# Define source URI and target location in current repository clone -$uri = "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.21.4/checkstyle-10.21.4-all.jar" +# Request latest release information +$apiUrl = 'https://api.github.com/repos/checkstyle/checkstyle/releases/latest' +$release = Invoke-RestMethod -Uri $apiUrl -Headers @{ 'User-Agent' = 'z390-build' } + +# Tag is usually "checkstyle-13.4.2" +$tag = $release.tag_name + +$asset = $release.assets | Where-Object { $_.name -match '-all\.jar$' } | Select-Object -First 1 +if (-not $asset) { + Write-Host "No -all.jar asset found for $tag" -ForegroundColor Red + exit 1 +} + +$uri = $asset.browser_download_url $outFile = "build\checkstyle\checkstyle-all.jar" +$versionFile = 'build\checkstyle\version.txt' # Issue status message Write-Host "Downloading linter from checkstyle repository on github.com..." @@ -14,8 +27,9 @@ Write-Progress -Activity "Download" -Status $uri -PercentComplete 0 # Download linter jar and report results try { Invoke-WebRequest -Uri $uri -OutFile $outFile -UseBasicParsing + $tag | Set-Content -Path $versionFile -NoNewline Write-Progress -Activity "Download" -Completed - Write-Host "Download finished." + Write-Host "Download finished: $tag" exit 0 } catch { diff --git a/src/checkstyle.xml b/src/checkstyle.xml index e9846ab1a..47e8393d6 100644 --- a/src/checkstyle.xml +++ b/src/checkstyle.xml @@ -3,9 +3,81 @@ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file +