Custom Dictionary Location

Developer
Sep 17, 2012 at 3:16 AM
Edited Sep 17, 2012 at 3:17 AM

From http://www.stylecop.com/docs/SA1650.html:

The CustomDictionary.xml file shoud be placed in the same folder as the StyleCop.dll
and the Rules. That folder (and all subfolders) are checked for the dictionary files.

Is it possible to also put the CustomDictionary.xml file next to the Settings.StyleCop file so that custom words for a particular solution can be used only for that solution, and added to source control for auditing, build servers, etc?

Thanks.

Sep 17, 2012 at 7:31 AM

Maybe the Settings.StyleCop file itself should support the custom dictionary. It is after all the configuration file for StyleCop for that solution/project. It would be a shame to have yet another file that needs to be synchronised around the place.

Developer
Sep 17, 2012 at 8:28 AM

Another idea could be to be able to reference a custom dictionary in the settings file, that way a dictionary could be shared with other tools.

Oh - great minds: http://stylecop.codeplex.com/workitem/7401

Sep 17, 2012 at 1:32 PM

I haven't looked at the format of the file, but if it supports the same schema as the FxCop custom dictionary then this could work well. I already have one of those in my solution so pointing to a relative path in Settings.StyleCop would be good.

I'd also be interested to know how the spell checker picks up culture. It is defaulting to en-US but my machine is en-AU. I am aware that this is supported in FxCop by manually editing the proj file to add a msbuild property to identify the culture of the project.

Coordinator
Sep 17, 2012 at 1:57 PM
Culture is set in the settings file.

Default is en-US


~A.

On 17 Sep 2012, at 13:32, rprimrose <notifications@codeplex.com> wrote:

From: rprimrose

I haven't looked at the format of the file, but if it supports the same schema as the FxCop custom dictionary then this could work well. I already have one of those in my solution so pointing to a relative path in Settings.StyleCop would be good.

I'd also be interested to know how the spell checker picks up culture. It is defaulting to en-US but my machine is en-AU. I am aware that this is supported in FxCop by manually editing the proj file to add a msbuild property to identify the culture of the project.

Coordinator
Sep 17, 2012 at 2:00 PM
Edited Sep 17, 2012 at 2:08 PM
I'm adding support for specifying the words directly in the settings.stylecop file.
This is better because of the way settings can be merged and also they are cached for analysis and reloaded when changed already.


~A.
Sep 17, 2012 at 2:04 PM
That would be great. Any chance of including a quick fix for adding a word into Settings.StyleCop as unknown words are discovered? I imagine that devs will burn a lot of time jumping between code and the settings file to add new words.
Coordinator
Sep 17, 2012 at 2:08 PM

You'll be able to add them in the Settings editor.

Developer
Sep 17, 2012 at 9:16 PM

Thanks andyr - you rock!

Nov 23, 2012 at 10:16 AM

You might think about using a CustomDictionary.xml that is already linked into the project with the build action "CodeAnalysisDictionary", too. Maybe you can simply merge the recognized words into the words managed by StyleCop. We are using the CustomDictionary.xml already for other tools (e.g. FXCop), so the need to manage the words in a Settings.StyleCop doubles the work in this area.

Jan 17, 2013 at 2:29 PM

I just upgraded from StyleCop version 4.7.30.0 to 4.7.44.0 and now when I run style cop in Visual Studio 2012 it ignores CustomDictionary.xml files that I have embedded within a project.  The new version does work correctly if you update the global CustomDictionary.xml file installed on the hard drive but this is not acceptable for my team as we have unique custom dictionaries for each project.  This appears to be a bug in the version 4.7.44.0 software so I'm rolling back to the 4.7.30.0 version until it is resolved. 

Jan 31, 2013 at 10:39 AM
Matzen wrote:
You might think about using a CustomDictionary.xml that is already linked into the project with the build action "CodeAnalysisDictionary", too. Maybe you can simply merge the recognized words into the words managed by StyleCop. We are using the CustomDictionary.xml already for other tools (e.g. FXCop), so the need to manage the words in a Settings.StyleCop doubles the work in this area.
This gets my vote - reuse the current custom dictionary definition method.