rspec/rules/S4581/description.adoc

8 lines
446 B
Plaintext
Raw Normal View History

2022-04-22 17:08:57 +02:00
When the syntax `new Guid()` (i.e. parameterless instantiation) is used, it must be that one of three things is wanted:
2021-05-13 01:16:52 +00:00
2022-04-22 17:08:57 +02:00
. An empty GUID, in which case `Guid.Empty` is clearer.
. A randomly-generated GUID, in which case `Guid.NewGuid()` should be used.
2021-05-13 01:16:52 +00:00
. A new GUID with a specific initialization, in which case the initialization parameter is missing.
2022-04-22 17:08:57 +02:00
This rule raises an issue when a parameterless instantiation of the `Guid` struct is found.