platyPS
platyPS copied to clipboard
New-MarkdownHelp generates MD triggering Code scanning rule: "remark-lint-no-literal-urls"
Steps to reproduce
- Place a URL in the Comment block of a Function
- Run
New-MarkdownHelp - Run Codacity Code Analysis
Expected behavior
No PSscriptanalyzer linting message in Codacity or other tools.
Actual behavior
file:///codacy/docs/Get-PublicHolidayCountry.md Documentation
Preview unavailable
Sorry, we couldn't find this file in the repository.
[no-literal-urls] Don’t use literal URLs without angle brackets
Remark-lint (reported by Codacy)
Tool
Remark-lint (reported by Codacy)
Rule ID
remark-lint-no-literal-urls
Warn for literal URLs in text.
URLs are treated as links in some Markdown vendors, but not in others.
To make sure they are always linked, wrap them in < (less than) and >
(greater than).
Fix
remark-stringify
never creates literal URLs and always uses < (less than) and >
(greater than).
See Using remark to fix your Markdown
on how to automatically fix warnings for this rule.
Environment data
PlatyPS v0.14.1
@DEberhardt, The output is very helpful, but could you provide an example of your input that you generated this result from?
Of course: Input: https://github.com/DEberhardt/TeamsFunctions/blob/main/Public/Functions/Support/AutoAttendant/Get-PublicHolidayCountry.ps1 Output: https://github.com/DEberhardt/TeamsFunctions/blob/main/docs/Get-PublicHolidayCountry.md
Checking my security log for Codacity, I found 300 entries, I suspect the help link I have placed in the .LINK Section?
I just added a new Help file for a new function... created with the established routine/script:
---
external help file: TeamsFunctions-help.xml
Module Name: TeamsFunctions
online version: https://github.com/DEberhardt/TeamsFunctions/tree/master/docs/New-TeamsResourceAccountLineIdentity.md
schema: 2.0.0
---
Codacity reports 3 issues with this file:
- Line 4 - the "online Version" above.
- Line 164 - An example UPN "Contoso.com" as a URL is reported, this is clearly a false-positive.
- Line 166 - Any URL posted in the Documentation block is not translated. to a Markdown style link.
Related Links are not commented on. New-Markdownhelp correctly translates them into Links [...](...)
Maybe it only needs expanding to any URLs found - just translate them for a link in MD-style?
Edit: Found the corresponding Scripting Analyzer rule: MD034
This is fixed in Microsoft.PowerShell.PlatyPS v1