Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions .github/workflows/ahk-lint-format-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v6

- name: Install AutoHotkey v1.1 (Portable)
run: choco install autohotkey.portable --version=1.1.37.02 -y
run: choco install autohotkey.portable --version=1.1.36.01 -y
shell: pwsh

- name: Install AutoHotkey v2
Expand All @@ -40,8 +40,8 @@ jobs:

- name: Syntax Check & Format Validation
run: |
$compilerV1 = "C:\ProgramData\chocolatey\lib\autohotkey.portable\tools\Compiler\Ahk2Exe.exe"
$compilerV2 = "$env:ProgramFiles\AutoHotkey\Compiler\Ahk2Exe.exe"
$ahk2Exe = "C:\ProgramData\chocolatey\lib\autohotkey.portable\tools\Compiler\Ahk2Exe.exe"
$ahkV2 = "$env:ProgramFiles\AutoHotkey\v2\AutoHotkey64.exe"
$tempDir = New-Item -Type Directory -Force "$env:TEMP\ahk-$(Get-Random)"
$syntaxErrors = @()
$formatIssues = @()
Expand All @@ -51,27 +51,32 @@ jobs:

Get-ChildItem -Recurse -Filter *.ahk | % {
$checked++
$rel = $_.FullName -replace [regex]::Escape("$(Get-Location)\"), ''
$rel = $_.FullName -replace [regex]::Escape("$(Get-Location)\"), ""

# Detect AHK version
$content = Get-Content $_.FullName -Raw -Encoding UTF8
$isV2 = $false

# Check for #Requires AutoHotkey v2 directive
if ($content -match '(?m)^#Requires\s+AutoHotkey\s+v2') {
if ($content -match "(?m)^#Requires\s+AutoHotkey\s+v2") {
$isV2 = $true
}
# Check for v2 directory paths (Lib/v2, ahk/, Other/**/v2/)
elseif ($rel -match '(Lib[\\/]v2[\\/]|ahk[\\/]|Other.*[\\/]v2[\\/])') {
elseif ($rel -match "(Lib[\\/]v2[\\/]|ahk[\\/]|Other.*[\\/]v2[\\/])") {
$isV2 = $true
}

$compiler = if ($isV2) { $compilerV2; $v2Count++ } else { $compilerV1; $v1Count++ }
$version = if ($isV2) { "v2" } else { "v1" }
if ($isV2) { $v2Count++ } else { $v1Count++ }

# Syntax check
$tempExe = Join-Path $tempDir "$([IO.Path]::GetRandomFileName()).exe"
& $compiler /in $_.FullName /out $tempExe 2>&1 | Out-Null

if ($isV2) {
& $ahk2Exe /in $_.FullName /out $tempExe /base $ahkV2 2>&1 | Out-Null
} else {
& $ahk2Exe /in $_.FullName /out $tempExe 2>&1 | Out-Null
}

if ($LASTEXITCODE -eq 0 -and (Test-Path $tempExe)) {
Write-Host "✓ $rel ($version)" -ForegroundColor Green
Expand All @@ -84,12 +89,12 @@ jobs:
# Format check
$content = Get-Content $_.FullName -Raw
$problems = @()
if (($content -match '(?m)^\t') -and ($content -match '(?m)^ ')) { $problems += 'mixed indent' }
if ($content -match '[ \t]+`r?`n') { $problems += 'trailing space' }
if (($content -match '`r`n') -and ($content -match '(?<!`r)`n')) { $problems += 'mixed line endings' }
if (($content -match "(?m)^\t") -and ($content -match "(?m)^ ")) { $problems += "mixed indent" }
if ($content -match "[ \t]+`r?`n") { $problems += "trailing space" }
if (($content -match "`r`n") -and ($content -match "(?<!`r)`n")) { $problems += "mixed line endings" }

if ($problems) {
Write-Host "⚠ $rel : $($problems -join ', ')" -ForegroundColor Yellow
Write-Host "⚠ $rel : $($problems -join ", ")" -ForegroundColor Yellow
$formatIssues += $rel
}
}
Expand Down
1 change: 1 addition & 0 deletions Other/Citra_mods/Citra_Mod_Manager.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (!InStr(A_AhkPath, "_UIA.exe")) {
#SingleInstance Force
#Warn ; Enable warnings to assist with detecting common errors.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetBatchLines, -1 ; Run as fast as possible.
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directive creates inconsistency with other legacy v1 scripts in the repository. The sibling script Citra_3DS_Manager.ahk (276 lines with similar file loops and GUI construction) does not use SetBatchLines. Similarly, all other v1 legacy scripts in Other/Downloader/ and Other/Citra_per_game_config/ omit this directive. For consistency across the legacy v1 codebase, consider removing this directive unless all legacy scripts adopt it.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance benefit of this directive is negligible for this script's workload. The script performs: (1) parsing a small CSV file (Destination.csv has only 5 lines), (2) enumerating folders from OneDrive (typically 1-20 game folders), and (3) constructing a simple GUI. These operations complete in milliseconds regardless of the batch line setting. The 10ms default delay only affects lines that execute repeatedly in tight loops, which don't exist in meaningful quantities here. Consider whether this optimization justifies the added complexity and departure from other legacy scripts' patterns.

Suggested change
SetBatchLines, -1 ; Run as fast as possible.

Copilot uses AI. Check for mistakes.
SetWorkingDir % A_ScriptDir ; Ensures a consistent starting directory.
Menu, Tray, Tip, Citra Mod Manager
EnvGet OneDrive, ONEDRIVE
Expand Down
Loading