Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/scripts/Invoke-WslBash.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT

# Runs a bash script inside the pinned WSL guest.
#
# Piping script text to `wsl.exe` from Windows PowerShell 5.1 is unreliable:
Expand Down
20 changes: 15 additions & 5 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# PSScriptAnalyzer configuration for the repo's PowerShell scripts
# (install.ps1, scripts/*.ps1). Used by the prek hook and CI.
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT

# PSScriptAnalyzer configuration for the repo's PowerShell scripts: every tracked
# .ps1 file, as listed by `git ls-files '*.ps1'` in xtask/src/powershell.rs
# (today install.ps1 and .github/scripts/Invoke-WslBash.ps1). Used by the prek
# hook and CI.
#
# Only .ps1 files are linted. The licence-header check (licenserc.toml) also
# covers .psm1 and .psd1, so a module or data file added later gets a header but
# no analyzer pass until the xtask and the hook's `files:` pattern are extended.
@{
# Enforce the full default rule set at Warning and Error severity.
Severity = @('Error', 'Warning')

# install.ps1 and the acceptance/packaging scripts are user-facing console
# programs where `Write-Host` is the intended way to print progress to the
# terminal, so the "avoid Write-Host" rule does not apply here.
# install.ps1 is a user-facing console program where `Write-Host` is the
# intended way to print progress to the terminal, so the "avoid Write-Host"
# rule does not apply here.
ExcludeRules = @('PSAvoidUsingWriteHost')
}
4 changes: 4 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT

param(
[Parameter(Position = 0)]
[string] $Channel = $env:ROCM_CLI_CHANNEL,
Expand Down
20 changes: 20 additions & 0 deletions licenserc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
## folder is vendored verbatim into the amd/skills catalog, whose skills carry
## no headers. The licence is stated in the skill's own skill-card.md instead.

## The header text is a template rendered per file. PowerShell files get an ASCII
## `(c)` instead of the copyright sign: a file with any non-ASCII byte needs a
## BOM, and install.ps1 cannot have one because a BOM breaks `irm ... | iex`. The
## other PowerShell files follow so the whole family reads the same.
[header]
text = """
{% if attrs.filename is endingwith(".ps1") or attrs.filename is endingwith(".psm1") or attrs.filename is endingwith(".psd1") -%}
Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
{%- else -%}
Copyright © Advanced Micro Devices, Inc., or its affiliates.
{%- endif %}

SPDX-License-Identifier: MIT
"""
Expand All @@ -21,6 +29,9 @@ includes = [
"**/*.py",
"**/*.sh",
"**/*.md",
"**/*.ps1",
Comment thread
siloteemu marked this conversation as resolved.
Resolved
"**/*.psm1",
"**/*.psd1",
]

excludes = [
Expand All @@ -35,3 +46,12 @@ excludes = [
[[rules]]
extensions = ["md"]
style_out = "xml"

## hawkeye has no built-in comment syntax for PowerShell: without this rule a
## .ps1/.psm1/.psd1 file is reported `unsupported` and silently skipped (exit 0),
## so `includes` alone would not enforce anything. Only `hawkeye check
## --fail-on-unknown` turns that into a failure, and neither the CI job nor the
## prek hook passes the flag.
[[rules]]
extensions = ["ps1", "psm1", "psd1"]
style_out = "script"
Loading