Skip to content

Commit d5a78bc

Browse files
authored
Merge pull request #1406 from MicrosoftDocs/master
2/7 Publish
2 parents afe06dd + 340e0fe commit d5a78bc

8 files changed

+53
-47
lines changed

docs/code-quality/code-analysis-for-managed-code-overview.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ To run code analysis manually on a project, from the menu bar choose **Analyze**
3636

3737
Code analysis rules for managed code are grouped into *rule sets*. You can use one of the Microsoft standard rule sets, or you can create a custom rule set to fulfill a specific need. For more information, see [Using Rule Sets to Group Code Analysis Rules](../code-quality/using-rule-sets-to-group-code-analysis-rules.md).
3838

39-
## In source suppression
39+
## Suppress warnings
4040

4141
Frequently, it is useful to indicate that a warning is non-applicable. This informs the developer, and other people who might review the code later, that a warning was investigated and then either suppressed or ignored.
4242

43-
In source suppression of warnings is implemented through custom attributes. To suppress a warning, add the attribute `SuppressMessage` to the source code as shown in the following example:
43+
In-source suppression of warnings is implemented through custom attributes. To suppress a warning, add the attribute `SuppressMessage` to the source code as shown in the following example:
4444

4545
```csharp
4646
[System.Diagnosis.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1039:ListsAreStrongTyped")]
@@ -50,7 +50,10 @@ Public class MyClass
5050
}
5151
```
5252

53-
For more information, see [Suppress Warnings By Using the SuppressMessage Attribute](../code-quality/suppress-warnings-by-using-the-suppressmessage-attribute.md).
53+
For more information, see [Suppress warnings](../code-quality/in-source-suppression-overview.md).
54+
55+
> [!NOTE]
56+
> If you migrate a project to Visual Studio 2017, you might suddenly be faced with an overwhelming number of code analysis warnings. If you aren't ready to fix the warnings and want to temporarily turn code analysis off, open the project's property pages (**Project** > ***project* Properties...**) and go to the **Code Analysis** tab. Deselect **Enable Code Analysis on Build**, and then rebuild your project. Alternatively, you can select a different, smaller rule set to run against the code. Remember to turn code analysis back on when you are ready to fix the warnings.
5457
5558
## Run code analysis as part of check-in policy
5659

docs/code-quality/in-source-suppression-overview.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Suppressing code analysis warnings using the SuppressMessage attribute in Visual Studio | Microsoft Docs"
2+
title: "Suppress code analysis warnings in Visual Studio | Microsoft Docs"
33
ms.custom: ""
44
ms.date: 01/29/2018
55
ms.reviewer: ""
@@ -30,6 +30,9 @@ In C++/CLI, use the macros CA\_SUPPRESS\_MESSAGE or CA\_GLOBAL\_SUPPRESS_MESSAGE
3030
> [!NOTE]
3131
> You should not use in-source suppressions on release builds, to prevent shipping the in-source suppression metadata accidentally. Additionally, because of the processing cost of in-source suppression, the performance of your application can be degraded.
3232
33+
> [!NOTE]
34+
> If you migrate a project to Visual Studio 2017, you might suddenly be faced with an overwhelming number of code analysis warnings. If you aren't ready to fix the warnings and want to temporarily turn code analysis off, open the project's property pages (**Project** > ***project* Properties...**) and go to the **Code Analysis** tab. Deselect **Enable Code Analysis on Build**, and then rebuild your project. Alternatively, you can select a different, smaller rule set to run against the code. Remember to turn code analysis back on when you are ready to fix the warnings.
35+
3336
## SuppressMessage attribute
3437

3538
When you choose **Suppress** from the context or right-click menu of a code analysis warning in the **Error List**, a <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute is added either in your code or to the project's global suppression file.
@@ -90,7 +93,7 @@ For maintainability reasons, omitting the rule name is not recommended.
9093
9194
Suppression attributes can be applied to a method, but cannot be embedded within a method body. This means that all violations of a particular rule are suppressed if you add the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute to the method.
9295
93-
In some cases, you might want to suppress a particular instance of the violation, for example so that future code isn't automatically exempt from the code analysis rule. Certain code analysis rules allow you to do this by using the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. In general, legacy rules for violations on a particular symbol (a local variable or parameter) respect the `MessageId` property. [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md) is an example of such a rule. However, legacy rules for violations on executable code (non-symbol) do not respect the `MessageId` property. Additionally, Roslyn analyzers do not respect the `MessageId` property.
96+
In some cases, you might want to suppress a particular instance of the violation, for example so that future code isn't automatically exempt from the code analysis rule. Certain code analysis rules allow you to do this by using the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. In general, legacy rules for violations on a particular symbol (a local variable or parameter) respect the `MessageId` property. [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md) is an example of such a rule. However, legacy rules for violations on executable code (non-symbol) do not respect the `MessageId` property. Additionally, .NET Compiler Platform ("Roslyn") analyzers do not respect the `MessageId` property.
9497
9598
To suppress a particular symbol violation of a rule, specify the symbol name for the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. The following example shows code with two violations of [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md)&mdash;one for the `name` variable and one for the `age` variable. Only the violation for the `age` symbol is suppressed.
9699

docs/code-quality/walkthrough-configuring-and-using-a-custom-rule-set.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Now you can run Code Analysis on the RuleSetSample project and look for any erro
101101

102102
2. In the Error List window, click **Warnings** and then click the **Description** column header to sort the warnings alphanumerically.
103103

104-
In a real-world application, you would fix any rule violations worth fixing at this point, or optionally turn off or suppress a rule if you determined that it was not worth fixing. For more information, see [Suppress Warnings By Using the SuppressMessage Attribute](../code-quality/suppress-warnings-by-using-the-suppressmessage-attribute.md).
104+
In a real-world application, you would fix any rule violations worth fixing at this point, or optionally turn off or suppress a rule if you determined that it was not worth fixing. For more information, see [Suppress warnings](../code-quality/in-source-suppression-overview.md).
105105

106106
3. Notice the CA1704 warnings. These violations on this rule indicate that you should " Consider providing a more meaningful name for the parameters." You could correct the issue in your code or you can disable the rule, as explained in the next procedure.
107107

docs/ide/using-regular-expressions-in-visual-studio.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,51 @@ manager: ghogen
2222
ms.workload:
2323
- "multiple"
2424
---
25-
# Using Regular Expressions in Visual Studio
25+
# Using regular expressions in Visual Studio
2626

27-
[!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] uses .NET Framework regular expressions to find and replace text. For more information about .NET regular expressions, see [.NET Framework Regular Expressions](/dotnet/standard/base-types/regular-expressions).
28-
29-
> [!TIP]
30-
> In Windows operating systems, most lines end in "\r\n" (a carriage return followed by a new line). These characters are not visible, but are present in the editor and are passed to the .NET Regular Expression service.
27+
Visual Studio uses [.NET Framework regular expressions](/dotnet/standard/base-types/regular-expressions) to find and replace text.
3128

3229
## Replacement patterns
3330

34-
For information about regular expressions that are used in replacement patterns, see [Substitutions](/dotnet/standard/base-types/substitutions-in-regular-expressions). To use a numbered capture group, the syntax is `$1` to specify the numbered group, and `(x)` to specify the group in question. For example, the grouped regular expression `(\d)([a-z])` finds four matches in the following string: **1a 2b 3c 4d**. The replacement string `z$1` converts that string to **z1 z2 z3 z4**.
35-
36-
## Regular Expression examples
31+
For information about regular expressions that are used in replacement patterns, see [Substitutions in regular expressions (.NET Guide)](/dotnet/standard/base-types/substitutions-in-regular-expressions). To use a numbered capture group, the syntax is `$1` to specify the numbered group, and `(x)` to specify the group in question. For example, the grouped regular expression `(\d)([a-z])` finds four matches in the following string: **1a 2b 3c 4d**. The replacement string `z$1` converts that string to **z1 z2 z3 z4**.
32+
33+
## Regular expression examples
3734

3835
Here are some examples:
3936

4037
|Purpose|Expression|Example|
4138
|-------------|----------------|-------------|
42-
|Match any single character (except a line break)|.|`a.o` matches "aro" in "around" and "abo" in "about" but not "acro" in "across".|
43-
|Match zero or more occurrences of the preceding expression (match as many characters as possible)|*|`a*r` matches "r" in "rack", "ar" in "ark", and "aar" in "aardvark"|
44-
|Match any character zero or more times (Wildcard *)|.*|c.*e matches "cke" in "racket", "comme" in "comment", and "code" in "code"|
45-
|Match one or more occurrences of the preceding expression (match as many characters as possible)|+|`e.+e` matches "eede" in "feeder" but not "ee".|
46-
|Match any character one or more times (Wildcard ?)|.+|e.+e matches "eede" in "feeder" but not "ee".|
47-
|Match zero or more occurrences of the preceding expression (match as few characters as possible)|*?|`e.*?e` matches "ee" in "feeder" but not "eede".|
48-
|Match one or more occurrences of the preceding expression (match as few characters as possible)|+?|`e.+?e` matches "ente" and "erprise" in "enterprise", but not the whole word "enterprise".|
49-
|Anchor the match string to the beginning of a line or string|^|`^car` matches the word "car" only when it appears at the beginning of a line.|
50-
|Anchor the match string to the end of a line|\r?$|`End\r?$` matches "end" only when it appears at the end of a line.|
51-
|Match any single character in a set|[abc]|`b[abc]` matches "ba", "bb", and "bc".|
52-
|Match any character in a range of characters|[a-f]|`be[n-t]` matches "bet" in "between", "ben" in "beneath", and "bes" in "beside", but not "below".|
53-
|Capture and implicitly number the expression contained within parenthesis|()|`([a-z])X\1` matches "aXa"and "bXb", but not "aXb". ". "\1" refers to the first expression group "[a-z]".|
54-
|Invalidate a match|(?!abc)|`real (?!ity)` matches "real" in "realty" and "really" but not in "reality." It also finds the second "real" (but not the first "real") in "realityreal".|
55-
|Match any character that is not in a given set of characters|[^abc]|`be[^n-t]` matches "bef" in "before", "beh" in "behind", and "bel" in "below", but not "beneath".|
56-
|Match either the expression before or the one after the symbol.|&#124;|`(sponge&#124;mud) bath` matches "sponge bath" and "mud bath."|
57-
|Escape the character following the backslash|\|`\^` matches the character ^.|
58-
|Specify the number of occurrences of the preceding character or group|{x}, where x is the number of occurrences|`x(ab){2}x` matches "xababx", and `x(ab){2,3}x` matches "xababx" and "xabababx" but not "xababababx".|
59-
|Match text in a Unicode character class, where "X" is the Unicode number. For more information about Unicode character classes, see<br /><br /> [Unicode Standard 5.2 Character Properties](http://www.unicode.org/versions/Unicode5.2.0/ch04.pdf).|\p{X}|`\p{Lu}` matches "T" and "D" in "Thomas Doe".|
60-
|Match a word boundary|`\b` (Outside a character class \b specifies a word boundary, and inside a character class specifies a backspace).|`\bin` matches "in" in "inside" but not "pinto".|
61-
|Match a line break (ie a carriage return followed by a new line).|\r?\n|`End\r?\nBegin` matches "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.|
62-
|Match any alphanumeric character|\w|`a\wd` matches "add" and "a1d" but not "a d".|
63-
|Match any whitespace character.|(?([^\r\n])\s)|`Public\sInterface` matches the phrase "Public Interface".|
64-
|Match any numeric character|\d|`\d` matches and "3" in "3456", "2" in 23", and "1" in "1".|
65-
|Match a Unicode character|\uXXXX where XXXX specifies the Unicode character value.|`\u0065` matches the character "e".|
66-
|Match an identifier|\b(_\w+&#124;[\w-[0-9\_]]\w*)\b|Matches "type1" but not &type1" or "#define".|
67-
|Match a string inside quotes|((\\".+?\\")&#124;('.+?'))|Matches any string inside single or double quotes.|
68-
|Match a hexadecimal number|\b0[xX]([0-9a-fA-F]\)\b|Matches "0xc67f" but not "0xc67fc67f".|
69-
|Match integers and decimals|\b[0-9]*\\.\*[0-9]+\b|Matches "1.333".|
39+
|Match any single character (except a line break)|.|`a.o` matches "aro" in "around" and "abo" in "about" but not "acro" in "across".|
40+
|Match zero or more occurrences of the preceding expression (match as many characters as possible)|*|`a*r` matches "r" in "rack", "ar" in "ark", and "aar" in "aardvark"|
41+
|Match any character zero or more times (Wildcard *)|.*|c.*e matches "cke" in "racket", "comme" in "comment", and "code" in "code"|
42+
|Match one or more occurrences of the preceding expression (match as many characters as possible)|+|`e.+e` matches "eede" in "feeder" but not "ee".|
43+
|Match any character one or more times (Wildcard ?)|.+|e.+e matches "eede" in "feeder" but not "ee".|
44+
|Match zero or more occurrences of the preceding expression (match as few characters as possible)|*?|`e.*?e` matches "ee" in "feeder" but not "eede".|
45+
|Match one or more occurrences of the preceding expression (match as few characters as possible)|+?|`e.+?e` matches "ente" and "erprise" in "enterprise", but not the whole word "enterprise".|
46+
|Anchor the match string to the beginning of a line or string|^|`^car` matches the word "car" only when it appears at the beginning of a line.|
47+
|Anchor the match string to the end of a line|\r?$|`End\r?$` matches "end" only when it appears at the end of a line.|
48+
|Match any single character in a set|[abc]|`b[abc]` matches "ba", "bb", and "bc".|
49+
|Match any character in a range of characters|[a-f]|`be[n-t]` matches "bet" in "between", "ben" in "beneath", and "bes" in "beside", but not "below".|
50+
|Capture and implicitly number the expression contained within parenthesis|()|`([a-z])X\1` matches "aXa"and "bXb", but not "aXb". ". "\1" refers to the first expression group "[a-z]".|
51+
|Invalidate a match|(?!abc)|`real (?!ity)` matches "real" in "realty" and "really" but not in "reality." It also finds the second "real" (but not the first "real") in "realityreal".|
52+
|Match any character that is not in a given set of characters|[^abc]|`be[^n-t]` matches "bef" in "before", "beh" in "behind", and "bel" in "below", but not "beneath".|
53+
|Match either the expression before or the one after the symbol.|&#124;|`(sponge&#124;mud) bath` matches "sponge bath" and "mud bath."|
54+
|Escape the character following the backslash|\\|`\^` matches the character ^.|
55+
|Specify the number of occurrences of the preceding character or group|{x}, where x is the number of occurrences|`x(ab){2}x` matches "xababx", and `x(ab){2,3}x` matches "xababx" and "xabababx" but not "xababababx".|
56+
|Match text in a Unicode character class, where "X" is the Unicode number. For more information about Unicode character classes, see<br /><br /> [Unicode Standard 5.2 Character Properties](http://www.unicode.org/versions/Unicode5.2.0/ch04.pdf).|\p{X}|`\p{Lu}` matches "T" and "D" in "Thomas Doe".|
57+
|Match a word boundary|`\b` (Outside a character class \b specifies a word boundary, and inside a character class specifies a backspace).|`\bin` matches "in" in "inside" but not "pinto".|
58+
|Match a line break (ie a carriage return followed by a new line).|\r?\n|`End\r?\nBegin` matches "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.|
59+
|Match any alphanumeric character|\w|`a\wd` matches "add" and "a1d" but not "a d".|
60+
|Match any whitespace character.|(?([^\r\n])\s)|`Public\sInterface` matches the phrase "Public Interface".|
61+
|Match any numeric character|\d|`\d` matches and "3" in "3456", "2" in 23", and "1" in "1".|
62+
|Match a Unicode character|\uXXXX where XXXX specifies the Unicode character value.|`\u0065` matches the character "e".|
63+
|Match an identifier|\b(_\w+&#124;[\w-[0-9\_]]\w*)\b|Matches "type1" but not &type1" or "#define".|
64+
|Match a string inside quotes|((\\".+?\\")&#124;('.+?'))|Matches any string inside single or double quotes.|
65+
|Match a hexadecimal number|\b0[xX]([0-9a-fA-F]\)\b|Matches "0xc67f" but not "0xc67fc67f".|
66+
|Match integers and decimals|\b[0-9]*\\.\*[0-9]+\b|Matches "1.333".|
67+
68+
> [!TIP]
69+
> In Windows operating systems, most lines end in "\r\n" (a carriage return followed by a new line). These characters are not visible, but are present in the editor and are passed to the .NET regular expression service.
7070
7171
## See also
7272

docs/ide/visual-studio-2017-for-dotnet-developers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ms.workload:
1919
[Documentation: Using IntelliSense](using-intellisense.md)
2020
[Documentation: Smart editor features](writing-code-in-the-code-and-text-editor.md)
2121

22-
Visual Studio has a deep understanding of your code via the Roslyn compiler to provide you with smart editing features like syntax colorization, code completion, spell-checking mistyped variables, unimported type resolution, outlining, structure visualizers, [CodeLens](find-code-changes-and-other-history-with-codelens.md), call hierarchy, hover-able quick info, parameter help, as well as tools for refactoring, applying quick actions, and generating code.
22+
Visual Studio has a deep understanding of your code via the .NET ("Roslyn") compiler to provide you with smart editing features like syntax colorization, code completion, spell-checking mistyped variables, unimported type resolution, outlining, structure visualizers, [CodeLens](find-code-changes-and-other-history-with-codelens.md), call hierarchy, hover-able quick info, parameter help, as well as tools for refactoring, applying quick actions, and generating code.
2323

2424
![Visual Studio smart code editor](../ide/media/VSIDE_Productivity_SmartCodeEditor.png "VSIDE_Productivity_SmartCodeEditor")
2525

docs/ide/visual-studio-ide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ You can view and manage your Azure-based cloud resources within Visual Studio us
258258

259259
If Visual Studio doesn't have the exact functionality you need, you can add it! You can personalize the IDE based on your workflow and style, add support for external tools not yet integrated with Visual Studio, and modify existing functionality to increase your productivity. To find the latest version of the Visual Studio Extensibility Tools (VS SDK), see [Visual Studio SDK](../extensibility/visual-studio-sdk.md).
260260

261-
You can use the .NET Compiler Platform (Roslyn) to write your own code analyzers and code generators. Find everything you need at [Roslyn](https://github.com/dotnet/Roslyn).
261+
You can use the .NET Compiler Platform ("Roslyn") to write your own code analyzers and code generators. Find everything you need at [Roslyn](https://github.com/dotnet/Roslyn).
262262

263263
Find [existing extensions](https://marketplace.visualstudio.com/vs) for Visual Studio created by Microsoft developers as well as our development community.
264264

docs/ide/visual-studio-performance-tips-and-tricks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Some tools or extensions may to turned off to improve performance.
8181
8282
### Managed Language Services (Roslyn)
8383

84-
For information about Roslyn performance considerations, see [Performance considerations for large solutions] (https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions).
84+
For information about .NET Compiler Platform ("Roslyn") performance considerations, see [Performance considerations for large solutions] (https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions).
8585

8686
- **Disable Full Solution Analysis**
8787

0 commit comments

Comments
 (0)