diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e71e8b33..c3b78ec11 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -91,7 +91,9 @@ repos: name: license header check (hawkeye) entry: hawkeye check --config licenserc.toml language: system - types_or: [rust, python, shell] + # One tag per extension family in licenserc.toml's `includes`; a type + # missing here means an edit touching only that type never runs the hook. + types_or: [rust, python, shell, powershell, markdown] pass_filenames: false groups: [local-tools] # runs in the dedicated `license-headers` CI job (hawkeye action) diff --git a/install.ps1 b/install.ps1 index 0b42c2800..c325e36a6 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,3 +1,17 @@ +# Copyright © Advanced Micro Devices, Inc., or its affiliates. +# +# SPDX-License-Identifier: MIT + +# This file must stay BOM-less, so the "add a BOM" rule is suppressed for it. +# The documented install path is `irm | iex`, which hands the parser a +# string rather than a file: a byte order mark survives into that string, the +# parser glues it onto the first token, and the param() block below silently +# stops being the script's first statement. All nine parameters then vanish, +# with zero parse errors to show for it. The cost of staying BOM-less is that +# Windows PowerShell 5.1 decodes this file as the ANSI codepage and renders the +# © above as mojibake -- a cosmetic blemish in a comment, which is the cheaper +# of the two failures. Do not "fix" this by adding a BOM. +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(Position = 0)] [string] $Channel = $env:ROCM_CLI_CHANNEL, diff --git a/licenserc.toml b/licenserc.toml index 1e42e442c..c692e2fdc 100644 --- a/licenserc.toml +++ b/licenserc.toml @@ -15,6 +15,7 @@ includes = [ "**/*.py", "**/*.sh", "**/*.md", + "**/*.ps1", ] excludes = [ @@ -27,3 +28,10 @@ excludes = [ [[rules]] extensions = ["md"] style_out = "xml" + +## hawkeye has no built-in comment syntax for .ps1: without this rule the file is +## reported `unsupported` and silently skipped (exit 0), so `includes` alone would +## not enforce anything. +[[rules]] +extensions = ["ps1"] +style_out = "script"