From 563ace5e15d28abe8470d9460146abcc37daccf3 Mon Sep 17 00:00:00 2001 From: Marco Fogliatto <2962955+mfogliatto@users.noreply.github.com> Date: Sat, 13 Sep 2025 07:29:29 +0200 Subject: [PATCH 1/2] Update StyleCop file reference in instructions file --- .github/copilot-instructions.md | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 8736253..15b0525 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,5 +1,3 @@ -# claude.md - ## Project Overview **Project Name:** ReferenceCop @@ -65,36 +63,7 @@ dotnet pack src/ReferenceCop.Package/ReferenceCop.Package.csproj -c Release ### Code Style Guidelines -Please ensure all code follows StyleCop-based conventions as defined in the project's configuration file located at `src\stylecop.json`. This file defines the following important style guidelines: - -1. **Documentation Rules**: Internal elements, private fields, and interfaces don't require documentation comments. -2. **Ordering Rules**: - - Using directives should be placed inside namespaces - - System using directives should be listed first -3. **Layout Rules**: - - All files must end with a newline - - Use 4 spaces for indentation, not tabs - - Maintain consistent indentation when adding or modifying code blocks -4. **File Organization**: - - Each type (class, interface, struct, enum) should have its own file - - The file name should match the type name exactly - - Nested types can be in the same file as their parent type - -5. **Whitespace Rules**: - - No trailing whitespace at the end of lines (SA1028) - - No empty lines with whitespace characters - - Use a single blank line to separate logical code blocks - - Use a single space after keywords like `if`, `for`, `while`, etc. - - Use a single space before opening braces - -6. **Indentation Guidelines**: - - Always preserve the existing indentation style when modifying code - - Match the surrounding code's indentation level precisely when adding new code - - Ensure that all opening and closing braces maintain proper alignment - - For method parameters and arguments that span multiple lines, align parameters with the first parameter - - Do not mix tabs and spaces for indentation - -When adding or modifying code, adhere to these style conventions for consistency across the project. +Please ensure all code follows the project defined [StyleCop-based conventions](../src/stylecop.json). This file defines the important style guidelines and should always be referenced when adding or modifying code. ### Testing Guidelines From 818570addc80217a646210b39e6d5332e495dd68 Mon Sep 17 00:00:00 2001 From: Marco Fogliatto <2962955+mfogliatto@users.noreply.github.com> Date: Sun, 14 Sep 2025 13:54:35 +0200 Subject: [PATCH 2/2] feat: improve Roslyn analyzer configuration for better performance - Add ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None) to skip analyzing auto-generated code - Add EnableConcurrentExecution() to allow parallel execution with other analyzers - Aligns with Microsoft's best practices for Roslyn analyzers - Improves build performance and prevents potential analyzer warnings Fixes #36 --- src/ReferenceCop.Roslyn/ReferenceCopAnalyzer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ReferenceCop.Roslyn/ReferenceCopAnalyzer.cs b/src/ReferenceCop.Roslyn/ReferenceCopAnalyzer.cs index c03cfac..25e9665 100644 --- a/src/ReferenceCop.Roslyn/ReferenceCopAnalyzer.cs +++ b/src/ReferenceCop.Roslyn/ReferenceCopAnalyzer.cs @@ -29,6 +29,9 @@ public ReferenceCopAnalyzer() public override void Initialize(AnalysisContext context) { + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); + context.EnableConcurrentExecution(); + context.RegisterCompilationAction(compilationAnalysisContext => { LaunchDebuggerIfRequested(compilationAnalysisContext);