I'm wondering about enabling StyleCop on an existing codebase and wondered if anyone had worked out a way to use two different StyleCop rulesets to process different files in the same project.
What I'm thinking I would like to do is this:
- Enable StyleCop on all the projects, with most/all of the rules turned on. This will give me a LOT of warnings (e.g. > 50,000 in one project alone, even with the documentation ones disabled).
- Exclude all the existing files (as described
here). Newly added files will thus use the complete ruleset from step 1.
- Run Resharper's Code Cleanup to fix some of the simpler violations one-by-one (e.g. adding "this." to all member references).
- Do something to make StyleCop run against all the files excluded from the full processing (in step 2) but with a ruleset restricted to just the things already fixed (in step 3).
Step 4 is the difficult one (obviously), but it would enable us to start bringing our codebase up to standard incrementally, but actually enforcing some of the simpler stuff universally as we progress.