Skip to content

Commit 0b8ad81

Browse files
committed
Implement RS0042 (Do not copy value)
1 parent d02078f commit 0b8ad81

19 files changed

+2379
-0
lines changed

src/Roslyn.Diagnostics.Analyzers/Core/AnalyzerReleases.Unshipped.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Rule ID | Category | Severity | Notes
33
--------|----------|----------|-------
44
RS0040 | RoslynDiagnosticsReliability | Warning | DefaultableTypeShouldHaveDefaultableFieldsAnalyzer
5+
RS0042 | RoslynDiagnosticsReliability | Warning | DoNotCopyValue
56

67
### Changed Rules
78
Rule ID | New Category | New Severity | Old Category | Old Severity | Notes

src/Roslyn.Diagnostics.Analyzers/Core/DoNotCopyValue.cs

+1,358
Large diffs are not rendered by default.

src/Roslyn.Diagnostics.Analyzers/Core/RoslynDiagnosticIds.cs

+1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ internal static class RoslynDiagnosticIds
4545
public const string RelaxTestNamingSuppressionRuleId = "RS0039";
4646
public const string DefaultableTypeShouldHaveDefaultableFieldsRuleId = "RS0040";
4747
public const string ObliviousPublicApiRuleId = "RS0041";
48+
public const string DoNotCopyValueRuleId = "RS0042";
4849
}
4950
}

src/Roslyn.Diagnostics.Analyzers/Core/RoslynDiagnosticsAnalyzersResources.resx

+33
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,37 @@
279279
<data name="DefaultableTypeShouldHaveDefaultableFieldsTitle" xml:space="preserve">
280280
<value>Defaultable types should have defaultable fields</value>
281281
</data>
282+
<data name="DoNotCopyValueDescription" xml:space="preserve">
283+
<value>Do not copy value</value>
284+
</data>
285+
<data name="DoNotCopyValueMessage" xml:space="preserve">
286+
<value>Do not copy value</value>
287+
</data>
288+
<data name="DoNotCopyValueTitle" xml:space="preserve">
289+
<value>Do not copy value</value>
290+
</data>
291+
<data name="DoNotCopyValueNoBoxingDescription" xml:space="preserve">
292+
<value>Do not box non-copyable value types.</value>
293+
</data>
294+
<data name="DoNotCopyValueNoBoxingMessage" xml:space="preserve">
295+
<value>Do not box non-copyable type '{0}'</value>
296+
</data>
297+
<data name="DoNotCopyValueUnsupportedUseDescription" xml:space="preserve">
298+
<value>Unsupported use of non-copyable type</value>
299+
</data>
300+
<data name="DoNotCopyValueUnsupportedUseMessage" xml:space="preserve">
301+
<value>Unsupported use of non-copyable type '{0}' in '{1}' operation</value>
302+
</data>
303+
<data name="DoNotCopyValueNoUnboxingDescription" xml:space="preserve">
304+
<value>Do not unbox non-copyable value types.</value>
305+
</data>
306+
<data name="DoNotCopyValueNoUnboxingMessage" xml:space="preserve">
307+
<value>Do not unbox non-copyable type '{0}'</value>
308+
</data>
309+
<data name="DoNotCopyValueAvoidNullableWrapperDescription" xml:space="preserve">
310+
<value>Avoid nullable wrapper</value>
311+
</data>
312+
<data name="DoNotCopyValueAvoidNullableWrapperMessage" xml:space="preserve">
313+
<value>Do not wrap non-copyable type '{0}' in '{1)' operation</value>
314+
</data>
282315
</root>

src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.cs.xlf

+55
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,61 @@
1717
<target state="translated">Typy, které se dají nastavit jako výchozí, by měly mít pole, která se tak dají nastavit taky</target>
1818
<note />
1919
</trans-unit>
20+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperDescription">
21+
<source>Avoid nullable wrapper</source>
22+
<target state="new">Avoid nullable wrapper</target>
23+
<note />
24+
</trans-unit>
25+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperMessage">
26+
<source>Do not wrap non-copyable type '{0}' in '{1)' operation</source>
27+
<target state="new">Do not wrap non-copyable type '{0}' in '{1)' operation</target>
28+
<note />
29+
</trans-unit>
30+
<trans-unit id="DoNotCopyValueDescription">
31+
<source>Do not copy value</source>
32+
<target state="new">Do not copy value</target>
33+
<note />
34+
</trans-unit>
35+
<trans-unit id="DoNotCopyValueMessage">
36+
<source>Do not copy value</source>
37+
<target state="new">Do not copy value</target>
38+
<note />
39+
</trans-unit>
40+
<trans-unit id="DoNotCopyValueNoBoxingDescription">
41+
<source>Do not box non-copyable value types.</source>
42+
<target state="new">Do not box non-copyable value types.</target>
43+
<note />
44+
</trans-unit>
45+
<trans-unit id="DoNotCopyValueNoBoxingMessage">
46+
<source>Do not box non-copyable type '{0}'</source>
47+
<target state="new">Do not box non-copyable type '{0}'</target>
48+
<note />
49+
</trans-unit>
50+
<trans-unit id="DoNotCopyValueNoUnboxingDescription">
51+
<source>Do not unbox non-copyable value types.</source>
52+
<target state="new">Do not unbox non-copyable value types.</target>
53+
<note />
54+
</trans-unit>
55+
<trans-unit id="DoNotCopyValueNoUnboxingMessage">
56+
<source>Do not unbox non-copyable type '{0}'</source>
57+
<target state="new">Do not unbox non-copyable type '{0}'</target>
58+
<note />
59+
</trans-unit>
60+
<trans-unit id="DoNotCopyValueTitle">
61+
<source>Do not copy value</source>
62+
<target state="new">Do not copy value</target>
63+
<note />
64+
</trans-unit>
65+
<trans-unit id="DoNotCopyValueUnsupportedUseDescription">
66+
<source>Unsupported use of non-copyable type</source>
67+
<target state="new">Unsupported use of non-copyable type</target>
68+
<note />
69+
</trans-unit>
70+
<trans-unit id="DoNotCopyValueUnsupportedUseMessage">
71+
<source>Unsupported use of non-copyable type '{0}' in '{1}' operation</source>
72+
<target state="new">Unsupported use of non-copyable type '{0}' in '{1}' operation</target>
73+
<note />
74+
</trans-unit>
2075
<trans-unit id="ExportedPartsShouldHaveImportingConstructorCodeFix_ImplicitConstructor">
2176
<source>Explicitly define the importing constructor</source>
2277
<target state="translated">Explicitně definujte importující konstruktor.</target>

src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.de.xlf

+55
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,61 @@
1717
<target state="translated">Auf den Standard festlegbare Typen müssen auf den Standard festlegbare Felder aufweisen.</target>
1818
<note />
1919
</trans-unit>
20+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperDescription">
21+
<source>Avoid nullable wrapper</source>
22+
<target state="new">Avoid nullable wrapper</target>
23+
<note />
24+
</trans-unit>
25+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperMessage">
26+
<source>Do not wrap non-copyable type '{0}' in '{1)' operation</source>
27+
<target state="new">Do not wrap non-copyable type '{0}' in '{1)' operation</target>
28+
<note />
29+
</trans-unit>
30+
<trans-unit id="DoNotCopyValueDescription">
31+
<source>Do not copy value</source>
32+
<target state="new">Do not copy value</target>
33+
<note />
34+
</trans-unit>
35+
<trans-unit id="DoNotCopyValueMessage">
36+
<source>Do not copy value</source>
37+
<target state="new">Do not copy value</target>
38+
<note />
39+
</trans-unit>
40+
<trans-unit id="DoNotCopyValueNoBoxingDescription">
41+
<source>Do not box non-copyable value types.</source>
42+
<target state="new">Do not box non-copyable value types.</target>
43+
<note />
44+
</trans-unit>
45+
<trans-unit id="DoNotCopyValueNoBoxingMessage">
46+
<source>Do not box non-copyable type '{0}'</source>
47+
<target state="new">Do not box non-copyable type '{0}'</target>
48+
<note />
49+
</trans-unit>
50+
<trans-unit id="DoNotCopyValueNoUnboxingDescription">
51+
<source>Do not unbox non-copyable value types.</source>
52+
<target state="new">Do not unbox non-copyable value types.</target>
53+
<note />
54+
</trans-unit>
55+
<trans-unit id="DoNotCopyValueNoUnboxingMessage">
56+
<source>Do not unbox non-copyable type '{0}'</source>
57+
<target state="new">Do not unbox non-copyable type '{0}'</target>
58+
<note />
59+
</trans-unit>
60+
<trans-unit id="DoNotCopyValueTitle">
61+
<source>Do not copy value</source>
62+
<target state="new">Do not copy value</target>
63+
<note />
64+
</trans-unit>
65+
<trans-unit id="DoNotCopyValueUnsupportedUseDescription">
66+
<source>Unsupported use of non-copyable type</source>
67+
<target state="new">Unsupported use of non-copyable type</target>
68+
<note />
69+
</trans-unit>
70+
<trans-unit id="DoNotCopyValueUnsupportedUseMessage">
71+
<source>Unsupported use of non-copyable type '{0}' in '{1}' operation</source>
72+
<target state="new">Unsupported use of non-copyable type '{0}' in '{1}' operation</target>
73+
<note />
74+
</trans-unit>
2075
<trans-unit id="ExportedPartsShouldHaveImportingConstructorCodeFix_ImplicitConstructor">
2176
<source>Explicitly define the importing constructor</source>
2277
<target state="translated">Importierenden Konstruktor explizit definieren</target>

src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.es.xlf

+55
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,61 @@
1717
<target state="translated">Los tipos defaultable deben tener campos defaultable</target>
1818
<note />
1919
</trans-unit>
20+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperDescription">
21+
<source>Avoid nullable wrapper</source>
22+
<target state="new">Avoid nullable wrapper</target>
23+
<note />
24+
</trans-unit>
25+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperMessage">
26+
<source>Do not wrap non-copyable type '{0}' in '{1)' operation</source>
27+
<target state="new">Do not wrap non-copyable type '{0}' in '{1)' operation</target>
28+
<note />
29+
</trans-unit>
30+
<trans-unit id="DoNotCopyValueDescription">
31+
<source>Do not copy value</source>
32+
<target state="new">Do not copy value</target>
33+
<note />
34+
</trans-unit>
35+
<trans-unit id="DoNotCopyValueMessage">
36+
<source>Do not copy value</source>
37+
<target state="new">Do not copy value</target>
38+
<note />
39+
</trans-unit>
40+
<trans-unit id="DoNotCopyValueNoBoxingDescription">
41+
<source>Do not box non-copyable value types.</source>
42+
<target state="new">Do not box non-copyable value types.</target>
43+
<note />
44+
</trans-unit>
45+
<trans-unit id="DoNotCopyValueNoBoxingMessage">
46+
<source>Do not box non-copyable type '{0}'</source>
47+
<target state="new">Do not box non-copyable type '{0}'</target>
48+
<note />
49+
</trans-unit>
50+
<trans-unit id="DoNotCopyValueNoUnboxingDescription">
51+
<source>Do not unbox non-copyable value types.</source>
52+
<target state="new">Do not unbox non-copyable value types.</target>
53+
<note />
54+
</trans-unit>
55+
<trans-unit id="DoNotCopyValueNoUnboxingMessage">
56+
<source>Do not unbox non-copyable type '{0}'</source>
57+
<target state="new">Do not unbox non-copyable type '{0}'</target>
58+
<note />
59+
</trans-unit>
60+
<trans-unit id="DoNotCopyValueTitle">
61+
<source>Do not copy value</source>
62+
<target state="new">Do not copy value</target>
63+
<note />
64+
</trans-unit>
65+
<trans-unit id="DoNotCopyValueUnsupportedUseDescription">
66+
<source>Unsupported use of non-copyable type</source>
67+
<target state="new">Unsupported use of non-copyable type</target>
68+
<note />
69+
</trans-unit>
70+
<trans-unit id="DoNotCopyValueUnsupportedUseMessage">
71+
<source>Unsupported use of non-copyable type '{0}' in '{1}' operation</source>
72+
<target state="new">Unsupported use of non-copyable type '{0}' in '{1}' operation</target>
73+
<note />
74+
</trans-unit>
2075
<trans-unit id="ExportedPartsShouldHaveImportingConstructorCodeFix_ImplicitConstructor">
2176
<source>Explicitly define the importing constructor</source>
2277
<target state="translated">Definir explícitamente el constructor de importación</target>

src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.fr.xlf

+55
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,61 @@
1717
<target state="translated">Les types par défaut doivent avoir des champs par défaut</target>
1818
<note />
1919
</trans-unit>
20+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperDescription">
21+
<source>Avoid nullable wrapper</source>
22+
<target state="new">Avoid nullable wrapper</target>
23+
<note />
24+
</trans-unit>
25+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperMessage">
26+
<source>Do not wrap non-copyable type '{0}' in '{1)' operation</source>
27+
<target state="new">Do not wrap non-copyable type '{0}' in '{1)' operation</target>
28+
<note />
29+
</trans-unit>
30+
<trans-unit id="DoNotCopyValueDescription">
31+
<source>Do not copy value</source>
32+
<target state="new">Do not copy value</target>
33+
<note />
34+
</trans-unit>
35+
<trans-unit id="DoNotCopyValueMessage">
36+
<source>Do not copy value</source>
37+
<target state="new">Do not copy value</target>
38+
<note />
39+
</trans-unit>
40+
<trans-unit id="DoNotCopyValueNoBoxingDescription">
41+
<source>Do not box non-copyable value types.</source>
42+
<target state="new">Do not box non-copyable value types.</target>
43+
<note />
44+
</trans-unit>
45+
<trans-unit id="DoNotCopyValueNoBoxingMessage">
46+
<source>Do not box non-copyable type '{0}'</source>
47+
<target state="new">Do not box non-copyable type '{0}'</target>
48+
<note />
49+
</trans-unit>
50+
<trans-unit id="DoNotCopyValueNoUnboxingDescription">
51+
<source>Do not unbox non-copyable value types.</source>
52+
<target state="new">Do not unbox non-copyable value types.</target>
53+
<note />
54+
</trans-unit>
55+
<trans-unit id="DoNotCopyValueNoUnboxingMessage">
56+
<source>Do not unbox non-copyable type '{0}'</source>
57+
<target state="new">Do not unbox non-copyable type '{0}'</target>
58+
<note />
59+
</trans-unit>
60+
<trans-unit id="DoNotCopyValueTitle">
61+
<source>Do not copy value</source>
62+
<target state="new">Do not copy value</target>
63+
<note />
64+
</trans-unit>
65+
<trans-unit id="DoNotCopyValueUnsupportedUseDescription">
66+
<source>Unsupported use of non-copyable type</source>
67+
<target state="new">Unsupported use of non-copyable type</target>
68+
<note />
69+
</trans-unit>
70+
<trans-unit id="DoNotCopyValueUnsupportedUseMessage">
71+
<source>Unsupported use of non-copyable type '{0}' in '{1}' operation</source>
72+
<target state="new">Unsupported use of non-copyable type '{0}' in '{1}' operation</target>
73+
<note />
74+
</trans-unit>
2075
<trans-unit id="ExportedPartsShouldHaveImportingConstructorCodeFix_ImplicitConstructor">
2176
<source>Explicitly define the importing constructor</source>
2277
<target state="translated">Définir explicitement le constructeur d'importation</target>

src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.it.xlf

+55
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,61 @@
1717
<target state="translated">I tipi defaultable devono avere campi defaultable</target>
1818
<note />
1919
</trans-unit>
20+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperDescription">
21+
<source>Avoid nullable wrapper</source>
22+
<target state="new">Avoid nullable wrapper</target>
23+
<note />
24+
</trans-unit>
25+
<trans-unit id="DoNotCopyValueAvoidNullableWrapperMessage">
26+
<source>Do not wrap non-copyable type '{0}' in '{1)' operation</source>
27+
<target state="new">Do not wrap non-copyable type '{0}' in '{1)' operation</target>
28+
<note />
29+
</trans-unit>
30+
<trans-unit id="DoNotCopyValueDescription">
31+
<source>Do not copy value</source>
32+
<target state="new">Do not copy value</target>
33+
<note />
34+
</trans-unit>
35+
<trans-unit id="DoNotCopyValueMessage">
36+
<source>Do not copy value</source>
37+
<target state="new">Do not copy value</target>
38+
<note />
39+
</trans-unit>
40+
<trans-unit id="DoNotCopyValueNoBoxingDescription">
41+
<source>Do not box non-copyable value types.</source>
42+
<target state="new">Do not box non-copyable value types.</target>
43+
<note />
44+
</trans-unit>
45+
<trans-unit id="DoNotCopyValueNoBoxingMessage">
46+
<source>Do not box non-copyable type '{0}'</source>
47+
<target state="new">Do not box non-copyable type '{0}'</target>
48+
<note />
49+
</trans-unit>
50+
<trans-unit id="DoNotCopyValueNoUnboxingDescription">
51+
<source>Do not unbox non-copyable value types.</source>
52+
<target state="new">Do not unbox non-copyable value types.</target>
53+
<note />
54+
</trans-unit>
55+
<trans-unit id="DoNotCopyValueNoUnboxingMessage">
56+
<source>Do not unbox non-copyable type '{0}'</source>
57+
<target state="new">Do not unbox non-copyable type '{0}'</target>
58+
<note />
59+
</trans-unit>
60+
<trans-unit id="DoNotCopyValueTitle">
61+
<source>Do not copy value</source>
62+
<target state="new">Do not copy value</target>
63+
<note />
64+
</trans-unit>
65+
<trans-unit id="DoNotCopyValueUnsupportedUseDescription">
66+
<source>Unsupported use of non-copyable type</source>
67+
<target state="new">Unsupported use of non-copyable type</target>
68+
<note />
69+
</trans-unit>
70+
<trans-unit id="DoNotCopyValueUnsupportedUseMessage">
71+
<source>Unsupported use of non-copyable type '{0}' in '{1}' operation</source>
72+
<target state="new">Unsupported use of non-copyable type '{0}' in '{1}' operation</target>
73+
<note />
74+
</trans-unit>
2075
<trans-unit id="ExportedPartsShouldHaveImportingConstructorCodeFix_ImplicitConstructor">
2176
<source>Explicitly define the importing constructor</source>
2277
<target state="translated">Definire esplicitamente il costruttore di importazione</target>

0 commit comments

Comments
 (0)