Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@xamarin.com>2013-04-28 19:54:59 +0400
committerSebastien Pouliot <sebastien@xamarin.com>2013-04-28 19:54:59 +0400
commitee8c91a062c60e9a22d357232dafc12b9fe673df (patch)
tree193447a5b4a1ca43cad48d0410c967f61fc9d0a5
parent16a47e11c3701a35be9898031205584b7ff74459 (diff)
Fix style (double tabs) and rework a condition
-rw-r--r--gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs27
-rw-r--r--gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs18
2 files changed, 22 insertions, 23 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs b/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs
index c7d74a5c..72a548ce 100644
--- a/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs
@@ -114,18 +114,17 @@ namespace Gendarme.Rules.Performance {
// scan all methods, including constructors, to find if the field is used
if (fields.Count > 0) {
CheckFieldsUsageInType (type);
- }
- // scan nested types becuase they also have access to private fields of their parent
- if (type.HasNestedTypes && fields.Count > 0) {
- foreach (TypeDefinition nested in type.NestedTypes) {
- CheckFieldsUsageInType (nested);
+ // scan nested types becuase they also have access to private fields of their parent
+ if (type.HasNestedTypes) {
+ foreach (TypeDefinition nested in type.NestedTypes)
+ CheckFieldsUsageInType (nested);
}
- }
- // check remaining (private) fields in the set
- foreach (FieldDefinition field in fields) {
- Runner.Report (field, Severity.Medium, Confidence.Normal);
+ // check remaining (private) fields in the set
+ foreach (FieldDefinition field in fields) {
+ Runner.Report (field, Severity.Medium, Confidence.Normal);
+ }
}
return Runner.CurrentRuleResult;
}
@@ -138,14 +137,14 @@ namespace Gendarme.Rules.Performance {
// don't check the method if it does not access any field
if (!OpCodeEngine.GetBitmask (method).Intersect (LoadStoreFields))
- continue;
+ continue;
foreach (Instruction ins in method.Body.Instructions) {
- FieldDefinition fd = ins.GetField ();
- if (fd == null)
- continue;
+ FieldDefinition fd = ins.GetField ();
+ if (fd == null)
+ continue;
- fields.Remove (fd);
+ fields.Remove (fd);
}
if (fields.Count == 0)
diff --git a/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs b/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs
index dbb9f153..98fbb3ad 100644
--- a/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs
+++ b/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs
@@ -164,23 +164,23 @@ namespace Test.Rules.Performance {
}
class FieldsUsedInNested {
- private bool field;
+ private bool field;
- private static string staticField;
+ private static string staticField;
- class Nested {
- public void Foo (FieldsUsedInNested parent)
- {
- FieldsUsedInNested.staticField = "bar";
- parent.field = true;
- }
+ class Nested {
+ public void Foo (FieldsUsedInNested parent)
+ {
+ FieldsUsedInNested.staticField = "bar";
+ parent.field = true;
}
+ }
}
[Test]
public void FieldsUsedInNestedType ()
{
- AssertRuleSuccess<FieldsUsedInNested> ();
+ AssertRuleSuccess<FieldsUsedInNested> ();
}
class CompilerGenerated {