Prompts/GenXdev.Coding.PowerShell.Modules/Assert-CheckAllRequirements-script.txt

     Unit test failed for unit test: Get-SpotifyLyrics.should pass PSScriptAnalyzer rules
 
Primary task:
Improve scriptfile function '$CmdletName' in '$ScriptFileName'.
 
Secondary task:
Ensure compliance with these 22 requirements:
 
1) Do not change or remove any existing alias definitions for the function's
   parameters.
2) Check for obvious coding bugs, technical debt, and language spelling errors.
3) If no paramsetnames are used, and there are no positional attributes for
   parameters, but adding them would improve functionality, add them.
4) The file must start and end with a line containing 80 hash (#) characters.
5) Ensure the existence a simular line, with the right indent, with (#)
   characters all the way, up and including column #79, between each parameter(!)
   and function(!) you encounter.
6) Basic code style guids to follow for all other non-mentionables are those
   from the book:
7) Each parameter should have;
   - A line of hash (#) characters extending to column 79 above it
   - Parameter attributes vertically aligned, each on its own line:
        + Position (if applicable, never when [switch])
        + Mandatory (even if $false)
        + HelpMessage
        + Other attributes (ValueFromPipeline etc.)
   - Parameter name should match same casing as in help documentation
   - Switch parameters should always come last and never have a position set
8) Function '$CmdletName' must have begin {}, process(), and end() blocks.
   If a block is empty, do not add code comments.
9) Each line of code that is not trivially understandable must have a code
   comment above it in plain English without capital letters.
   Follow the guidelines from the book 'Code complete 2nd edition'
10) By reading only the code comments, one should fully understand what the
    code does and how it does it.
11) Use the latest best practices for PowerShell, .NET, Windows, or any other
    relevant API.
12) Fix any code-smell issues.
13) Use Write-Verbose to show essential informative messages without harming
    performance.
14) Always insert exactly one empty line after each opening curly brace
   { before starting the code block's contents. Do not insert empty lines
   before closing curly braces }. This provides clear visual separation of
   code blocks while keeping closures compact. The first line of actual code
   should always be preceded by one empty line after an opening brace.
15) Never place an empty line between a code comment and its referenced code
    line. And never commands on the same line, always above it.
16) Always place at least one empty line between each code line or code line
    and comment for a preceeding code line..
17) Treat this as a refactoring: do not add or rename parameters. Dependent
    code should remain working.You can NOT introduce different beheiviors,
    even if it are better code practices.
18) When refactoring, apply applicable parameter attributes without breaking
    dependencies:
    - Alias for alternative names
    - Mandatory to mark required parameters
    - Position to specify parameter positions
    - ParameterSetName for mutually exclusive parameters
    - ValueFromPipeline to accept pipeline input
    - ValueFromPipelineByPropertyName for pipeline properties
    - HelpMessage for parameter help
    - Validation attributes (ValidateNotNull, ValidateNotNullOrEmpty, etc.)
    - Allow attributes (AllowNull, AllowEmptyString, AllowEmptyCollection)
    - DontShow to hide parameters if needed
19) Prefer [System.IO] file routines above the standard PowerShell ones,
    never use [System.IO.Path]::GetFullPath use 'GenXdev.FileSystem\Expand-Path $somevar' instead!
20) function parameters start with Uppercase, internal variables start with
    lowercase, enforce this.
21) For readibility enforce that all code have new lines after '|' pipeline
    symbols, and after parameters using back-ticks ` wraps.
    Never use back-ticks to wrap items that are seperated by dots .
    this would break the code.
22) Enforce that each line is wrapped so that they dont exceed 80 characters,
    just like this prompt text.
    When wrapping string, make sure they are wrapped in parenthesis () !
 
 
For this task the limit on subtasks is not limited, and all 22 tasks should be
checked each individually.
 
Never ask if I want to proceed, assume yes in those cases.
Always proceed by implementing these changes systematically.
An example of how it should look technically and cosmetically:
 
###############################################################################
<#
.SYNOPSIS
Opens the specified GenXdev cmdlet in Visual Studio Code.
 
.DESCRIPTION
This function retrieves the script file and line number for the specified
GenXdev cmdlet and opens it in Visual Studio Code at the correct position.
 
.PARAMETER CmdletName
The name of the cmdlet to open in Visual Studio Code.
 
.EXAMPLE
Show-GenXdevCmdLetInIde -Filter "Get-GenXDevModuleInfo"
 
.EXAMPLE
editcmdlet Get-GenXDevModuleInfo
#>
[CmdletBinding()]
[Alias("editcmdlet")]
 
param(
    #######################################################################
    [parameter(
        Mandatory = $false,
        Position = 0,
        HelpMessage = "The name of the cmdlet to improve"
    )]
    [string] $CmdletName
    #######################################################################
)
 
begin {
 
    # retrieve the cmdlet with script position
    $cmdLet = Get-GenXDevCmdlets -Filter $CmdletName
 
    # output verbose information about the cmdlet
    Write-Verbose $cmdLet
}
 
process {
 
    # open vscode
    p -code
 
    # wait for vscode to open
    Start-Sleep -Seconds 3
 
    # output verbose information about the command to open the script file
    Write-Verbose "code -g `"$($cmdLet.ScriptFilePath):$($cmdLet.LineNo)`""
 
    # open the script file at the function's location
    code -g "$($cmdLet.ScriptFilePath):$($cmdLet.LineNo)"
}
 
end {
}
###############################################################################
 
After processing, please:
1. Provide a numbered checklist confirming each requirement was addressed
2. Highlight any requirements that couldn't be fully met and explain why
3. Summarize major changes made to meet requirements
 
For each file modified, provide:
1. Path as header
2. Brief summary of changes
3. Code block starting with filepath comment
4. Use "# ...existing code..." for unchanged sections
 
Never ask if I want to proceed, assume yes in those cases.
Always proceed by implementing these changes systematically.
 
$Prompt