Skip to content

Commit bf2674f

Browse files
authored
Add code analysis code action fixes (#9202)
* Add code analysis code action fixes
1 parent 9cc30c2 commit bf2674f

13 files changed

+899
-172
lines changed

Extension/package.json

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"onCommand:C_Cpp.RunCodeAnalysisOnActiveFile",
7474
"onCommand:C_Cpp.RunCodeAnalysisOnOpenFiles",
7575
"onCommand:C_Cpp.RunCodeAnalysisOnAllFiles",
76-
"onCommand:C_Cpp.ClearCodeAnalysisSquiggles",
76+
"onCommand:C_Cpp.RemoveAllCodeAnalysisProblems",
7777
"onDebugResolve:cppdbg",
7878
"onDebugResolve:cppvsdbg",
7979
"workspaceContains:/.vscode/c_cpp_properties.json",
@@ -416,6 +416,36 @@
416416
},
417417
"scope": "resource"
418418
},
419+
"C_Cpp.codeAnalysis.clangTidy.codeAction.showClear": {
420+
"type": "string",
421+
"description": "%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.description%",
422+
"enum": [
423+
"None",
424+
"AllOnly",
425+
"AllAndAllType",
426+
"AllAndAllTypeAndThis"
427+
],
428+
"enumDescriptions": [
429+
"%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.None.description%",
430+
"%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllOnly.description%",
431+
"%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllAndAllType.description%",
432+
"%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllAndAllTypeAndThis.description%"
433+
],
434+
"default": "AllAndAllTypeAndThis",
435+
"scope": "application"
436+
},
437+
"C_Cpp.codeAnalysis.clangTidy.codeAction.showDisable": {
438+
"type": "boolean",
439+
"markdownDescription": "%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showDisable.markdownDescription%",
440+
"default": true,
441+
"scope": "application"
442+
},
443+
"C_Cpp.codeAnalysis.clangTidy.codeAction.showDocumentation": {
444+
"type": "boolean",
445+
"markdownDescription": "%c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showDocumentation.markdownDescription%",
446+
"default": true,
447+
"scope": "application"
448+
},
419449
"C_Cpp.codeAnalysis.runAutomatically": {
420450
"type": "boolean",
421451
"markdownDescription": "%c_cpp.configuration.codeAnalysis.runAutomatically.markdownDescription%",
@@ -473,6 +503,7 @@
473503
"enum": [
474504
"*",
475505
"abseil-*",
506+
"abseil-cleanup-ctad",
476507
"abseil-duration-*",
477508
"abseil-duration-addition",
478509
"abseil-duration-comparison",
@@ -567,9 +598,11 @@
567598
"bugprone-string-constructor",
568599
"bugprone-string-integer-assignment",
569600
"bugprone-string-literal-with-embedded-nul",
601+
"bugprone-stringview-nullptr",
570602
"bugprone-suspicious-*",
571603
"bugprone-suspicious-enum-usage",
572604
"bugprone-suspicious-include",
605+
"bugprone-suspicious-memory-comparison",
573606
"bugprone-suspicious-memset-usage",
574607
"bugprone-suspicious-missing-comma",
575608
"bugprone-suspicious-semicolon",
@@ -604,13 +637,17 @@
604637
"cert-env33-c",
605638
"cert-err*",
606639
"cert-err09-cpp",
640+
"cert-err33-c",
607641
"cert-err34-c",
608642
"cert-err52-cpp",
609643
"cert-err58-cpp",
610644
"cert-err60-cpp",
611645
"cert-err61-cpp",
646+
"cert-exp42-c",
612647
"cert-fio38-c",
648+
"cert-flp*",
613649
"cert-flp30-c",
650+
"cert-flp37-c",
614651
"cert-mem57-cpp",
615652
"cert-msc*",
616653
"cert-msc30-c",
@@ -622,7 +659,9 @@
622659
"cert-oop54-cpp",
623660
"cert-oop57-cpp",
624661
"cert-oop58-cpp",
662+
"cert-pos*",
625663
"cert-pos44-c",
664+
"cert-pos47-c",
626665
"cert-sig30-c",
627666
"cert-str34-c",
628667
"clang-analyzer-*",
@@ -763,6 +802,7 @@
763802
"cppcoreguidelines-pro-type-vararg",
764803
"cppcoreguidelines-slicing",
765804
"cppcoreguidelines-special-member-functions",
805+
"cppcoreguidelines-virtual-class-destructor",
766806
"darwin-*",
767807
"darwin-avoid-spinlock",
768808
"darwin-dispatch-once-nonstatic",
@@ -853,6 +893,9 @@
853893
"llvmlibc-restrict-system-libc-headers",
854894
"misc-*",
855895
"misc-definitions-in-headers",
896+
"misc-misleading-*",
897+
"misc-misleading-bidirectional",
898+
"misc-misleading-identifier",
856899
"misc-misplaced-const",
857900
"misc-new-delete-overloads",
858901
"misc-no-recursion",
@@ -910,6 +953,7 @@
910953
"mpi-buffer-deref",
911954
"mpi-type-mismatch",
912955
"objc-*",
956+
"objc-assert-equals",
913957
"objc-avoid-nserror-init",
914958
"objc-dealloc-in-category",
915959
"objc-forbidden-subclassing",
@@ -947,13 +991,19 @@
947991
"readability-avoid-const-params-in-decls",
948992
"readability-braces-around-statements",
949993
"readability-const-return-type",
994+
"readability-container-*",
995+
"readability-container-contains",
996+
"readability-container-data-pointer",
950997
"readability-container-size-empty",
951998
"readability-convert-member-functions-to-static",
952999
"readability-delete-null-pointer",
1000+
"readability-duplicate-include",
9531001
"readability-else-after-return",
9541002
"readability-function-*",
9551003
"readability-function-cognitive-complexity",
9561004
"readability-function-size",
1005+
"readability-identifier-*",
1006+
"readability-identifier-length",
9571007
"readability-identifier-naming",
9581008
"readability-implicit-bool-conversion",
9591009
"readability-inconsistent-declaration-parameter-name",
@@ -983,6 +1033,7 @@
9831033
"readability-static-accessed-through-instance",
9841034
"readability-static-definition-in-anonymous-namespace",
9851035
"readability-string-compare",
1036+
"readability-suspicious-call-argument",
9861037
"readability-uniqueptr-delete-release",
9871038
"readability-uppercase-literal-suffix",
9881039
"readability-use-anyofallof",
@@ -999,6 +1050,7 @@
9991050
"enum": [
10001051
"*",
10011052
"abseil-*",
1053+
"abseil-cleanup-ctad",
10021054
"abseil-duration-*",
10031055
"abseil-duration-addition",
10041056
"abseil-duration-comparison",
@@ -1093,9 +1145,11 @@
10931145
"bugprone-string-constructor",
10941146
"bugprone-string-integer-assignment",
10951147
"bugprone-string-literal-with-embedded-nul",
1148+
"bugprone-stringview-nullptr",
10961149
"bugprone-suspicious-*",
10971150
"bugprone-suspicious-enum-usage",
10981151
"bugprone-suspicious-include",
1152+
"bugprone-suspicious-memory-comparison",
10991153
"bugprone-suspicious-memset-usage",
11001154
"bugprone-suspicious-missing-comma",
11011155
"bugprone-suspicious-semicolon",
@@ -1130,13 +1184,17 @@
11301184
"cert-env33-c",
11311185
"cert-err*",
11321186
"cert-err09-cpp",
1187+
"cert-err33-c",
11331188
"cert-err34-c",
11341189
"cert-err52-cpp",
11351190
"cert-err58-cpp",
11361191
"cert-err60-cpp",
11371192
"cert-err61-cpp",
1193+
"cert-exp42-c",
11381194
"cert-fio38-c",
1195+
"cert-flp*",
11391196
"cert-flp30-c",
1197+
"cert-flp37-c",
11401198
"cert-mem57-cpp",
11411199
"cert-msc*",
11421200
"cert-msc30-c",
@@ -1148,7 +1206,9 @@
11481206
"cert-oop54-cpp",
11491207
"cert-oop57-cpp",
11501208
"cert-oop58-cpp",
1209+
"cert-pos*",
11511210
"cert-pos44-c",
1211+
"cert-pos47-c",
11521212
"cert-sig30-c",
11531213
"cert-str34-c",
11541214
"clang-analyzer-*",
@@ -1289,6 +1349,7 @@
12891349
"cppcoreguidelines-pro-type-vararg",
12901350
"cppcoreguidelines-slicing",
12911351
"cppcoreguidelines-special-member-functions",
1352+
"cppcoreguidelines-virtual-class-destructor",
12921353
"darwin-*",
12931354
"darwin-avoid-spinlock",
12941355
"darwin-dispatch-once-nonstatic",
@@ -1379,6 +1440,9 @@
13791440
"llvmlibc-restrict-system-libc-headers",
13801441
"misc-*",
13811442
"misc-definitions-in-headers",
1443+
"misc-misleading-*",
1444+
"misc-misleading-bidirectional",
1445+
"misc-misleading-identifier",
13821446
"misc-misplaced-const",
13831447
"misc-new-delete-overloads",
13841448
"misc-no-recursion",
@@ -1436,6 +1500,7 @@
14361500
"mpi-buffer-deref",
14371501
"mpi-type-mismatch",
14381502
"objc-*",
1503+
"objc-assert-equals",
14391504
"objc-avoid-nserror-init",
14401505
"objc-dealloc-in-category",
14411506
"objc-forbidden-subclassing",
@@ -1473,13 +1538,19 @@
14731538
"readability-avoid-const-params-in-decls",
14741539
"readability-braces-around-statements",
14751540
"readability-const-return-type",
1541+
"readability-container-*",
1542+
"readability-container-contains",
1543+
"readability-container-data-pointer",
14761544
"readability-container-size-empty",
14771545
"readability-convert-member-functions-to-static",
14781546
"readability-delete-null-pointer",
1547+
"readability-duplicate-include",
14791548
"readability-else-after-return",
14801549
"readability-function-*",
14811550
"readability-function-cognitive-complexity",
14821551
"readability-function-size",
1552+
"readability-identifier-*",
1553+
"readability-identifier-length",
14831554
"readability-identifier-naming",
14841555
"readability-implicit-bool-conversion",
14851556
"readability-inconsistent-declaration-parameter-name",
@@ -1509,6 +1580,7 @@
15091580
"readability-static-accessed-through-instance",
15101581
"readability-static-definition-in-anonymous-namespace",
15111582
"readability-string-compare",
1583+
"readability-suspicious-call-argument",
15121584
"readability-uniqueptr-delete-release",
15131585
"readability-uppercase-literal-suffix",
15141586
"readability-use-anyofallof",
@@ -2736,8 +2808,8 @@
27362808
"category": "C/C++"
27372809
},
27382810
{
2739-
"command": "C_Cpp.ClearCodeAnalysisSquiggles",
2740-
"title": "%c_cpp.command.ClearCodeAnalysisSquiggles.title%",
2811+
"command": "C_Cpp.RemoveAllCodeAnalysisProblems",
2812+
"title": "%c_cpp.command.RemoveAllCodeAnalysisProblems.title%",
27412813
"category": "C/C++"
27422814
},
27432815
{

Extension/package.nls.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"c_cpp.command.RunCodeAnalysisOnActiveFile.title": "Run Code Analysis on Active File",
2525
"c_cpp.command.RunCodeAnalysisOnOpenFiles.title": "Run Code Analysis on Open Files",
2626
"c_cpp.command.RunCodeAnalysisOnAllFiles.title": "Run Code Analysis on All Files",
27-
"c_cpp.command.ClearCodeAnalysisSquiggles.title": "Clear Code Analysis Squiggles",
27+
"c_cpp.command.RemoveAllCodeAnalysisProblems.title": "Clear All Code Analysis Problems",
2828
"c_cpp.command.BuildAndDebugFile.title": "Debug C/C++ File",
2929
"c_cpp.command.BuildAndRunFile.title": "Run C/C++ File",
3030
"c_cpp.command.AddDebugConfiguration.title": "Add Debug Configuration",
@@ -43,6 +43,13 @@
4343
"c_cpp.configuration.codeAnalysis.excludeBoolean.markdownDescription": { "message": "The glob pattern to match file paths against. Set to `true` or `false` to enable or disable the pattern.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
4444
"c_cpp.configuration.codeAnalysis.excludeWhen.markdownDescription": { "message": "Additional check on the siblings of a matching file. Use `$(basename)` as variable for the matching file name.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
4545
"c_cpp.configuration.codeAnalysis.runAutomatically.markdownDescription": { "message": "If `true`, code analysis will run automatically on a file after it is opened or saved.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
46+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showDisable.markdownDescription": { "message": "If `true`, the 'Disable' code action will be shown when available (the next time code analysis is run). When the 'Disable' code action is used, it adds the warning code to the `C_Cpp.codeAnalysis.clangTidy.checks.disabled` setting.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
47+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showDocumentation.markdownDescription": { "message": "If `true`, the 'Show Documentation for' code action will be shown when available (the next time code analysis is run).", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
48+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.description": "Controls which 'Clear' code analysis problem code action options are available. Changing the setting to show more options may require re-running code analysis.",
49+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.None.description": "Show no 'Clear' code actions.",
50+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllOnly.description": "Show only the 'Clear all' code action (or 'Clear all <type>' if there is only one type or 'Clear this' if there is only one problem).",
51+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllAndAllType.description": "Show the 'Clear all' code action (if there are multiple problem types) and the 'Clear all <type>' code action (or 'Clear this' if there is only one problem for the <type>)",
52+
"c_cpp.configuration.codeAnalysis.clangTidy.codeAction.showClear.AllAndAllTypeAndThis.description": "Show the 'Clear all' (if there are multiple problem types), 'Clear all <type>' (if there are multiple problems for the <type>), and 'Clear this' code actions",
4653
"c_cpp.configuration.codeAnalysis.clangTidy.enabled.markdownDescription": { "message": "If `true`, code analysis using `clang-tidy` will be enabled and run automatically if `#C_Cpp.codeAnalysis.runAutomatically#` is `true` (the default).", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
4754
"c_cpp.configuration.codeAnalysis.clangTidy.path.markdownDescription": { "message": "The full path of the `clang-tidy` executable. If not specified, and `clang-tidy` is available in the environment path, that is used. If not found in the environment path, the `clang-tidy` bundled with the extension will be used.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
4855
"c_cpp.configuration.codeAnalysis.clangTidy.config.markdownDescription": { "message": "Specifies a `clang-tidy` configuration in YAML/JSON format: `{Checks: '-*,clang-analyzer-*', CheckOptions: [{key: x, value: y}]}`. When the value is empty, `clang-tidy` will attempt to find a file named `.clang-tidy` for each source file in its parent directories.", "comment": [ "Words 'key' and 'value' in '{key: value, ...}' should be translated, but all other markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },

0 commit comments

Comments
 (0)