Free NR6Pack for Visual Studio 2015

visual studio

NR6Pack is a free collection of refactoring and analyzers from the NRefactory open-source project packaged specifically for VS 2015.

  • 71 Refactorings
  • 73 Analyzers

The open source (MIT license) package is available right now.

NRefactory is a library geared towards anyone that needs IDE services – think code completion, refactoring, code fixes and more. It started life a very long time ago in SharpDevelop, was at times developed in parallel in MonoDevelop, and in 2010 the two teams joined forces to bring NRefactory5 to life as a full open source stack of IDE services.

NR6 is leveraging Roslyn instead of their homegrown stack components to make development easier and faster. They are also redesigning their refactoring around the Roslyn way of doing things, making the new refactorings and analyzers reuseable for anyone that speaks Roslyn.

Refactorings

71 code actions available!

  • Make abstract member virtual/non-abstract and vice-versa (AbstractAndVirtualConversionAction)
  • Add another accessor (AddAnotherAccessorAction)
  • Add name for argument (AddArgumentNameAction)
  • Add braces (AddBracesAction)
  • Add type to general catch clause (AddCatchTypeAction)
  • Add one or more optional parameters to an invocation, using their default values (AddOptionalParameterToInvocationAction)
  • Check if parameter is null (CheckIfParameterIsNullAction)
  • Compute constant value (ComputeConstantValueAction)
  • Convert anonymous delegate to lambda (ConvertAnonymousDelegateToLambdaAction)
  • Convert assignment to ‘if’ (ConvertAssignmentToIfAction)
  • Convert ‘as’ to cast. (ConvertAsToCastAction)
  • Replace bitwise flag comparison with call to ‘Enum.HasFlag’ (ConvertBitwiseFlagComparisonToHasFlagsAction)
  • Convert cast to ‘as’. (ConvertCastToAsAction)
  • Convert dec to hex. (ConvertDecToHexAction)
  • Convert do…while to while (ConvertDoWhileToWhileLoopAction)
  • Convert ‘==’ to ‘Equals’ (ConvertEqualityOperatorToEqualsAction)
  • Convert ‘Equals’ to ‘==’ (ConvertEqualsToEqualityOperatorAction)
  • Convert explicit to implict implementation (ConvertExplicitToImplicitImplementationAction)
  • Convert ‘foreach’ loop to ‘for’ (ConvertForeachToForAction)
  • Convert ‘for’ loop to ‘while’ (ConvertForToWhileAction)
  • Replace ‘Enum.HasFlag’ call with bitwise flag comparison (ConvertHasFlagsToBitwiseFlagComparisonAction)
  • Convert hex to dec. (ConvertHexToDecAction)
  • Convert ‘if’ to ‘?:’ (ConvertIfStatementToConditionalTernaryExpressionAction)
  • Convert ‘if’ to ‘??’ expression (ConvertIfStatementToNullCoalescingExpressionAction)
  • Convert ‘if’ to ‘return’ (ConvertIfStatementToReturnStatementAction)
  • Convert implict to explicit implementation (ConvertImplicitToExplicitImplementationAction)
  • Converts expression of lambda body to statement (ConvertLambdaBodyExpressionToStatementAction)
  • Converts statement of lambda body to expression (ConvertLambdaBodyStatementToExpressionAction)
  • Convert lambda to anonymous delegate (ConvertLambdaToAnonymousDelegateAction)
  • Convert method group to anoymous method (ConvertMethodGroupToAnonymousMethodAction)
  • Convert method group to lambda expression (ConvertMethodGroupToLambdaAction)
  • Convert ‘*’/’/’ to ‘<<‘/’>>’ (ConvertMultiplyToShiftAction)
  • Convert ‘??’ to ‘?:’ (ConvertNullCoalescingToConditionalExpressionAction)
  • Convert ‘return’ to ‘if’ (ConvertReturnStatementToIfAction)
  • Convert ‘<<‘/’>>’ to ‘*’/’/’ (ConvertShiftToMultiplyAction)
  • Convert ‘switch’ to ‘if’ (ConvertSwitchToIfAction)
  • Convert while loop to do…while (ConvertWhileToDoWhileLoopAction)
  • Create backing store for auto property (CreateBackingStoreAction)
  • Create changed event for property (CreateChangedEventAction)
  • Create custom event implementation (CreateCustomEventImplementationAction)
  • Extension methods must be declared static (CS1105ExtensionMethodMustBeDeclaredStaticAction)
  • Invoke using static method syntax (ExtensionMethodInvocationToStaticMethodInvocationAction)
  • Extract anonymous method (ExtractAnonymousMethodAction)
  • Extract field (ExtractWhileConditionToInternalIfStatementAction)
  • Swap ‘Equals’ target and argument (FlipEqualsTargetAndArgumentAction)
  • Swap left and right arguments (FlipOperatorArgumentsAction)
  • Generate switch labels (GenerateSwitchLabelsAction)
  • Create a backing field for a not implemented property (ImplementNotImplementedProperty)
  • Invert conditional operator (InvertConditionalOperatorAction)
  • Invert if (InvertIfAction)
  • Invert If and Simplify (InvertIfAndSimplify)
  • Invert logical expression (InvertLogicalExpressionAction)
  • Join local variable declaration and assignment (JoinDeclarationAndAssignmentAction)
  • Join string literal (JoinStringAction)
  • Negate ‘is’ expression (NegateIsExpressionAction)
  • Negate a relational expression (NegateRelationalExpressionAction)
  • Remove backing store for property (RemoveBackingStoreAction)
  • Remove braces (RemoveBracesAction)
  • Remove region (RemoveRegionAction)
  • Replace assignment with postfix expression (ReplaceAssignmentWithPostfixExpressionAction)
  • Use string.Empty (ReplaceEmptyStringAction)
  • Replace operator assignment with assignment (ReplaceOperatorAssignmentWithAssignmentAction)
  • Replace postfix expression with assignment (ReplacePostfixExpressionWithAssignmentAction)
  • Replace assignment with operator assignment (ReplaceWithOperatorAssignmentAction)
  • Simplify if flow (SimplifyIfFlowAction)
  • Simplify if flow in loops (SimplifyIfInLoopsFlowAction)
  • Split local variable declaration and assignment (SplitDeclarationAndAssignmentAction)
  • Split ‘if’ statement (SplitIfAction)
  • Use ‘as’ and null check (UseAsAndNullCheckAction)
  • Use explicit type (UseExplicitTypeAction)
  • Use ‘var’ keyword (UseVarKeywordAction)

Analyzers

73 code issues available!

  • Removes ‘internal’ modifiers that are not required (RedundantInternalIssue)
  • Removes ‘private’ modifiers that are not required (RedundantPrivateIssue)
  • Call to base member with implicit default parameters (BaseMethodCallWithDefaultParameterIssue)
  • Bitwise operation on enum which has no [Flags] attribute (BitwiseOperatorOnEnumWithoutFlagsIssue)
  • Possible compare of value type with ‘null’ (CompareNonConstrainedGenericWithNullIssue)
  • Comparison of floating point numbers with equality operator (CompareOfFloatsByEqualityOperatorIssue)
  • ‘?:’ expression has identical true and false branches (ConditionalTernaryEqualBranchIssue)
  • Delegate subtraction has unpredictable result (DelegateSubtractionIssue)
  • Warns about calls to virtual member functions occuring in the constructor. (DoNotCallOverridableMethodsInConstructorIssue)
  • A catch clause that catches System.Exception and has an empty body (EmptyGeneralCatchClauseIssue)
  • Function does not reach its end or a ‘return’ statement by any of possible execution paths. (FunctionNeverReturnsIssue)
  • Lowercase ‘l’ is often confused with ‘1’ (LongLiteralEndingLowerLIssue)
  • Non-readonly field referenced in ‘GetHashCode()’ (NonReadonlyReferencedInGetHashCodeIssue)
  • Possible unassigned object created by ‘new’ (ObjectCreationAsStatementIssue)
  • Operator Is can be used instead of comparing object GetType() and instances of System.Type object (OperatorIsCanBeUsedIssue)
  • C# doesn’t support optional ‘ref’ or ‘out’ parameters (OptionalParameterRefOutIssue)
  • Non public methods are not found by NUnit (NonPublicMethodWithTestAttributeIssue)
  • Anonymous method or lambda expression can be simplified to method group (ConvertClosureToMethodGroupIssue)
  • ‘?:’ expression can be converted to ‘??’ expression. (ConvertConditionalTernaryToNullCoalescingIssue)
  • Convert ‘Nullable<T>’ to the short form ‘T?’ (ConvertNullableToShortFormIssue)
  • If all fields, properties and methods members are static, the class can be made static. (ConvertToStaticTypeIssue)
  • If an extension method is called as static method convert it to method syntax (InvokeAsExtensionMethodIssue)
  • Suggests using the class declaring a static function when calling it. (AccessToStaticMemberViaDerivedTypeIssue)
  • Base parameter has ‘params’ modifier, but missing in overrider (BaseMemberHasParamsIssue)
  • Convert ‘if’ to ‘||’ expression (ConvertIfToOrExpressionIssue)
  • Empty control statement body (EmptyEmbeddedStatementIssue)
  • Possible mistaken call to ‘object.GetType()’ (PossibleMistakenCallToGetTypeIssue)
  • Replace with call to FirstOrDefault<T>() (ReplaceWithFirstOrDefaultIssue)
  • Replace with call to LastOrDefault<T>() (ReplaceWithLastOrDefaultIssue)
  • Replace with call to OfType<T>().Any() (ReplaceWithOfTypeAnyIssue)
  • Replace with call to OfType<T>().Count() (ReplaceWithOfTypeCountIssue)
  • Replace with call to OfType<T>().First() (ReplaceWithOfTypeFirstIssue)
  • Replace with call to OfType<T>().FirstOrDefault() (ReplaceWithOfTypeFirstOrDefaultIssue)
  • Replace with call to OfType<T>().Last() (ReplaceWithOfTypeLastIssue)
  • Replace with call to OfType<T>().LastOrDefault() (ReplaceWithOfTypeLastOrDefaultIssue)
  • Replace with call to OfType<T>().LongCount() (ReplaceWithOfTypeLongCountIssue)
  • Replace with call to OfType<T>().Single() (ReplaceWithOfTypeSingleIssue)
  • Replace with call to OfType<T>().SingleOrDefault() (ReplaceWithOfTypeSingleOrDefaultIssue)
  • Replace with call to OfType<T>().Where() (ReplaceWithOfTypeWhereIssue)
  • Replace with simple assignment (ReplaceWithSimpleAssignmentIssue)
  • Replace with single call to Any(…) (ReplaceWithSingleCallToAnyIssue)
  • Replace with single call to Count(…) (ReplaceWithSingleCallToCountIssue)
  • Replace with single call to First(…) (ReplaceWithSingleCallToFirstIssue)
  • Replace with single call to FirstOrDefault(…) (ReplaceWithSingleCallToFirstOrDefaultIssue)
  • Replace with single call to Last(…) (ReplaceWithSingleCallToLastIssue)
  • Replace with single call to LastOrDefault(…) (ReplaceWithSingleCallToLastOrDefaultIssue)
  • Replace with single call to LongCount(…) (ReplaceWithSingleCallToLongCountIssue)
  • Replace with single call to Single(…) (ReplaceWithSingleCallToSingleIssue)
  • Replace with single call to SingleOrDefault(…) (ReplaceWithSingleCallToSingleOrDefaultIssue)
  • Warns when a culture-aware ‘EndsWith’ call is used by default. (StringEndsWithIsCultureSpecificIssue)
  • Warns when a culture-aware ‘IndexOf’ call is used by default. (StringIndexOfIsCultureSpecificIssue)
  • Warns when a culture-aware ‘LastIndexOf’ call is used by default. (StringLastIndexOfIsCultureSpecificIssue)
  • Warns when a culture-aware ‘StartsWith’ call is used by default. (StringStartsWithIsCultureSpecificIssue)
  • When initializing explicitly typed local variable or array type, array creation expression can be replaced with array initializer. (ArrayCreationCanBeReplacedWithArrayInitializerIssue)
  • Condition is always true or false (ConditionIsAlwaysTrueOrFalseIssue)
  • Double negation is redundant (DoubleNegationOperatorIssue)
  • Empty statement is redundant (EmptyStatementIssue)
  • ‘true’ is redundant as for statement condition (ForStatementConditionIsTrueIssue)
  • Redundant explicit property name (RedundantAnonymousTypePropertyNameIssue)
  • Redundant explicit argument name specification (RedundantArgumentNameIssue)
  • Parentheses are redundant if attribute has no arguments. (RedundantAttributeParenthesesIssue)
  • ‘base.’ is redundant and can safely be removed. (RedundantBaseQualifierIssue)
  • Redundant case label (RedundantCaseLabelIssue)
  • Type cast is redundant (RedundantCastIssue)
  • Redundant empty ‘default’ switch branch (RedundantEmptyDefaultSwitchBranchIssue)
  • Removes namespace usages that are obsolete. (RedundantNameQualifierIssue)
  • Redundant conditional expression (RedundantTernaryExpressionIssue)
  • Remove redundant statement (RemoveRedundantOrStatementIssue)
  • An empty public constructor without paramaters is redundant. (EmptyConstructorIssue)
  • Empty destructor is redundant (EmptyDestructorIssue)
  • Empty namespace declaration is redundant (EmptyNamespaceIssue)
  • The default underlying type of enums is int, so defining it explicitly is redundant. (EnumUnderlyingTypeIsIntIssue)
  • ‘sealed’ modifier is redundant in sealed classes (SealedMemberInSealedClassIssue)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s