Skip to content

Commit 60b0cd5

Browse files
committed
Merge branch 'preview' into TestAutomation
2 parents a34ca2b + 01c0dde commit 60b0cd5

File tree

11 files changed

+61
-9
lines changed

11 files changed

+61
-9
lines changed

build.proj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@
509509
<Message Importance="high" Text="Running Dependency Analysis..." />
510510
<Exec Command="$(MSBuildProjectDirectory)\src\Package\StaticAnalysis.exe $(MSBuildProjectDirectory)\src\Package\$(Configuration) $(MSBuildProjectDirectory)\src\Package true $(SkipHelp)" Condition="'$(Latest)' == 'true'"/>
511511
<Exec Command="$(MSBuildProjectDirectory)\src\Package\StaticAnalysis.exe $(MSBuildProjectDirectory)\src\Stack\$(Configuration) $(MSBuildProjectDirectory)\src\Stack" Condition="'$(Stack)' == 'true'" ContinueOnError="True"/>
512+
<OnError ExecuteTargets="StaticAnalysisErrorMessage"/>
513+
</Target>
514+
515+
<Target Name="StaticAnalysisErrorMessage">
516+
<Error Text="StaticAnalysis has failed. Please follow the instructions on this doc: https://github.com/Azure/azure-powershell/blob/preview/documentation/Debugging-StaticAnalysis-Errors.md"/>
512517
</Target>
513518

514519
<!-- Publish all packages -->
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Debugging StaticAnalysis Errors
2+
3+
Our StaticAnalysis tools help us ensure our modules follow PowerShell guidelines and prevent breaking changes from occurring outside of breaking change releases.
4+
5+
- [How to know if you have a StaticAnalysis Error](#how-to-know-if-you-have-a-staticanalysis-error)
6+
- [Where to find StaticAnalysis reports](#where-to-find-staticanalysis-reports)
7+
- [Types of StaticAnalysis Errors](#types-of-staticanalysis-errors)
8+
- [Breaking Changes](#breaking-changes)
9+
- [Signature Issues](#signature-issues)
10+
- [Help Issues](#help-issues)
11+
12+
## How to know if you have a StaticAnalysis Error
13+
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:
14+
```
15+
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\src\Package\StaticAnalysis.exe d:\workspace\powershell\src\Package\Debug d:\workspace\powershell\src\Package true false" exited with code 255.
16+
```
17+
18+
## Where to find StaticAnalysis reports
19+
20+
The StaticAnalysis reports could show up in two different places in the CI build:
21+
- On the status page in Jenkins, under the Build Artifacts: the relevant files are BreakingChangeIssues.csv, SignatureIssues.csv, and/or HelpIssues.csv.
22+
- On the status page in Jenkins, click Build Artifacts then navigate to src/Package. You will see BreakingChangeIssues.csv, SignatureIssues.csv, and/or HelpIssues.csv.
23+
24+
Locally, the StaticAnalysis report will show up under Azure-PowerShell/src/Package. You will see BreakingChangeIssues.csv, SignatureIssues.csv, and/or HelpIssues.csv. You can generate these files by running
25+
```
26+
msbuild build.proj
27+
```
28+
29+
## Types of StaticAnalysis Errors
30+
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.
31+
32+
### Breaking Changes
33+
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, and if they do indeed introduce a breaking change in a non-breaking change release, please revert the change that caused this violation. Sometimes the error listed in the .csv file can be a false positive (for example, if you change a parameter attribute to span all parameter sets rather than individual parameter sets). Please read the error thoroughly and examine the relevant code before deciding that an error is a false positive, and contact the Azure PowerShell team if you have questions. If you are releasing a preview module, are releasing during a breaking change release, or have determined that the error is a false positive, please follow these instructions:
34+
- Copy each of the errors you would like to suppress directly from the BreakingChangeIssues.csv file output in the Jenkins build
35+
- Paste each of these error into the [BreakingChangeIssues.csv file](https://github.com/Azure/azure-powershell/blob/preview/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv) in our GitHub repo. Note that you will need to edit this file in a text editor rather than Excel to prevent parsing errors.
36+
- Push the changes to the .csv file and ensure the errors no longer show up in the BreakingChangeIssues.csv file output from the Jenkins build.
37+
38+
We take breaking changes very seriously, so please be mindful about the violations that you suppress in our repo.
39+
40+
### Signature Issues
41+
Signature issues occur when your cmdlets do not follow PowerShell standards. Please check [this page](https://github.com/Azure/azure-powershell/wiki/PowerShell-Cmdlet-Design-Guidelines) 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:
42+
- Copy each of the errors you would like to suppress directly from the SignatureIssues.csv file output in the Jenkins build
43+
- Paste each of these error into the [SignatureIssues.csv file](https://github.com/Azure/azure-powershell/blob/preview/tools/StaticAnalysis/Exceptions/SignatureIssues.csv) in our GitHub repo. Note that you will need to edit this file in a text editor rather than Excel to prevent parsing errors.
44+
- Push the changes to the .csv file and ensure the errors no longer show up in the SignatureIssues.csv file output from the Jenkins build.
45+
46+
### Help Issues
47+
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/preview/documentation/help-generation.md). If this is not the issue, follow the steps listed under "Remediation" for each violation listed in HelpIssues.csv.

src/Common/Commands.Common.Authentication.Abstractions/Settings/ClientFactorySettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.Common.Authentication.Abstractions
2323
public class ClientFactorySettings : IExtensibleSettings
2424
{
2525
/// <summary>
26-
/// The user agents in the cusrrent client factory
26+
/// The user agents in the current client factory
2727
/// </summary>
2828
public IEnumerable<UserAgentSettings> UserAgents { get; }
2929

src/ResourceManager/Profile/Commands.Profile/help/Add-AzureRmAccount.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Accept wildcard characters: False
368368
```
369369
370370
### -Scope
371-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user.
371+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
372372
373373
```yaml
374374
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Disable-AzureRmContextAutosave.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Accept wildcard characters: False
4747
```
4848
4949
### -Scope
50-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
50+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user
5151
5252
```yaml
5353
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Enable-AzureRmContextAutosave.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Accept wildcard characters: False
4747
```
4848
4949
### -Scope
50-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
50+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user
5151
5252
```yaml
5353
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Remove-AzureRmContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Accept wildcard characters: False
114114
```
115115
116116
### -Scope
117-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
117+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user
118118
119119
```yaml
120120
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Rename-AzureRmContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Accept wildcard characters: False
109109
```
110110
111111
### -Scope
112-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
112+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user
113113
114114
```yaml
115115
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Select-AzureRmContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Accept wildcard characters: False
8585
```
8686
8787
### -Scope
88-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user
88+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user
8989
9090
```yaml
9191
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Set-AzureRmContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Accept wildcard characters: False
148148
```
149149
150150
### -Scope
151-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user.
151+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
152152
153153
```yaml
154154
Type: ContextModificationScope

src/ResourceManager/Profile/Commands.Profile/help/Set-AzureRmEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ Accept wildcard characters: False
370370
```
371371
372372
### -Scope
373-
Determines the scope of context changes, for example, wheher changes apply only to the cusrrent process, or to all sessions started by this user.
373+
Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user.
374374
375375
```yaml
376376
Type: ContextModificationScope

0 commit comments

Comments
 (0)