You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-quality/code-metrics-cyclomatic-complexity.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Code metrics - Cyclomatic complexity
3
-
ms.date: 5/7/2021
3
+
ms.date: 12/10/2024
4
4
description: Explore the cyclomatic complexity metric for code metrics in Visual Studio and estimate the difficulty to test, maintain, and troubleshoot your code.
5
5
ms.topic: conceptual
6
6
author: mikejo5000
@@ -25,33 +25,33 @@ Notice the cyclomatic complexity is at 2 (the lowest value possible). If you add
25
25
26
26

27
27
28
-
If you add a decision, the cyclomatic complexity value goes up by 1:
28
+
If you add a decision, the cyclomatic complexity value goes up by one:
29
29
30
30

31
31
32
-
When you change the if statement to a switch statement with 4 decisions to be made then, it goes from the original 2 to 6:
32
+
When you change the if statement to a switch statement with four decisions to be made then, it goes from the original two to six:
33
33
34
34

35
35
36
36
Let's take a look at a (hypothetical) larger code base.
37
37
38
38

39
39
40
-
Notice that most of the items, as you drill down into the Products_Related class, have a value of 1 but a couple of them have a complexity of 5. By itself, this might not be a big deal, but given that most other members have a 1 in the same class, you should definitely look closer at those two items and see what is in them. You can do this by right-clicking the item and choosing **Go To Source Code** from the context menu. Take a closer look at `Product.set(Product)`:
40
+
Notice that most of the items, as you drill down into the Products_Related class, have a value of one but a couple of them have a complexity of five. By itself, this difference might not be a big deal, but given that most other members have a one in the same class, you should definitely look closer at those two items and see what is in them. You can do take a closer look by right-clicking the item and choosing **Go To Source Code** from the context menu. Take a closer look at `Product.set(Product)`:
41
41
42
42

43
43
44
-
Given all the if statements, you can see why the cyclomatic complexity is at a 5. At this point, you might decide that this is an acceptable level of complexity, or you might refactor to reduce the complexity.
44
+
Given all the if statements, you can see why the cyclomatic complexity is at a five. At this point, you might decide that this result is an acceptable level of complexity, or you might refactor to reduce the complexity.
45
45
46
46
## The Magic Number
47
47
48
-
As with many metrics in this industry, there is no exact cyclomatic complexity limit that fits all organizations. However, [NIST235](#nist235) does indicate that a limit of 10 is a good starting point:
48
+
As with many metrics in this industry, there's no exact cyclomatic complexity limit that fits all organizations. However, [NIST235](#nist235) does indicate that a limit of 10 is a good starting point:
49
49
50
-
"The precise number to use as a limit, however, remains somewhat controversial. The original limit of 10 as proposed by McCabe has significant supporting evidence, but limits as high as 15 have been used successfully as well. Limits over 10 should be reserved for projects that have several operational advantages over typical projects, for example experienced staff, formal design, a modern programming language, structured programming, code walkthroughs, and a comprehensive test plan. In other words, an organization can pick a complexity limit greater than 10, but only if it is sure it knows what it is doing and is willing to devote the additional testing effort required by more complex modules." [NIST235](#nist235)
50
+
"The precise number to use as a limit, however, remains somewhat controversial. The original limit of 10 as proposed by McCabe has significant supporting evidence, but limits as high as 15 have been used successfully as well. Limits over 10 should be reserved for projects that have several operational advantages over typical projects, for example experienced staff, formal design, a modern programming language, structured programming, code walkthroughs, and a comprehensive test plan. In other words, an organization can pick a complexity limit greater than 10, but only if it's sure it knows what it's doing and is willing to devote the additional testing effort required by more complex modules." [NIST235](#nist235)
51
51
52
52
## Cyclomatic Complexity and Line Numbers
53
53
54
-
Just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There is some basic truth to the idea that the more lines of code in a function, the more likely it is to have errors. However, when you combine cyclomatic complexity with lines of code, then you have a much clearer picture of the potential for errors.
54
+
Just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There's some basic truth to the idea that the more lines of code in a function, the more likely it's to have errors. However, when you combine cyclomatic complexity with lines of code, then you have a much clearer picture of the potential for errors.
55
55
56
56
As described by the Software Assurance Technology Center (SATC) at NASA:
Copy file name to clipboardExpand all lines: docs/containers/deploy-app-service.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,8 @@ ms.author: ghogen
14
14
15
15
This tutorial walks you through using Visual Studio to publish your containerized ASP.NET Core web application to an [Azure App Service](/azure/app-service). Azure App Service is an appropriate service for a single-container web app hosted in Azure.
16
16
17
+
You can also deploy to [Azure Container Apps](/azure/container-apps/overview). For a tutorial, see [Deploy to Azure Container Apps using Visual Studio](/azure/container-apps/deploy-visual-studio).
18
+
17
19
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/dotnet/?utm_source=acr-publish-doc&utm_medium=docs&utm_campaign=docs) before you begin.
Copy file name to clipboardExpand all lines: docs/containers/launch-profiles.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,14 @@ manager: mijacobs
6
6
ms.subservice: container-tools
7
7
ms.devlang: dotnet
8
8
ms.topic: how-to
9
-
ms.date: 10/08/2021
9
+
ms.date: 12/10/2024
10
10
ms.author: ghogen
11
11
monikerRange: ">=vs-2019"
12
12
---
13
13
14
14
# Launch a subset of Compose services
15
15
16
-
If you have an application that consists of multiple services and uses Docker Compose, you can configure which services run and debug by creating or editing an existing launch profile in Docker Compose launch settings. Launch profiles allow you to dynamically run only the services that matter to your current scenario. You can create and select from launch profiles in order to customize your debugging experience and set specific launch actions such as `Browser Launch URL`. You will also have the option of either choosing each service individually or by choosing a Docker Compose profile, which also looks at your Compose file to determine the group of services to run.
16
+
If you have an application that consists of multiple services and uses Docker Compose, you can configure which services run and debug by creating or editing an existing launch profile in Docker Compose launch settings. Launch profiles allow you to dynamically run only the services that matter to your current scenario. You can create and select from launch profiles in order to customize your debugging experience and set specific launch actions such as `Browser Launch URL`. You also have the option of either choosing each service individually or by choosing a Docker Compose profile, which also looks at your Compose file to determine the group of services to run.
17
17
18
18
For information about Docker Compose profiles, see [Using profiles with Compose](https://docs.docker.com/compose/profiles/).
19
19
@@ -97,7 +97,7 @@ The next example demonstrates selecting between individual services instead of f
97
97
98
98

99
99
100
-
And this information will be saved in *launchSettings.json* as shown below
100
+
And this information is saved in *launchSettings.json* as shown below
101
101
102
102
```json
103
103
{
@@ -124,14 +124,14 @@ And this information will be saved in *launchSettings.json* as shown below
124
124
125
125
You can also further customize launch behaviors by creating Visual Studio launch profiles that make use of the Compose profiles.
126
126
127
-
To create another profile that makes use of the Compose profile, select **Use Docker Compose profiles** and choose `web1`. Now the launch profile includes three services – `webapplication1` (which belongs to both `web` and `web1` Compose profiles), `external1` and `external2`. By default, the services without source code such as `external1` and `external2` have the default action of **Start without debugging**. .NET applications with source code will default to **Start debugging**.
127
+
To create another profile that makes use of the Compose profile, select **Use Docker Compose profiles** and choose `web1`. Now the launch profile includes three services: `webapplication1` (which belongs to both `web` and `web1` Compose profiles), `external1`, and `external2`. By default, the services without source code such as `external1` and `external2` have the default action of **Start without debugging**. .NET applications with source code defaults to **Start debugging**.
128
128
129
129
> [!IMPORTANT]
130
-
> If a service doesn't specify a Compose profile, it will be included in all Compose profiles implicitly.
130
+
> If a service doesn't specify a Compose profile, it's included in all Compose profiles implicitly.
131
131
132
132

133
133
134
-
This information will be saved as shown in the following code. The configuration for the service and its default action are not saved unless you change the default action.
134
+
This information is saved as shown in the following code. The configuration for the service and its default action are not saved unless you change the default action.
135
135
136
136
```json
137
137
{
@@ -172,7 +172,7 @@ You can also change the action of webapplication1 to **Start without debugging**
172
172
173
173
## Properties
174
174
175
-
Here is a description of each property in the *launchSettings.json*:
175
+
Here's a description of each property in the *launchSettings.json*:
Copy file name to clipboardExpand all lines: docs/data-tools/connect-to-data-in-an-access-database-windows-forms.md
+4-54Lines changed: 4 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,9 @@ Connect to databases created with Microsoft 365, Access 2016, Access 2013, Acces
100
100

101
101
102
102
14. On 64-bit machines with the 64-bit Access database engine, you need to ensure that the application runs as a 64-bit application. Open the project properties (press **Alt**+**Enter** or right-click on the project node, and select **Properties**). In the **Build** tab, clear the **Prefer 32-bit** checkbox.
103
+
104
+
The connection string is stored in *app.config*, and in the *Settings.settings* file under **Properties** in Solution Explorer.
105
+
103
106
:::moniker-end
104
107
105
108
:::moniker range="vs-2019"
@@ -197,60 +200,7 @@ Connect to databases created with Access 2000-2003 by using the following proced
197
200
198
201
## View the generated code
199
202
200
-
The data tools are configured to generate a lot of code automatically when you perform certain operations in the Form Designer. For example, when you drag and drop a table onto the form, a `DataGridView` is added and code is created to hook up the data with the control. You can view this code in the `*.Designer.cs` file. Visual Studio adds a number of private members:
If you expand the hidden region, you can see that Visual Studio also adds a large amount of code to set up the `DataGridView` control with data binding to the table you dragged to the form.
236
-
237
-
Also, in the main form code-behind file, Visual Studio adds code that processes the save action to save interactive changes to the data, and the code that loads the table into the table adapter.
The data tools are configured to generate a lot of code automatically when you perform certain operations in the Form Designer. For example, when you drag and drop a table onto the form, a `DataGridView` is added and code is created to hook up the data with the control. You can view this code in the `*.Designer.cs` file. The generated code may differ depending on your version of Visual Studio.
254
204
255
205
Congratulations! With a little help from Visual Studio, you've created a form-based editing experience for an Access data table.
0 commit comments