Agent Smith Code Style Validation Plugin

Hi,

I written Agent Smith plugin with customizable naming convention validation
and quickfixes(Most FxCop naming convention rules can be configured), catch
or specify enforcement via xml comments, class member order validation and
some other features.

More information is available at http://www.agentsmithplugin.com

Thanks


6 comments
Comment actions Permalink

Hello Sergey,

when ReSharper build 312 loads your plugin it throws an exception (see
below).


Sincerely,
Stefan Lieser


JetBrains.ReSharper.Util.InternalErrorException: An exception has been
thrown during component initialization
An exception has occurred --->
JetBrains.ReSharper.Util.InternalErrorException: An exception has been
thrown during component initialization --->
System.MissingMethodException: Method not found: 'Void
JetBrains.ReSharper.Psi.CodeStyle.CodeStyleSettingsManager.RegisterCodeStyleType(System.Type,
System.String)'.
at AgentSmith.Options.CodeStyleSettingsRegistrar.Init()
at
JetBrains.ReSharper.Component.ComponentContainer.InitializeComponent(IComponent
component, XmlElement configurationElement) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line 183
at
JetBrains.ReSharper.Component.ComponentContainer.InitializeComponentIfNeeded(IComponent
component) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line 141
--- End of inner exception stack trace ---

at JetBrains.ReSharper.Util.InternalErrorException..ctor(String,
Exception) in
c:\Agent\work\ReSharper-Main\src\Util\src\InternalErrorException.cs:line
28 column 7
at
JetBrains.ReSharper.Component.ComponentContainer.InitializeComponentIfNeeded(IComponent)
in c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
145 column 9
at
JetBrains.ReSharper.Component.ComponentContainer.GetComponentByImplType(Type)
in c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
349 column 9
at JetBrains.ReSharper.Component.ComponentContainer.GetComponents() in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
364 column 9
at
JetBrains.ReSharper.Component.ComponentContainer.JetBrains.ReSharper.Component.IComponentLoadingHandler.ComponentsLoaded(List`1,
Dictionary2`2) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
471 column 7
at
JetBrains.ReSharper.Component.MyTypeLoadingHandler.TypesLoaded(ICollection`1,
ICollection`1) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentDescriptorsCache.cs:line
87 column 51
at
JetBrains.ReSharper.Shell.AssemblyManager.DispatchLoadAssembliesToHandler(ICollection`1,
ITypeLoadingHandler) in
c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 102
column 5
at
JetBrains.ReSharper.Shell.AssemblyManager.LoadAssemblies(ICollection`1)
in c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 88
column 9
at JetBrains.ReSharper.Shell.AssemblyManager.LoadAssemblies(Assembly[])
in c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 66
column 5
at JetBrains.ReSharper.Shell.ShellBase.LoadAssemblies(Assembly[]) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ShellBase.cs:line 80 column 5
at
JetBrains.ReSharper.Shell.PluginSupport.PluginManager.UpdatePluginState(Plugin)
in
c:\Agent\work\ReSharper-Main\src\Shell\src\PluginSupport\PluginManager.cs:line
212 column 5
at
JetBrains.ReSharper.Shell.PluginSupport.PluginsTableForm.myOkButton_Click(Object,
EventArgs) in
c:\Agent\work\ReSharper-Main\src\Shell\src\PluginSupport\PluginsTableForm.cs:line
288 column 34
at System.Windows.Forms.Control.OnClick(EventArgs)
at System.Windows.Forms.Button.OnClick(EventArgs)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs)
at System.Windows.Forms.Control.WmMouseUp(Message&, MouseButtons, Int32)
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ButtonBase.WndProc(Message&)
at System.Windows.Forms.Button.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32,
IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&)
at System.Windows.Forms.ThreadContext.LocalModalMessageLoop(Form)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32,
ApplicationContext)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32,
ApplicationContext)
at System.Windows.Forms.Form.ShowDialog(IWin32Window)
at JetBrains.ReSharper.Actions.ShowPluginsAction.Execute(IDataContext,
DelegateExecute) in
c:\Agent\work\ReSharper-Main\src\CommonActions\src\Actions\ShowPluginsAction.cs:line
18 column 5
at
JetBrains.ReSharper.ActionManagement.ExecutableAction.Execute(IDataContext)
in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\Action\ExecutableAction.cs:line
25 column 13
at
JetBrains.ReSharper.ActionManagement.ActionManagerBase.ExecuteAction(IExecutableAction,
IDataContext) in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\ActionManager\ActionManagerBase.cs:line
530 column 11
at
JetBrains.ReSharper.ActionManagement.ActionManagerBase.ExecuteAction(IExecutableAction)
in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\ActionManager\ActionManagerBase.cs:line
510 column 5
at JetBrains.VSAddin.ActionManagement.VSActionManager.Exec(String,
vsCommandExecOption, Object&, Object&, Boolean&) in
c:\Agent\work\ReSharper-Main\src\VSAddin\src\ActionManagement\VSActionManager.cs:line
480 column 11
at JetBrains.VSAddin.AbstractAddIn.Exec(String, vsCommandExecOption,
Object&, Object&, Boolean&) in
c:\Agent\work\ReSharper-Main\src\VSAddin\src\Connect.cs:line 260 column 7


--- End of inner exception stack trace ---

at JetBrains.ReSharper.Util.Logger.LogExceptionEx(Exception, String,
Boolean) in c:\Agent\work\ReSharper-Main\src\Util\src\Logger.cs:line 350
column 9
at JetBrains.ReSharper.Util.Logger.LogException(Exception) in
c:\Agent\work\ReSharper-Main\src\Util\src\Logger.cs:line 362 column 5
at
JetBrains.ReSharper.Component.ComponentContainer.InitializeComponentIfNeeded(IComponent)
in c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
145 column 9
at
JetBrains.ReSharper.Component.ComponentContainer.GetComponentByImplType(Type)
in c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
349 column 9
at JetBrains.ReSharper.Component.ComponentContainer.GetComponents() in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
364 column 9
at
JetBrains.ReSharper.Component.ComponentContainer.JetBrains.ReSharper.Component.IComponentLoadingHandler.ComponentsLoaded(List`1,
Dictionary2`2) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentContainer.cs:line
471 column 7
at
JetBrains.ReSharper.Component.MyTypeLoadingHandler.TypesLoaded(ICollection`1,
ICollection`1) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ComponentDescriptorsCache.cs:line
87 column 51
at
JetBrains.ReSharper.Shell.AssemblyManager.DispatchLoadAssembliesToHandler(ICollection`1,
ITypeLoadingHandler) in
c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 102
column 5
at
JetBrains.ReSharper.Shell.AssemblyManager.LoadAssemblies(ICollection`1)
in c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 88
column 9
at JetBrains.ReSharper.Shell.AssemblyManager.LoadAssemblies(Assembly[])
in c:\Agent\work\ReSharper-Main\src\Shell\src\AssemblyManager.cs:line 66
column 5
at JetBrains.ReSharper.Shell.ShellBase.LoadAssemblies(Assembly[]) in
c:\Agent\work\ReSharper-Main\src\Shell\src\ShellBase.cs:line 80 column 5
at
JetBrains.ReSharper.Shell.PluginSupport.PluginManager.UpdatePluginState(Plugin)
in
c:\Agent\work\ReSharper-Main\src\Shell\src\PluginSupport\PluginManager.cs:line
212 column 5
at
JetBrains.ReSharper.Shell.PluginSupport.PluginsTableForm.myOkButton_Click(Object,
EventArgs) in
c:\Agent\work\ReSharper-Main\src\Shell\src\PluginSupport\PluginsTableForm.cs:line
288 column 34
at System.Windows.Forms.Control.OnClick(EventArgs)
at System.Windows.Forms.Button.OnClick(EventArgs)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs)
at System.Windows.Forms.Control.WmMouseUp(Message&, MouseButtons, Int32)
at System.Windows.Forms.Control.WndProc(Message&)
at System.Windows.Forms.ButtonBase.WndProc(Message&)
at System.Windows.Forms.Button.WndProc(Message&)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32,
IntPtr, IntPtr)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&)
at System.Windows.Forms.ThreadContext.LocalModalMessageLoop(Form)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32,
ApplicationContext)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32,
ApplicationContext)
at System.Windows.Forms.Form.ShowDialog(IWin32Window)
at JetBrains.ReSharper.Actions.ShowPluginsAction.Execute(IDataContext,
DelegateExecute) in
c:\Agent\work\ReSharper-Main\src\CommonActions\src\Actions\ShowPluginsAction.cs:line
18 column 5
at
JetBrains.ReSharper.ActionManagement.ExecutableAction.Execute(IDataContext)
in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\Action\ExecutableAction.cs:line
25 column 13
at
JetBrains.ReSharper.ActionManagement.ActionManagerBase.ExecuteAction(IExecutableAction,
IDataContext) in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\ActionManager\ActionManagerBase.cs:line
530 column 11
at
JetBrains.ReSharper.ActionManagement.ActionManagerBase.ExecuteAction(IExecutableAction)
in
c:\Agent\work\ReSharper-Main\src\ActionManagement\src\ActionManager\ActionManagerBase.cs:line
510 column 5
at JetBrains.VSAddin.ActionManagement.VSActionManager.Exec(String,
vsCommandExecOption, Object&, Object&, Boolean&) in
c:\Agent\work\ReSharper-Main\src\VSAddin\src\ActionManagement\VSActionManager.cs:line
480 column 11
at JetBrains.VSAddin.AbstractAddIn.Exec(String, vsCommandExecOption,
Object&, Object&, Boolean&) in
c:\Agent\work\ReSharper-Main\src\VSAddin\src\Connect.cs:line 260 column 7

0
Comment actions Permalink

ReSharper error highlighting engine wouldn't shown any warnings inside some
pre-configured regions, such as "Windows Forms Generated Code"

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"flipdoubt" <flipdoubt@nospam.com> wrote in message
news:da27a8e4492c78c8e684f735cf08@news.jetbrains.com...

Thanks for the plugin.

>

How do you make exceptions for methods provided by VS.NET that do not
conform? For example, a private method named InitializeComponent created
by the WinForms desginer violates the rule that private methods should be
camel-cased. It would be nice if I could make an exception for the
"InitalizeComponent" method and the "components" field inserted by old
VS.NET code.

>



0
Comment actions Permalink

Hello Eugene,

Unfortunately, this is not enough. For example, designer generates "components"
field which should have this name regardless of your code style. So, warning
should be suppressed for this field too.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


EP> ReSharper error highlighting engine wouldn't shown any warnings
EP> inside some pre-configured regions, such as "Windows Forms Generated
EP> Code"
EP>


0
Comment actions Permalink

ReSharper error highlighting engine wouldn't shown any warnings inside
some pre-configured regions, such as "Windows Forms Generated Code"


First, I'm still getting Agent Smith warnings in the "Windows Forms Generated
Code" region. I created many of these forms in VS.NET 2003, so they are not
in partial classes or anything like that. Could that be affecting what I see?

Second, is there a listing of these special regions? Is there a config file
where I can add or remove regions?


0
Comment actions Permalink

What you can do right away is add "InitializeComponents " and "components"
names as exclusions to exclusions list on Naming Convention Settings page.
That will however ignore all "InitializeComponents" names, not only those
generated by VS.

Thanks.

"flipdoubt" <flipdoubt@nospam.com> wrote in message
news:da27a8e4492c78c8e684f735cf08@news.jetbrains.com...

Thanks for the plugin.

>

How do you make exceptions for methods provided by VS.NET that do not
conform? For example, a private method named InitializeComponent created
by the WinForms desginer violates the rule that private methods should be
camel-cased. It would be nice if I could make an exception for the
"InitalizeComponent" method and the "components" field inserted by old
VS.NET code.

>



0

Please sign in to leave a comment.