My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

Agent Johnson Plugin

Plugin for JetBrains Resharper.

Named after the excellent Agent Smith plugin by Sergey Zyuzin.

Agent Johnson 2.0.0 Configuration Changes in Resharper 6.1

Agent Johnson for Resharper 6.1 will use a different approach to configuration. There will no longer be any entries in the Resharper Options dialog.

Instead Agent Johnson will use custom attributes on the assembly, much the same way Value Analysis attributes are used.

Include a class like this (the namespace does not matter as it only looks for the class name):

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = true)]
public sealed class ReSharperSettingAttribute : Attribute
{
  public ReSharperSettingAttribute(string name, object value)
  {
    this.Name = name;
    this.Value = value;
  }

  public string Name { get; set; }
  public object Value { get; set; }
}

and add these lines to the AssemblyInfo.cs file (or any other file for that matter):

[assembly: ReSharperSetting("IntroduceStringConstant.GenerateXmlComments", true)]
[assembly: ReSharperSetting("IntroduceStringConstant.ReplaceMode", 1)]
[assembly: ReSharperSetting("IntroduceStringConstant.TargetClass", "Product.Texts")]
[assembly: ReSharperSetting("CodeAnnotations.PublicAssertion", "Assert.ArgumentNotNull({0}, \"{0}\");")]
[assembly: ReSharperSetting("CodeAnnotations.NonPublicAssertion", "Debug.ArgumentNotNull({0}, \"{0}\");")]

This makes it possible to have different settings per project and removes the configuration hell.

Agent Johnson 2.0.0 Beta 4

Agent Johnson 2.0.0 beta for Resharper 6 is now available.

Agent Johnson 2.0.0 will stay in Beta until Resharper 6.1 is released where the settings issue is fixed. See http://confluence.jetbrains.net/display/ReSharper/Settings.

Change Log:

Beta 4:

  • Various bug fixes.

Beta 3:

  • Found and worked around a race condition in Resharper that causes Visual Studio to freeze.
  • Added "Use 'as' operator" and "Use cast operator" context actions.

Beta 2:

  • Fixed a critical issue with Value Analysis and return values.

Known issue:

  • Options for Value Analysis and Introduce String Constant are not persisted.

Features

  • Introduce string constant
  • Duplicate method
  • Reverse for-loop
  • Catch exceptions
  • Use string.Compare
  • Use StringBuilder
  • Add uncaught exceptions to Xml-doc comments
  • Add Xml-doc comments for thrown exception
  • Negate 'if' condition
  • Make virtual method abstract
  • Make abstract class virtual
  • Annotate with Value Analysis attributes
  • Pull method parameters
  • Smart Generate
  • Use 'as' operator
  • Use cast operator

Resharper 6

Agent Johnson will be split in two parts - a Resharper Abstraction Layer and the actual refactoring code (Agent Johnson).

The Abstraction Layer will not be a general abstract layer of all the Open API - it will solely support Agent Johnson (BTW I think Jetbrains should do an easy to work with layer).

I do not intent to implement all the functionality of Agent Johnson 1 in Agent Johnson 2. Some of the stuff is too obscure and just makes upgrading difficult.

Agent Johnson 1 features that will not be implemented

  • Invert Return Value
  • Implement ISerializable.
  • Implement ICloneable.
  • Implement IDisposable.
  • Implement proxy class.
  • Assert assignment
  • Assert return value
  • Check if the result of an assignment is null
  • Check if the result of an string assignment is null or empty
  • Replace "" with string.Empty
  • Generate Switch statement
  • Sort switch cases
  • Favorite Files

Current Version

Version 2.0.0 Beta, August 11. 2011.

Resharper version 6.0.2202

Powered by Google Project Hosting