Why does it exist?
Large C# repositories do not become messy only because of large mistakes. Over time they accumulate small inconsistencies: whitespace, incorrectly ordered usings, older syntax, missing explicit modifiers, regions, untidy namespaces and missing documentation. Each item is trivial, but fixing thousands of them manually is expensive and rarely consistent.
Code Janitor automates that repetitive part of development. Instead of treating cleanup as a one-off activity before review, you can define rules, choose a scope and get a predictable set of changes to inspect.
The project is an independently maintained continuation derived from CodeMaid. It keeps proven capabilities while evolving them for current Visual Studio, .NET, Razor and team workflows.
Two editors, two feature sets.
One shared philosophy.
The core cleanup operations are deterministic and local. They do not require an AI model, an account or sending source code to an external provider. That matters for repositories where source code must stay inside the development environment.
Scope is explicit: a single file, selected files, a project, a workspace, Git-changed files or an on-save rule, depending on the editor. Rules can be configured individually or stored as repository policy.
AI is an optional layer, not a requirement. Where available, it is opt-in and reserved for work that benefits from generation or analysis, such as XML documentation, review, refactoring or test generation.
Control over changes.
Cleanup is not a replacement for code review. In Visual Studio, deterministic C# changes can be inspected in a native diff before application. In VS Code, changes should also be reviewed, especially syntax modernization, because the engine does not perform Roslyn semantic analysis.
The .codejanitor file lets a team share cleanup policy. A local developer can still deliberately override it with user settings where the environment requires that.
This is a tool for keeping code under control, not a mechanism for blindly rewriting an entire solution.
Origin and project boundaries.
Code Janitor for Visual Studio is a fork and independently maintained continuation of CodeMaid. The VS Code extension is a separate implementation that shares the cleanup concept and repository policy, but has its own engine and feature set.
This page therefore describes Code Janitor as one project with two editor implementations without pretending that both extensions expose exactly the same capabilities.