Skip to content

🩹 [Patch]: Add test to check that script files have [CmdletBinding()] #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 14, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
fix linting issues
  • Loading branch information
MariusStorhaug committed Apr 14, 2024
commit e6a8be109f0b2ec90a04a0bf033fc0397d04fcbc
9 changes: 4 additions & 5 deletions scripts/tests/PSModule/SourceCode.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ Param(
)

BeforeAll {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
'PSUseDeclaredVarsMoreThanAssignments', '',
Justification = 'scriptFiles is used in the test.'
)]
$scriptFiles = Get-ChildItem -Path $Path -Filter '*.ps1' -Recurse -File
$functionFiles = Get-ChildItem -Directory -Path $Path |
Where-Object { $_.Name -in 'public', 'private' } |
Get-ChildItem -Filter '*.ps1' -File

Write-Verbose "Found $($scriptFiles.Count) script files in $Path"
Write-Verbose "Found $($functionFiles.Count) function files in $Path"
}

Describe 'PSModule - SourceCode tests' {
Expand Down Expand Up @@ -89,7 +88,7 @@ Describe 'PSModule - SourceCode tests' {
# It 'has synopsis for all functions' {}
# It 'has description for all functions' {}
# It 'has examples for all functions' {}

It 'should have [CmdletBinding()] attribute' {
$issues = @('')
$functionFiles | ForEach-Object {
Expand Down