FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

AvoidUsingPositionalParameter: Check if command has parameters to avoid having az in default CommandAllowList by bergmeister · Pull Request #1850 · PowerShell/PSScriptAnalyzer · GitHub

AvoidUsingPositionalParameter: Check if command has parameters to avoid having az in default CommandAllowList - #1850

Merged
Christoph Bergmeister (bergmeister) merged 5 commits into
PowerShell:masterfrom
bergmeister:AvoidUsingPositionalParameter-CheckForParams
Feb 13, 2024
Merged

AvoidUsingPositionalParameter: Check if command has parameters to avoid having az in default CommandAllowList#1850
Christoph Bergmeister (bergmeister) merged 5 commits into
PowerShell:masterfrom
bergmeister:AvoidUsingPositionalParameter-CheckForParams

Conversation

Christoph Bergmeister (bergmeister) commented Oct 24, 2022
edited
Loading

Copy link
Copy Markdown
Collaborator

PR Summary

This is an enhancement to CommandAllowList introduced in #1846
To avoid having az as the default in it, return now the discovered command and inspect whether it has parameters. If not, which is the case for the az CLI, then do not continue analyzing usage of that command.
Also, az has backed out their change since then so with latest version of az, we don't need it as default allow-list anyway.

PR Checklist

Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 25, 2022 16:43

Copy link
Copy Markdown
Contributor

Christoph Bergmeister (@bergmeister) should we have any validation for this new behavior? Not about removing "az", but rather the command having no parameters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

just 1 question

Comment thread Rules/AvoidPositionalParameters.cs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this is fine

Christoph Bergmeister (bergmeister) merged commit df3551e into PowerShell:master Feb 13, 2024
Rob Holt (rjmholt) added a commit to rjmholt/PSScriptAnalyzer that referenced this pull request Feb 23, 2026
UseDeclaredVarsMoreThanAssignments (PowerShell#2013): skip scope-qualified
variable references ($global:, $script:, drive-qualified) when
checking for uses of local variables, preventing false negatives.

AvoidPositionalParameters (PowerShell#1850): skip commands that have no
parameters in the database (e.g. native CLI tools like az).

Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL