PowerShell / DscResource.Tests

Common meta tests for PowerShell DSC resources repositories.
MIT License
51 stars 49 forks source link

New-DscResourcePowerShellHelp: Generates white space on blank rows in the .DESCRIPTION section #338

Closed johlju closed 5 years ago

johlju commented 5 years ago

Details of the problem, bug, or enhancement

When the New-DscResourcePowerShellHelp reads the README.md and generates the section .DESCRIPTION it adds whitespace on blank rows.

Verbose logs showing the problem (if applicable)

n/a

Suggested solution to the issue

These rows https://github.com/PowerShell/DscResource.Tests/blob/85e678355f09a02118c44e325355a871a4664945/DscResource.DocumentationHelper/PowerShellHelp.psm1#L92-L93

Should be replaced by

            $descriptionContent = $descriptionContent -replace '\n', "`n    "
            $descriptionContent = $descriptionContent -replace '# Description\r\n    ', '.DESCRIPTION'
            $descriptionContent = $descriptionContent -replace '\r\n\s{4}\r\n', "`n`n"
            $descriptionContent = $descriptionContent -replace '\s{4}$', ''

This could have been cleaner if instead the rows would be looped through. See either add the above change, or loop through the rows and correct replace words and add whitespace where needed.