On Fri, 2008-12-19 at 01:41 -0800, Dave Arkley wrote:
> Just discovered Gendarme and am rather impresssed!
Thanks from everyone :)
> I'm using it against .net 2.0 and 3.5 assemblies on Vista x64.
>
> However I've spotted the following problem:
>
> --- TOF ---
>
> 3. CheckParametersNullityInVisibleMethodsRule [hide]
> Problem:
> A visible method does not check its parameter(s) for null values.
>
> Found in:
> Target: HFS.Core.LinqRepository.IRepository
> HFS.Core.LinqRepository.RepositoryFactory::CreateConnectedRepository
> (System.Data.Linq.DataContext)
> Assembly: HFS.Core.LinqRepository, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null
>
> Severity: High Confidence: Normal
> Location: context
> Source: ...\RepositoryFactory.cs(≈8)
>
>
> Solution:
> Since the caller is unkown you should always verify all of your
> parameters to protect yourself.
>
>
>
> Error is raised for code:
> if (null == context) throw new ArgumentNullException("context");
Ah! It's not a common pattern in Mono source code (the largest code base
that I use Gendarme against). The generated IL is likely a bit different
and not considered by the rule. I'll check this over the weekend.
> Error not raised when code is:
> if (context == null) throw new ArgumentNullException("context");
>
>
> --- EOF ---
>
> Let me know if you need any more info or this is posted in wrong
> place!
Thanks for reporting the issue (and a test case!). It's ok to report
bugs on the mailing-list, but it's a bit safer (i.e. much harder to
forget) when bugs are filled at http://bugzilla.novell.com
Sebastien
p.s. if you have a few minutes (it does not take long) there is a
survey about Gendarme in progress
http://www.surveymonkey.com/s.aspx?sm=jGWGrj0mJIYj4IfxEOGrpA_3d_3d