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
18 changes: 18 additions & 0 deletions .github/actions-config/.linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
dirs:
- ./
#baseUrl: https://example.com
# ignorePatterns:
# - pattern: '^https://example.com/skip/.*$'
# - pattern: "^(ftp)://[^\\s/$?#]*\\.[^\\s]*$"
# replacementPatterns:
# - pattern: "(https?://example.com)/(\\w+)/(\\d+)"
# replacement: '$1/id/$3'
# - pattern: "\\[([^\\]]+)\\]\\((https?://example.com)/file\\)"
# replacement: '<a href="$2/file">$1</a>'
aliveStatusCodes:
- 200
- 201
- 204
useGitIgnore: true
modifiedFilesOnly: false
35 changes: 35 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#

###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 900 # Line length 80 is far too short
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading

#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The inline comment contradicts the setting: blank_lines: false disables the blank_lines tag/rules, but the comment says it will error on blank lines. Update the comment (or the value) so the config is self-explanatory.

Suggested change
blank_lines: false # Error on blank lines
blank_lines: false # Disable rules related to blank lines

Copilot uses AI. Check for mistakes.
6 changes: 6 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
rules:
line-length:
max: 900
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: false
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

With YAML validation enabled, yamllint's default truthy rule typically flags GitHub Actions' on: keys unless they're quoted/disabled (you already handle this in wiki-sync.yml). Consider disabling the truthy rule in this repo-level .yaml-lint.yml so workflows like code-review.yml/code-test.yml don't need per-file suppressions.

Suggested change
allow-non-breakable-inline-mappings: false
allow-non-breakable-inline-mappings: false
truthy: disable

Copilot uses AI. Check for mistakes.
56 changes: 56 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Code Review - Linting & Link Checks

on:
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This repo already suppresses yamllint's truthy rule for GitHub Actions triggers (see .github/workflows/wiki-sync.yml line 4) so that on: isn't flagged. Since this workflow will be linted too, add the same # yamllint disable-line rule:truthy (or quote the key) to prevent the YAML linter from failing on on:.

Suggested change
on:
on: # yamllint disable-line rule:truthy

Copilot uses AI. Check for mistakes.
pull_request:
branches:
- main
workflow_dispatch: {}

jobs:
lint:
name: Lint code base
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run github/super-linter
uses: super-linter/super-linter@v7.3.0
env:
# Lint all code - disabled in as part of #262
VALIDATE_ALL_CODEBASE: false
# Need to define main branch as default is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The following linter types will be enabled:
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
VALIDATE_YAML: true
#YAMLLINT_CONFIG_FILE: .github/linters/.yamllint.yml
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This commented config path looks incorrect (.github/linters/.yamllint.yml), but the repo adds .github/linters/.yaml-lint.yml. Even though it's commented out, leaving the wrong path here is misleading when someone later enables it—update it to the actual config filename/path used in this repo.

Suggested change
#YAMLLINT_CONFIG_FILE: .github/linters/.yamllint.yml
#YAMLLINT_CONFIG_FILE: .github/linters/.yaml-lint.yml

Copilot uses AI. Check for mistakes.
#VALIDATE_EDITORCONFIG: true
# Disable errors to only generate a report
#DISABLE_ERRORS: true

markdown-link-check:
name: Markdown Link Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@master
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

actions/checkout@master is a floating ref and can change unexpectedly (and is inconsistent with the v4 usage above). Pin this to a stable major tag (e.g. actions/checkout@v4) to avoid workflow breakages and supply-chain risk.

Suggested change
uses: actions/checkout@master
uses: actions/checkout@v4

Copilot uses AI. Check for mistakes.
with:
fetch-depth: 0

- name: Run linkspector
uses: umbrelladocs/action-linkspector@v1.3.4
with:
github_token: ${{ secrets.github_token }}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

secrets.github_token is not the standard built-in token name and is likely undefined (secrets are case-sensitive). For this action input, use the built-in ${{ secrets.GITHUB_TOKEN }} or ${{ github.token }} so the workflow can authenticate reliably.

Suggested change
github_token: ${{ secrets.github_token }}
github_token: ${{ secrets.GITHUB_TOKEN }}

Copilot uses AI. Check for mistakes.
reporter: github-pr-review
fail_on_error: true
config_file: ".github/actions-config/.linkspector.yml"
25 changes: 11 additions & 14 deletions 1-Collect/Get-AzureServices.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
BeforeAll {
$scriptPath = "$PSScriptRoot\Get-AzureServices.ps1"
$script:scriptContent = Get-Content $scriptPath -Raw
}

Describe "Get-AzureServices.ps1 Tests" {
Context "Parameter Validation" {
It "Should accept valid scopeType values" {
$validScopes = @('singleSubscription', 'resourceGroup', 'multiSubscription')

# Parse the script to check parameter validation
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'ValidateSet.*singleSubscription.*resourceGroup.*multiSubscription'

# Verify each scope is present in the script's ValidateSet
foreach ($scope in $validScopes) {
$script:scriptContent | Should -Match $scope
}
}

It "Should have required parameters defined" {
$scriptAst = [System.Management.Automation.Language.Parser]::ParseFile($scriptPath, [ref]$null, [ref]$null)
$params = $scriptAst.FindAll({$args[0] -is [System.Management.Automation.Language.ParameterAst]}, $true)

$paramNames = $params | ForEach-Object { $_.Name.VariablePath.UserPath }
$paramNames | Should -Contain 'scopeType'
$paramNames | Should -Contain 'fullOutputFile'
$paramNames | Should -Contain 'summaryOutputFile'
}

It "Should have default values for output files" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'fullOutputFile.*=.*"resources.json"'
$scriptContent | Should -Match 'summaryOutputFile.*=.*"summary.json"'
$script:scriptContent | Should -Match 'fullOutputFile.*=.*"resources.json"'
$script:scriptContent | Should -Match 'summaryOutputFile.*=.*"summary.json"'
}
}

Context "Function Definitions" {
It "Should define Get-Property function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Get-Property'
$script:scriptContent | Should -Match 'Function Get-Property'
}

It "Should define Get-SingleData function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Get-SingleData'
$script:scriptContent | Should -Match 'Function Get-SingleData'
}

It "Should define Get-Method function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Get-Method'
$script:scriptContent | Should -Match 'Function Get-Method'
}
}

Expand Down
47 changes: 23 additions & 24 deletions 1-Collect/Get-RessourcesFromAM.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
BeforeAll {
$scriptPath = "$PSScriptRoot\Get-RessourcesFromAM.ps1"
$script:scriptContent = Get-Content $scriptPath -Raw
}

Describe "Get-RessourcesFromAM.ps1 Tests" {
Context "Parameter Validation" {
It "Should require filePath parameter" {
$scriptAst = [System.Management.Automation.Language.Parser]::ParseFile($scriptPath, [ref]$null, [ref]$null)
$params = $scriptAst.FindAll({$args[0] -is [System.Management.Automation.Language.ParameterAst]}, $true)

$params = $scriptAst.FindAll({ $args[0] -is [System.Management.Automation.Language.ParameterAst] }, $true)
$filePathParam = $params | Where-Object { $_.Name.VariablePath.UserPath -eq 'filePath' }
$filePathParam | Should -Not -BeNullOrEmpty

# Check if parameter is mandatory
$isMandatory = $filePathParam.Attributes | Where-Object {
$_.TypeName.Name -eq 'Parameter' -and
$isMandatory = $filePathParam.Attributes | Where-Object {
$_.TypeName.Name -eq 'Parameter' -and
$_.NamedArguments.ArgumentName -contains 'Mandatory'
}
$isMandatory | Should -Not -BeNullOrEmpty
}

It "Should have default output file" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'outputFile.*=.*".*summary\.json"'
}
}

Context "Excel File Processing" {
It "Should check for Excel file existence" {
Mock Test-Path { return $false }

# Test would validate file existence check

$true | Should -Be $true
}

Expand All @@ -44,31 +43,31 @@ Describe "Get-RessourcesFromAM.ps1 Tests" {
It "Should convert Premium disk SKU correctly" {
$testSku = "Premium SSD P30"
$expected = "Premium_LRS"

$result = switch -Wildcard ($testSku) {
"PremiumV2*" { "PremiumV2_LRS"; break }
"Premium*" { "Premium_LRS"; break }
"StandardSSD*" { "StandardSSD_LRS"; break }
"Standard*" { "Standard_LRS"; break }
"Ultra*" { "UltraSSD_LRS"; break }
default { "Unknown" }
"PremiumV2*" { "PremiumV2_LRS"; break }
"Premium*" { "Premium_LRS"; break }
"StandardSSD*" { "StandardSSD_LRS"; break }
"Standard*" { "Standard_LRS"; break }
"Ultra*" { "UltraSSD_LRS"; break }
default { "Unknown" }
}

$result | Should -Be $expected
}

It "Should convert StandardSSD disk SKU correctly" {
$testSku = "StandardSSD E10"

$result = switch -Wildcard ($testSku) {
"PremiumV2*" { "PremiumV2_LRS"; break }
"Premium*" { "Premium_LRS"; break }
"StandardSSD*" { "StandardSSD_LRS"; break }
"Standard*" { "Standard_LRS"; break }
"Ultra*" { "UltraSSD_LRS"; break }
default { "Unknown" }
"PremiumV2*" { "PremiumV2_LRS"; break }
"Premium*" { "Premium_LRS"; break }
"StandardSSD*" { "StandardSSD_LRS"; break }
"Standard*" { "Standard_LRS"; break }
"Ultra*" { "UltraSSD_LRS"; break }
default { "Unknown" }
}

$result | Should -Be "StandardSSD_LRS"
}
}
Expand Down
11 changes: 2 additions & 9 deletions 2-AvailabilityCheck/Get-AvailabilityInformation.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
BeforeAll {
$scriptPath = "$PSScriptRoot\Get-AvailabilityInformation.ps1"
$script:scriptContent = Get-Content $scriptPath -Raw
}

Describe "Get-AvailabilityInformation.ps1 Tests" {
Context "Function Definitions" {
It "Should define Out-JSONFile function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'function Out-JSONFile'
}

It "Should define Convert-LocationsToRegionCodes function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Convert-LocationsToRegionCodes'
$scriptContent | Should -Match 'Function Convert-LocationsToRegionCode'
}

It "Should define Import-Provider function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Import-Provider'
}

It "Should define Import-Region function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'function Import-Region'
}

It "Should define Get-Property function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Get-Property'
}

It "Should define Expand-NestedCollection function" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'Function Expand-NestedCollection'
}
}

Context "Logic Validation" {
It "Should have region map creation logic" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'RegionMap'
}

It "Should have SKU availability checking logic" {
$scriptContent = Get-Content $scriptPath -Raw
$scriptContent | Should -Match 'available'
}
}
Expand Down
Loading
Loading