Skip to content

Conversation

@MoChilia
Copy link
Member

@MoChilia MoChilia commented Jul 6, 2022

Description

  • Fix false positive for Mismatched_Parameter_Value_Type
  1. Support creating object by [Type]::new()
  2. Support creating object by type with its members like $bytes = [System.Text.Encoding]::Unicode.GetBytes($text)
  3. Support analyzing variables assigned by assignment statement like $VMName = 'v'+ $ResourceGroupName
  4. Support members from inherited interface
  5. Support assigned by convert expression like [System.DayOfWeek[]]$WeekDays = @([System.DayOfWeek]::Monday..[System.DayOfWeek]::Friday)
  6. Support the situation when ActualType is subclass of ExpectedType
  7. Support Implicit type conversion
  8. Support analyzing with "Where-Object" and "Sort-Object"
  9. Skip "ForEach-Object" and "Select-Object"
  • Fix false positive for Unbinded_Expression: Skip special situation of "Get-AzContext, Select-AzContext, Remove-AzContext" who have dynamic parameter "-Name"
  • Skip the examples whose output can not be splitted from code
  • No missingExample for autogenerated codes

TestPR: #18872

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
      • {Please put the link here}
    • the markdown help files have been regenerated using the commands listed here

$indexOfParameters = $fileContent.IndexOf($PARAMETERS_HEADING)

$exampleNumber = 0
$exampleNumber = -1
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you change the initial value as -1.

Copy link
Member Author

Choose a reason for hiding this comment

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

$examplesTitles[$exampleNumber] needs to start at index 0 and examples matching (autogenerated) or <!-- Skip.*--> needs $exampleNumber++, or the number of the titles will be confusing.

@@ -0,0 +1,8 @@
"Module","Cmdlet","Example","RuleName","ProblemID","Severity","Description","Extent","Remediation"
"Accounts","Disconnect-AzAccount","2","Unbinded_Expression","5014","2","Get-AzContext 'Work' is not explicitly assigned to a parameter.","'Work'","Assign 'Work' explicitly to the parameter."
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this file needs to be checked in?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the file for suppressing. We discussed to add these items in exception csv instead of adding them in the source code.

@BethanyZhou
Copy link
Contributor

BethanyZhou commented Jul 6, 2022

Looks good to me. Any thoughts? @isra-fel

@isra-fel isra-fel merged commit 817b5b2 into main Jul 7, 2022
@isra-fel isra-fel deleted the shiying/ci-example-1 branch July 7, 2022 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants