Run StyleCop.Console.exe -project-path "path/to/your/cs/project" to get a static code analysis with StyleCop's default rules.
To not analyse subdirectories recursively add the argument switch -not-recursively.
To deactivate default rules, edit the file Settings.StyleCop with the StyleCopSettingsEditor.exe or pass your existing settings file via command line argument:
StyleCop.Console.exe -settings-location "path/to/your/Settings.StyleCop" -project-path "path/to/your/cs/project"You can add your own rules by adding your own SourceAnalyzer class in the StyleCop.Rules project. Refer to the existing RulesAnalyzer.cs class as a real-life example for disallowing more than one class per code file.
Further reading: How to Create StyleCop Custom Rule
- Show help screen:
-helpor-? - Specify project path:
-project-path <path>or-p <path> - Custom settings file:
-settings-location <path>or-s <path> - Do not analyse subdirectories:
-not-recursivelyor-n