PSComplexity
0.5.2
Minimum PowerShell version
7.0
Installation Options
Owners
Copyright
(c) Fortigi. MIT licensed.
Package Details
Author(s)
- Fortigi
Tags
complexity cyclomatic cognitive code-quality ast metrics maintainability lint ci
Functions
Measure-PSComplexity Test-PSComplexity
PSEditions
Dependencies
This module has no dependencies.
Release Notes
0.5.2: **The SARIF log is now accepted by GitHub Advanced Security for Azure DevOps, and the README shows how to run the gate on Azure Pipelines.** Checked with the SARIF validator's Azure DevOps and GitHub Advanced Security rule sets, the log failed two rules and now passes them: the tool carries a `fullName` (name and version), which Azure DevOps requires, and each rule carries a `help` text, which GitHub Advanced Security requires. Nothing else in the log changed -- same rules, same results, same fingerprints -- so existing alerts are not reopened. One rule is left failing on purpose: the log carries no `automationDetails`, i.e. no category. On GitHub a category in the file overrides the one the upload step names, so writing one would make two PSComplexity uploads in one repository replace each other. **On Azure DevOps, set `Category` on `AdvancedSecurity-Publish@1`**; that is where it comes from. New in the README, with a complete `examples/azure-pipelines.yml`: the gate on Azure Pipelines, publishing the SARIF to Advanced Security or -- without it -- to the *SARIF SAST Scans Tab* extension, why the publishing step needs `condition: succeededOrFailed()`, and how to gate a pull request on the files it changed when Azure Pipelines checks out shallow and detached. **Three internal lookups return an empty array rather than `$null`.** PowerShell unrolls a returned collection, so an empty result reached the caller as `$null` and a single result as a bare item, although one of them documented the opposite. Every caller iterated with `foreach`, which forgives both, so no measurement was ever wrong; a future caller using a pipeline would have run its body once over `$null`. No score moves and no command changed. Full changelog: https://github.com/Fortigi/PSComplexity/blob/main/CHANGELOG.md
FileList
- PSComplexity.nuspec
- LICENSE
- PSComplexity.psd1
- PSComplexity.psm1
- README.md
- schemas\v1\report.schema.json
- src\Ast.ps1
- src\BaselineFile.ps1
- src\Cognitive.ps1
- src\Cyclomatic.ps1
- src\Measure-PSComplexity.ps1
- src\Policy.ps1
- src\Report.ps1
- src\Scan.ps1