Welcome to MSDN Blogs Sign in | Join | Help

New for Visual Studio 2008 - Spelling rules

Surprisingly, one the biggest requests for Code Analysis in Visual Studio 2005 was to include the spelling rules that shipped with the FxCop standalone. We had Microsoft consultants tell us that they actually had trouble moving some customers from FxCop to Code Analysis because they were not included. Apparently teams care about spelling. :)

Well, we've listened and I'm glad to tell you that we are shipping the following rules in Visual Studio 2008:

IdentifiersShouldBeSpelledCorrectly
CompoundWordsShouldBeCasedCorrectly
ResourceStringsShouldBeSpelledCorrectly
ResourceStringCompoundWordsShouldBeCasedCorrectly

These new rules (along with the rest of the previously FxCop-only rules) now cause the analysis in Visual Studio 2008 to become a true superset of what is available in FxCop.

API Rules 

By default, the IdentifiersShouldBeSpelledCorrectly and CompoundWordsShouldBeCasedCorrectly, which both fire on the naming of API members, use the installed language of Visual Studio to determine the locale to spell check the identifiers in. To customize this, simply add the <CodeAnalysisCulture> MSBuild property to your project with a culture representing the language of the API you are writing:

CodeAnalysisCulture MSBuild property

It is advisable to explicitly specify above when you have developers working on different languages versions of Visual Studio. Unfortunately, due to some complex licensing reasons, we were only able to ship the English lexicons so only the English-based (en-US, en-GB, en-CA and en-AU in particular) cultures actually affect the spell checker. All other cultures cause the rules to silently disable themselves.

Resource Rules 

The <CodeAnalysisCulture> property is used to indicate the language of your API identifiers; it is not, however, used to determine the language of your ResX-based resources. Instead, for these we use the same mechanism that the runtime uses (or more correctly, what the ResourceManager uses) to locate resources; the AssemblyCultureAttribute and the NeutralResourcesLanguageAttribute attributes. The former is applied to satellitte assemblies and should never be placed on an assembly with code. Whereas, the later is applied to an assembly with code to indicate the neutral culture of the assembly. These attributes are simply applied at the assembly level and are usually placed in each language's associated AssemblyInfo.cs/AssemblyInfo.vb file. The same cultures as above are supported.

Without one of these attributes on your assembly, the resources contained within it will never be checked by ResourceStringsShouldBeSpelledCorrectly and ResourceStringCompoundWordsShouldBeCasedCorrectly. Luckily, If you forget to apply the attribute, Mark assemblies with NeutralResourceLanguageAttribute, a new performance rule we've added, will remind you.

As you start to running the spelling rules - you might find that you need to add to the list of words that it recognizes - in the next post I will talk about the new custom dictionary support that we've added to Visual Studio 2008.

Published Sunday, August 12, 2007 7:00 AM by David M. Kean

Comments

Sunday, August 12, 2007 7:18 PM by ,,,

# re: New for Visual Studio 2008 - Spelling rules

speeling nazis everywher rejoice!

Sunday, August 12, 2007 8:00 PM by Paul

# re: New for Visual Studio 2008 - Spelling rules

[quote]

English-based (en-US, en-GB, en-CA and en-AU in particular) cultures

[/quote]

Don't forget en-NZ! :-)

Sunday, August 12, 2007 8:09 PM by David M. Kean

# re: New for Visual Studio 2008 - Spelling rules

Paul: I mentioned only en-US, en-GB, en-CA and en-AU because they actually have distinct lexicons for each one of them. Unfortunately, similar to Microsoft Office 2003 (I'm not sure about 2007), choosing New Zealand falls back to the default English culture, which, in Code Analysis, is en-US.

Wednesday, August 15, 2007 11:20 AM by Jeff Beehler's Blog

# New spelling features added

David Kean recently posted an article announcing new spelling support for Code Analysis in Team System

Friday, August 17, 2007 1:28 AM by From the software development trenches

# Izindaba #5

Time for another weekly roundup of news that focuses on .NET and general development related content

Monday, August 20, 2007 10:05 AM by Noticias externas

# New for Visual Studio 2008 - Custom Dictionaries

Once you turn on the new spelling rules that we&#39;ve added to Visual Studio 2008, you will want to

Wednesday, August 22, 2007 1:58 PM by The Visual Studio Code Analysis Team Blog

# New for Visual Studio 2008 - Custom Dictionaries

Once you turn on the new spelling rules that we've added to Visual Studio 2008, you will want to start

Monday, November 19, 2007 12:35 PM by Jeff Beehler's Blog

# Visual Studio Team System 2008 ships!

What else can I say? The big day has arrived (read the official word here on Soma's blog ) and we're

Friday, November 23, 2007 5:22 AM by From the software development trenches

# FxCop

In previous posts about Code Metrics and Code Reviews , I explored some metrics and techniques that I

Sunday, November 25, 2007 2:12 PM by From the software development trenches

# FxCop

In previous posts about Code Metrics and Code Reviews , I explored some metrics and techniques that I

Wednesday, December 19, 2007 2:28 PM by Paraesthesia

# FxCop 1.35 Spell Checking Uses Office 2003

FxCop 1.35 Spell Checking Uses Office 2003

Sunday, December 23, 2007 7:45 AM by Jeff Beehler's Blog

# Visual Studio Team System 2008 ships!

What else can I say? The big day has arrived (read the official word here on Soma's blog ) and we're

Sunday, March 09, 2008 5:45 PM by Yo sólo pasaba por aquí pero ya que estoy....

# Novedades en Visual Studio Team System 2008

Como muchos ya sabréis hace poco Microsoft lanzó al mercado Visual Studio 2008. Si estáis interesados

New Comments to this post are disabled
 
Page view tracker