Gendarme Report

Produced on 4/5/2008 8:45:34 PM UTC.

Table of contents

1  Summary
  1.1  List of assemblies searched
  1.2  List of rules used
2  Reported defects
  2.1 MathMinMaxCandidateRule

Summary

Gendarme found 32 defects using 1 rules.

List of assemblies analyzed

List of rules used

Assembly:

Type:

Method:

Reported Defects

MathMinMaxCandidateRule

Problem:

This method seems to include code duplicating Math.Min or Math.Max functionality.

Found in:

Target: System.Int64 System.Math::Min(System.Int64,System.Int64)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(311,0)

Target: System.Drawing.Rectangle System.Windows.Forms.ListBox::GetItemRectangle(System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs(820,0)

Target: System.Int32 System.Text.RegularExpressions.Mark::get_Index()
Assembly: System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/System/System.Text.RegularExpressions/compiler.cs(447,0)

Target: System.Int64 System.Math::Max(System.Int64,System.Int64)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(213,0)

Target: System.Byte System.Math::Min(System.Byte,System.Byte)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(265,0)

Target: System.Int32 System.Windows.Forms.Theme::Clamp(System.Int32,System.Int32,System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs(574,0)

Target: System.SByte System.Math::Min(System.SByte,System.SByte)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(320,0)

Target: System.Double System.Math::Min(System.Double,System.Double)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(284,0)

Target: System.Void System.Data.DataColumnCollection::MoveColumn(System.Int32,System.Int32)
Assembly: System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/System.Data/System.Data/DataColumnCollection.cs(744,0)

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/System.Data/System.Data/DataColumnCollection.cs(743,0)

Target: C5.TreeSet`1/Node<T> C5.TreeSet`1::maketreer(C5.TreeSet`1/Node<T>&,System.Int32,System.Int32,System.Int32)
Assembly: Mono.C5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba07f434b1c35cbd

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Mono.C5/C5/trees/RedBlackTreeSet.cs(1161,0)

Target: System.UInt32 System.Math::Min(System.UInt32,System.UInt32)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(337,0)

Target: System.Byte System.Math::Max(System.Byte,System.Byte)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(167,0)

Target: System.SByte System.Math::Max(System.SByte,System.SByte)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(222,0)

Target: System.Void System.Windows.Forms.DataGrid::ShiftSelection(System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs(2505,0)

Target: System.UInt32 System.Math::Max(System.UInt32,System.UInt32)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(239,0)

Target: System.Int16 System.Math::Min(System.Int16,System.Int16)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(328,0)

Target: System.Void System.Windows.Forms.DataGrid::ScrollToRow(System.Int32,System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs(2555,0)

Target: System.Single System.Math::Min(System.Single,System.Single)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(295,0)

Target: System.UInt64 System.Math::Min(System.UInt64,System.UInt64)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(346,0)

Target: System.Int16 System.Math::Max(System.Int16,System.Int16)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(230,0)

Target: C5.TreeBag`1/Node<T> C5.TreeBag`1::maketreer(C5.TreeBag`1/Node<T>&,System.Int32,System.Int32,System.Int32)
Assembly: Mono.C5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba07f434b1c35cbd

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Mono.C5/C5/trees/RedBlackTreeBag.cs(1161,0)

Target: System.Single System.Math::Max(System.Single,System.Single)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(197,0)

Target: System.UInt64 System.Math::Max(System.UInt64,System.UInt64)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(248,0)

Target: System.Int32 System.Math::Min(System.Int32,System.Int32)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(303,0)

Target: System.UInt16 System.Math::Min(System.UInt16,System.UInt16)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(355,0)

Target: System.Double System.Math::Max(System.Double,System.Double)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(186,0)

Target: System.Int32 System.Math::Max(System.Int32,System.Int32)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(205,0)

Target: System.Void System.Windows.Forms.ListBox::SelectExtended(System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs(1690,0)

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs(1691,0)

Target: System.Int32 System.Windows.Forms.Theming.Default.CheckBoxPainter::Clamp(System.Int32,System.Int32,System.Int32)
Assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/CheckBoxPainter.cs(349,0)

Target: System.UInt16 System.Math::Max(System.UInt16,System.UInt16)
Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Severity: Medium  Confidence: Normal
Source: /home/poupou/svn/mcs/class/corlib/System/Math.cs(257,0)

Solution:

The JIT can inline the Math.Min and Math.Max methods which provides better performance compared to custom, inline, implementations.