# Gendarme Report

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

# Summary

Gendarme found 32 defects using 1 rules.

## List of assemblies analyzed

- /home/poupou/svn/mcs/class/lib/net_2_0/Accessibility.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/ByteFX.Data.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Commons.Xml.Relaxng.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/cscompmgd.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/CustomMarshalers.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/FirebirdSql.Data.Firebird.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.CJK.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.MidEast.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.Other.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.Rare.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/I18N.West.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/ICSharpCode.SharpZipLib.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.Build.Engine.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.Build.Framework.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.Build.Tasks.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.Build.Utilities.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.JScript.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.VisualBasic.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.VisualC.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Microsoft.Vsa.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.C5.dll: 2 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Cairo.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.CompilerServices.SymbolWriter.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.SqliteClient.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.Sqlite.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.SybaseClient.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.TdsClient.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Data.Tds.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.GetOptions.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Http.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Mozilla.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Posix.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Security.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Security.Win32.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Mono.Web.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/mscorlib.dll: 20 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Novell.Directory.Ldap.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/Npgsql.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/nunit.core.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/nunit.framework.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/nunit.mocks.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/nunit.util.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/OpenSystem.C.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/PEAPI.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Configuration.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Configuration.Install.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Core.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Data.dll: 1 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Data.Linq.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Data.OracleClient.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Design.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.DirectoryServices.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.dll: 1 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Drawing.Design.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Drawing.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.EnterpriseServices.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Management.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Messaging.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Runtime.Remoting.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Runtime.Serialization.Formatters.Soap.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Security.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.ServiceProcess.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Transactions.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Web.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Web.Extensions.Design.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Web.Extensions.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Web.Services.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Windows.Forms.dll: 6 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Xml.dll: 0 defects
- /home/poupou/svn/mcs/class/lib/net_2_0/System.Xml.Linq.dll: 0 defects

## List of rules used

Assembly:

- None

Type:

- None

Method:

- Gendarme.Rules.Performance.MathMinMaxCandidateRule : 32 defects

# Reported Defects

### 1 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.