Swallow.Refactor.Testing 3.1.0

dotnet add package Swallow.Refactor.Testing --version 3.1.0                
NuGet\Install-Package Swallow.Refactor.Testing -Version 3.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Swallow.Refactor.Testing" Version="3.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Swallow.Refactor.Testing --version 3.1.0                
#r "nuget: Swallow.Refactor.Testing, 3.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Swallow.Refactor.Testing as a Cake Addin
#addin nuget:?package=Swallow.Refactor.Testing&version=3.1.0

// Install Swallow.Refactor.Testing as a Cake Tool
#tool nuget:?package=Swallow.Refactor.Testing&version=3.1.0                

Swallow.Refactor

Refactor goes BRRR!

A tool that was originally designed as a way to enable reliably refactor a big code-base automatically, it has since turned into a generic interface to the Roslyn API to interact with any C# code, be it just reading and analyzing or even modifying.

What's BRRR short for, you ask? Boundless Roslyn Refactoring Runner.

BRRRusage

brrr refactor -s|--solution <solution> code [--filter-name <name>] [--filter-content <content>] <rewriters>

When calling refactor, instead of passing all rewriters via CLI you can instead pass the path to a JSON file. This file must match the following scheme:

{
  "filter": {
    "name": "<some regex>", // A regex that filenames should match, optional
    "content": "<some text>" // A text that files should contain, optional
  },
  "rewriters": [
    { "name": "<some rewriter>" }, // A rewriter without any parameters
    { "name": "<some rewriter>", "parameters": [ "parameter", "parameter" ] } // A rewriter with parameters
  ]
}

To find out what rewriters are available, you can use brrr rewriter list and brrr rewriter describe <rewriter>.

But it doesn't stop there - there's a lot of things you can do. Using brrr asyncify, for example, allows you to turn a chain of calls into async calls automatically, fixing any GetAwaiter().GetResult()-calls along the way.

To see all commands that you can use, run

brrr --help

BRRRinstallation

Building and installing yourself

To install the tool (and thus make it available globally), you can use the following command:

dotnet pack -c Release -o packages/
dotnet tool install --global --no-cache --add-source packages/ Swallow.Refactor

This will make brrr be a globally executable tool. To uninstall it again, you can execute:

dotnet tool uninstall --global Swallow.Refactor
Note for users of just

If you've got just installed, you can use just install, just uninstall or just reinstall! Take a look at the justfile, there're some neat things for you.

Installing via NuGet

The tool is published on NuGet as well. To install it from there, you can use the following command:

dotnet tool install --global Swallow.Refactor

BRRRlugins

If you want to use your own rewriters, commands, symbol filters, you name it - you can pass your own assemblies to the execution. They will get picked up and the relevant classes are available in all the use-cases as if they were embedded in the program!

Invoking the tool using the -p or --plugin option passing a list of semicolon-separated filepaths will load each assembly.

brrr -p|--plugin SomeAssembly.dll;SomeOtherAssembly.dll list

Using this, you can extend the basic behaviour in many ways, like defining additional commands to be executed or registering additional IDocumentRewriters or ITargetedRewriters.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 124 4/24/2024
3.0.0 134 1/20/2024
2.1.0 205 10/21/2023
2.0.1 188 7/30/2023
2.0.0 170 6/15/2023
1.0.1 172 6/4/2023
1.0.0 194 4/10/2023

See RELEASE_NOTES.md for release notes