diff options
author | rokklobster <37376850+rokklobster@users.noreply.github.com> | 2022-09-26 12:17:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 12:17:43 +0300 |
commit | 781f6734ef55c91cfb0f75f7d1bb4bfbbda16738 (patch) | |
tree | 7ea5b6757cbd88ef9f7f60d96bce11e74fbeedc5 | |
parent | 8e265af7cd665457281f4f9e375be32ac1b8ec99 (diff) |
* Fix errors arising from NullableAttribute analysis
* Fix indentation
Co-authored-by: Andrey Sayapin <103108530+an-sayapin@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
-rw-r--r-- | gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs | 4 | ||||
-rw-r--r-- | gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs b/gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs index 26717ab7..f1dc1fee 100644 --- a/gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs +++ b/gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs @@ -61,6 +61,10 @@ namespace Gendarme.Framework { public void Add (string rule, IMetadataTokenProvider metadata) { + if (rule is null) { + Console.Error.WriteLine("Attempted to add null rule"); + return; + } HashSet<IMetadataTokenProvider> list; if (!ignore.TryGetValue (rule, out list)) { list = new HashSet<IMetadataTokenProvider> (); diff --git a/gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs b/gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs index cc037aa3..1a803c97 100644 --- a/gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs +++ b/gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs @@ -126,7 +126,11 @@ namespace Gendarme.Rules.Design { continue; foreach (ParameterDefinition param in constructor.Parameters) { - // pascal case it + // pascal case it + if (param.Name.Length == 0) { + Console.Error.WriteLine("Unexpected empty constructor parameter.\n Type: {0}\n Method: {1}", type.FullName, constructor); + continue; + } string correspondingPropertyName = Char.ToUpper (param.Name [0], CultureInfo.InvariantCulture).ToString (CultureInfo.InvariantCulture) + param.Name.Substring (1); if (!allProperties.Contains (correspondingPropertyName)) { |