Skip to content

Commit 4d0a6a7

Browse files
TylerMSFTTylerMSFT
authored andcommitted
draft
1 parent 43b0191 commit 4d0a6a7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

docs/ide/lnt-make-member-function-const.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ monikerRange: ">=msvc-170"
88
---
99
# `make-member-function-const`
1010

11-
When member functions don’t modify their object state, annotate them with the `const` keyword. This guidance comes from the [C++ Core Guideline Con.2](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#con2-by-default-make-member-functions-const).
11+
When member functions don’t modify the object's state, annotate them with the `const` keyword. This guidance comes from the [C++ Core Guideline Con.2](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#con2-by-default-make-member-functions-const).
1212

1313
## Example
1414

@@ -33,7 +33,7 @@ double getRadius()
3333

3434
## How to fix the issue
3535

36-
The solution proposed by the linter is to mark member functions `const` when they don't modify the object's state. This provides a clear indication to both developers and the compiler that the function is safe to call on `const` objects.
36+
The solution proposed by the linter is to mark member functions `const` when they don't modify the object's state. This let's both developers and the compiler know that the function is safe to call on a `const` object.
3737

3838
In the following example, `const` has been added to `getValue()` and `getRadius()`:
3939

@@ -59,7 +59,7 @@ double getRadius() const // added const
5959

6060
The editor can make this change for you. Place the cursor on the flagged symbol and choose **Show potential fixes** and then **Make member const**:
6161

62-
:::image type="content" source="media/make-member-function-const.png" alt-text="Screenshot of the editor suggesting to make member const." :::
62+
:::image type="complex" source="media/make-member-function-const.png" alt-text="Screenshot of the editor suggesting to make member const." :::
6363
The cursor is on the line int getValue() and **Show potential fixes** appeared and was chosen. Now **Make member const** is visible and it shows the get value function with const added to it. You can now choose **Make member const** to make the change.
6464
:::image-end:::
6565

@@ -69,7 +69,7 @@ Make this change for all flagged member functions.
6969

7070
This check focuses on `const` usage for member functions in C++ code. The C++ Core Guidelines recommends marking member functions as `const` when they don't modify the object's state.
7171

72-
The current implementation of this check allows for the assignment of `const` to member functions after their declaration. It's a good practice to declare member functions as `const` from the beginning if they don't modify the object's state.
72+
The current implementation of this check allows you to add `const` to member functions after their declaration. It's a good practice to declare member functions as `const` from the beginning if they don't modify the object's state.
7373

7474
## See also
7575

docs/ide/lnt-int-naming-convention.md renamed to docs/ide/lnt-naming-convention.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
title: int-naming-convention
3-
description: "Reference for Visual Studio C++ IntelliSense Linter check int-naming-convention."
2+
title: lnt-naming-convention
3+
description: "Reference for Visual Studio C++ IntelliSense Linter check lnt-naming-convention."
44
ms.date: 09/27/2023
5-
f1_keywords: ["int-naming-convention"]
6-
helpviewer_keywords: ["int-naming-convention"]
5+
f1_keywords: ["lnt-naming-convention"]
6+
helpviewer_keywords: ["lnt-naming-convention"]
77
monikerRange: ">=msvc-170"
88
---
9-
# `int-naming-convention`
9+
# `lnt-naming-convention`
1010

1111
Ensure that the naming convention for symbols aligns with the coding style specified in the project's `.editorconfig` file.
1212

1313
To enable this feature, add an `.editorconfig` file in the same directory as your project file. The `.editorconfig` specifies the naming conventions for symbols in your project. For an example `.editorconfig` that specifies the naming conventions for Unreal Engine projects, see this example on [GitHub](https://raw.githubusercontent.com/microsoft/vc-ue-extensions/main/Source/.editorconfig).
1414

15-
Once you have the `.editorconfig` file in your project, turn on the `int-naming-convention` check with the **Naming Convention** setting in the C/C++ Code Style options. For information about how to change this setting, see [Configure the linter](cpp-linter-overview.md#configure-the-linter).
15+
Once you have the `.editorconfig` file in your project, turn on the `lnt-naming-convention` check with the **Naming Convention** setting in the C/C++ Code Style options. For information about how to change this setting, see [Configure the linter](cpp-linter-overview.md#configure-the-linter).
1616

1717
## Example
1818

@@ -21,9 +21,9 @@ Given an `editorconfig` file that contains:
2121
```
2222
cpp_naming_style.boolean_style.capitalization = pascal_case
2323
cpp_naming_style.boolean_style.required_prefix = b
24-
``````
24+
```
2525

26-
The linter will flag the following code:
26+
The linter will flag the following code because it isn't prefixed with 'b' and it isn't Pascal case, as specified in the `.editorconfig` file:
2727

2828
```cpp
2929
void example()
@@ -34,7 +34,7 @@ void example()
3434

3535
## How to fix the issue
3636

37-
Change the naming to match the style specified in the `.editorconfig`. For example:
37+
Change the naming to match the style specified in the `.editorconfig`:
3838

3939
```cpp
4040
void example()
@@ -45,13 +45,13 @@ void example()
4545

4646
The editor can make the change for you. Place the cursor on the flagged symbol. Choose **Show potential fixes** and then **Apply naming convention**:
4747

48-
:::image type="complex" source="media/int-naming-convention-apply-naming-convention.png" alt-text="Screenshot of the IDE suggesting applying naming convention.":::
48+
:::image type="complex" source="media/lnt-naming-convention-apply-naming-convention.png" alt-text="Screenshot of the IDE suggesting applying naming convention.":::
4949
The code editor shows bool myFlag = true. With the cursor on that line of code, **Show potential fixes** appeared and was chosen. Now **Apply naming convention** is visible and it shows bool my Flag = true in red and the suggested change, bool b My Flag, in green. You can now choose **Apply naming convention** to change the flagged code to bool b My Flag = true.
5050
:::image-end:::
5151

5252
## Remarks
5353

54-
The `int-naming-convention` linter check ensures that naming conventions align with naming conventions specified in the `editorconfig` file. You can apply this check to any project that has an `editorconfig` file. You can also customize your `.editorconfig` file to suit your project's coding style.
54+
The `lnt-naming-convention` linter check ensures that naming conventions align with naming conventions specified in the `editorconfig` file. You can apply this check to any project that has an `editorconfig` file. You can also customize your `.editorconfig` file to suit your project's coding style.
5555

5656
## See also
5757

docs/ide/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ items:
3030
href: ../ide/lnt-integer-float-division.md
3131
- name: lnt-logical-bitwise-mismatch
3232
href: ../ide/lnt-logical-bitwise-mismatch.md
33-
- name: lnt-int-naming-convention
34-
href: ../ide/lnt-int-naming-convention.md
3533
- name: lnt-make-member-function-const
3634
href: ../ide/lnt-make-member-function-const.md
35+
- name: lnt-naming-convention
36+
href: ../ide/lnt-naming-convention.md
3737
- name: lnt-uninitialized-local
3838
href: ../ide/lnt-uninitialized-local.md
3939
- name: Change signature

0 commit comments

Comments
 (0)