Skip to content

Commit 94a05a6

Browse files
authored
[Doc] Updated Static analysis doc (#21244)
* Update Debugging-StaticAnalysis-Errors.md * Update Debugging-StaticAnalysis-Errors.md * Update Debugging-StaticAnalysis-Errors.md
1 parent 4494369 commit 94a05a6

File tree

1 file changed

+35
-25
lines changed

1 file changed

+35
-25
lines changed

documentation/Debugging-StaticAnalysis-Errors.md

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,38 @@
33
Our StaticAnalysis tools help us ensure our modules follow PowerShell guidelines and prevent breaking changes from occurring outside of breaking change releases.
44

55
- [How to know if you have a StaticAnalysis Error](#how-to-know-if-you-have-a-staticanalysis-error)
6+
- [How to locate the StaticAnalysis Error](#how-to-locate-the-staticanalysis-error)
67
- [Where to find StaticAnalysis reports](#where-to-find-staticanalysis-reports)
78
- [Types of StaticAnalysis Errors](#types-of-staticanalysis-errors)
8-
- [Breaking Changes](#breaking-changes)
9-
- [Signature Issues](#signature-issues)
10-
- [Help Issues](#help-issues)
11-
- [Example Issues](#example-issues)
9+
- [Assembly Version Conflict](#assembly-version-conflict)
10+
- [Breaking Changes](#breaking-changes)
11+
- [Example Issues](#example-issues)
12+
- [Extra Assemblies](#example-issues)
13+
- [Help Issues](#help-issues)
14+
- [Missing Assemblies](#missing-assemblies)
15+
- [Signature Issues](#signature-issues)
1216
- [Troubleshotting Example Issues](#troubleshotting-example-issues)
1317

1418
## How to know if you have a StaticAnalysis Error
15-
If your build is failing, click on the Jenkins job inside the PR (marked as "Default" within checks). Then check the Console Output within the Jenkins job. If you have this error, then you have failed StaticAnalysis:
16-
```
17-
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\artifacts\StaticAnalysis.exe d:\workspace\powershell\artifacts\Debug d:\workspace\powershell\artifacts true false" exited with code 255.
18-
```
19+
If your build is failing, see the ADO pipeline checks. If check `azure-powershell - powershell-core (Analyze)` failed, then you have a StaticAnalysis Error.
1920

20-
## Where to find StaticAnalysis reports
21+
## How to locate the StaticAnalysis Error
22+
Click into the failed check, then click `View more details on Azure Pipelines` to redirect to ADO pipeline page. Click the sub task with errors and search `csv` or `error` to locate the specific errors.
2123

22-
The StaticAnalysis reports could show up in two different places in the CI build:
23-
- On the status page in Jenkins, under the Build Artifacts: the relevant files are `BreakingChangeIssues.csv`, `SignatureIssues.csv`, `HelpIssues.csv` and/or `ExampleIssues.csv`.
24-
- On the status page in Jenkins, click Build Artifacts then navigate to artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, `HelpIssues.csv` and/or `ExampleIssues.csv`.
24+
## Where to find StaticAnalysis reports
25+
The StaticAnalysis reports could show up in the CI build. On the status page in ADO, under the Build Artifacts, expand the folder whose name starts with `analyze`. Under the `StaticAnalysisResults` folder: the relevant files are `AssemblyVersionConflict.csv`, `BreakingChangeIssues.csv`, `ExampleIssues.csv`, `ExtraAssemblies.csv`, `HelpIssues.csv`, `MissingAssemblies.csv`, and/or `SignatureIssues.csv` .
2526

26-
Locally, the StaticAnalysis report will show up under Azure-PowerShell/artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, `HelpIssues.csv` and/or `ExampleIssues.csv`. You can generate these files by running
27+
Locally, the StaticAnalysis report will show up under Azure-PowerShell/artifacts. You will see the `.csv` fils listed. You can generate these files by running
2728
```
2829
msbuild build.proj
2930
```
3031

3132
## Types of StaticAnalysis Errors
3233
The three most common Static Analysis errors are breaking changes, signature issues, and help issues. To figure out which type of error is causing the build failure, open each of the relevant .csv files (if the .csv file does not exist, there is no violation detected). Any issue marked with severity 0 or 1 must be resolved in order for the build to pass.
3334

35+
### Assembly Version Conflict
36+
(To be Updated)
37+
3438
### Breaking Changes
3539
If you make a change that could cause a breaking change, it will be listed in `BreakingChangeIssues.csv`. Please look at each of these errors in this file, and if they do indeed introduce a breaking change in a non-breaking change release, please revert the change that caused this violation.
3640

@@ -43,18 +47,6 @@ _Note_: Sometimes the error listed in the .csv file can be a false positive (for
4347

4448
We take breaking changes very seriously, so please be mindful about the violations that you suppress in our repo.
4549

46-
### Signature Issues
47-
Signature issues occur when your cmdlets do not follow PowerShell standards. Please check the [_Cmdlet Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/cmdlet-best-practices.md) and the [_Parameter Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/parameter-best-practices.md) documents to ensure you are following PowerShell guidelines. Issues with severity 0 or 1 must be addressed, while issues with severity 2 are advisory. If you have an issue with severity 0 or 1 that has been approved by the Azure PowerShell team, you can suppress them following these steps:
48-
49-
- Download the `SignatureIssues.csv` file from the CI pipeline artifacts
50-
- Open the file using a text editor (such as VS Code) and copy each of the errors you'd like to suppress
51-
- Paste each of these errors into the `SignatureIssues.csv` file found in their respective [module folder](../tools/StaticAnalysis/Exceptions) (_e.g.,_ if a signature issue is being suppressed for Sql, then you would paste the corresponding line(s) in the `tools/StaticAnalysis/Exceptions/Az.Sql/SignatureIssues.csv` file) using the same text editor
52-
- Copy each of the errors you would like to suppress directly from the SignatureIssues.csv file output in the CI pipeline artifacts
53-
- Push the changes to the .csv file and ensure the errors no longer show up in the `SignatureIssues.csv` file output from the CI pipeline artifacts.
54-
55-
### Help Issues
56-
Most help issues that cause StaticAnalysis to fail occur when help has not been added for a particular cmdlet. If you have not generated help for your new cmdlets, please follow the instructions [here](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md). If this is not the issue, follow the steps listed under "Remediation" for each violation listed in HelpIssues.csv.
57-
5850
### Example Issues
5951
Example issues occur when your changed markdown files in the `help` folder (_e.g.,_ `src/Accounts/Accounts/help`) violate PowerShell language best practices. Please follow the suggestion displayed in "Remediation" entry for each violation listed in `ExampleIssues.csv`. Issues with severity 0 or 1 must be addressed, while issues with severity 2 are advisory. To better standardize the writing of documents, please also check the warning issues with severity 2 in log or download the `ExampleIssues.csv` file. If you have an issue with severity 0 or 1 that has been approved by the Azure PowerShell team, you can suppress them following these steps:
6052

@@ -63,6 +55,24 @@ Example issues occur when your changed markdown files in the `help` folder (_e.g
6355
- Paste each of these errors into the `ExampleIssues.csv` file found in their respective [module folder](../tools/StaticAnalysis/Exceptions) (_e.g.,_ if an example issue is being suppressed for Accounts, then you would paste the corresponding line(s) in the `tools/StaticAnalysis/Exceptions/Az.Accounts/ExampleIssue.csv` file) using the same text editor
6456
- Copy each of the errors you would like to suppress directly from the ExampleIssues.csv file output in the CI pipeline artifacts
6557
- Push the changes to the .csv file and ensure the errors no longer show up in the `ExampleIssues.csv` file output from the CI pipeline artifacts.
58+
-
59+
### Extra Assemblies
60+
(To be Updated)
61+
62+
### Help Issues
63+
Most help issues that cause StaticAnalysis to fail occur when help has not been added for a particular cmdlet. If you have not generated help for your new cmdlets, please follow the instructions [here](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md). If this is not the issue, follow the steps listed under "Remediation" for each violation listed in HelpIssues.csv.
64+
65+
### Missing Assemblies
66+
(To be Updated)
67+
68+
### Signature Issues
69+
Signature issues occur when your cmdlets do not follow PowerShell standards. Please check the [_Cmdlet Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/cmdlet-best-practices.md) and the [_Parameter Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/parameter-best-practices.md) documents to ensure you are following PowerShell guidelines. Issues with severity 0 or 1 must be addressed, while issues with severity 2 are advisory. If you have an issue with severity 0 or 1 that has been approved by the Azure PowerShell team, you can suppress them following these steps:
70+
71+
- Download the `SignatureIssues.csv` file from the CI pipeline artifacts
72+
- Open the file using a text editor (such as VS Code) and copy each of the errors you'd like to suppress
73+
- Paste each of these errors into the `SignatureIssues.csv` file found in their respective [module folder](../tools/StaticAnalysis/Exceptions) (_e.g.,_ if a signature issue is being suppressed for Sql, then you would paste the corresponding line(s) in the `tools/StaticAnalysis/Exceptions/Az.Sql/SignatureIssues.csv` file) using the same text editor
74+
- Copy each of the errors you would like to suppress directly from the SignatureIssues.csv file output in the CI pipeline artifacts
75+
- Push the changes to the .csv file and ensure the errors no longer show up in the `SignatureIssues.csv` file output from the CI pipeline artifacts.
6676

6777
## Troubleshotting Example Issues
6878
### Scenario 1: Unexpected errors caused by the mixture of outputs and codes

0 commit comments

Comments
 (0)