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
5 changes: 4 additions & 1 deletion src/Common/MergeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,15 @@ internal static bool TryGetMergedParameters(List<Parameter>fromHelp, List<Parame

var description = helpParam.Description;

var templateDescription = string.Format(Constants.FillInParameterDescriptionTemplate, helpParam.Name);

if (string.Equals(helpParam.Description, checkTemplate, StringComparison.OrdinalIgnoreCase))
{
diagnosticMessages.Add(new DiagnosticMessage(DiagnosticMessageSource.Merge, $"Parameter {pName} has no description in the help.", DiagnosticSeverity.Warning, "TryGetMergedParameters", -1));
description = cmdParam.Description;
}
else if (!string.Equals(helpParam.Description, cmdParam.Description, StringComparison.OrdinalIgnoreCase))
else if (!string.Equals(cmdParam.Description, templateDescription, StringComparison.OrdinalIgnoreCase)
&& !string.Equals(helpParam.Description, cmdParam.Description, StringComparison.OrdinalIgnoreCase))
{
diagnosticMessages.Add(new DiagnosticMessage(DiagnosticMessageSource.Merge, $"Parameter {pName} has the different description in the help and the command. Concatinating.", DiagnosticSeverity.Information, "TryGetMergedParameters", -1));
description = string.Join(Environment.NewLine, helpParam.Description, cmdParam.Description);
Expand Down
4 changes: 2 additions & 2 deletions test/Pester/MeasurePlatyPSMarkdown.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Describe "Export-MarkdownModuleFile" {

It "Should identify all the '<fileType>' assets" -TestCases @(
@{ fileType = "unknown"; expectedCount = 2 }
@{ fileType = "CommandHelp"; expectedCount = 41 }
@{ fileType = "CommandHelp"; expectedCount = 42 }
@{ fileType = "ModuleFile"; expectedCount = 16 }
@{ fileType = "V1Schema"; expectedCount = 52 }
@{ fileType = "V1Schema"; expectedCount = 53 }
@{ fileType = "V2Schema"; expectedCount = 5 }
) {
param ($fileType, $expectedCount)
Expand Down
5 changes: 5 additions & 0 deletions test/Pester/UpdateCommandHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ Describe "Tests for Update-CommandHelp" {
$ch.AliasHeaderFound | Should -Be $true
}

It "Should not append parameter descriptions with boiler plate if description is not boilerplate" {
$ch = Update-CommandHelp -Path ([io.path]::Combine($PSScriptRoot, "assets", "Export-Csv.md"))
$ch.Parameters.Where({$_.Name -eq "LiteralPath"}).Description | Should -Not -BeLike "*{{ Fill LiteralPath Description }}*"
}

Context "Parameter attribute updates" {
BeforeAll {
function test-update {
Expand Down
Loading