Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy GitHub Pages

on:
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: Generate rules metadata
run: dotnet run --project tools/ConfigurationFilesGenerator/ConfigurationFilesGenerator.csproj

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ If you are using [StyleCop.Analyzers](https://www.nuget.org/packages/StyleCop.An

If you also have a `Directory.Build.props` file in your solution, you can remove properties that are [already set by this package](src/buildTransitive/CSS.DotNet.CodingStandards.props).

## 🔧 Interactive Rule Configuration Tool

We provide an [interactive web-based configuration tool](https://clinical-support-systems.github.io/css-dotnet-codingstandards/config-tool/) that makes it easy to customize rules for your project:

- **Browse all 500+ rules** with descriptions and help links
- **Filter by category**: Style, Quality, Security, Performance
- **Search** by rule ID, title, or description
- **Adjust severities** interactively with live preview
- **Apply templates** for different project types (API, Library, Blazor, Test)
- **Export configuration** as a custom `.editorconfig` snippet

This tool dramatically reduces adoption friction and makes customization accessible to all skill levels.

## What's included

- Code style and formatting options, including indentation, line wrapping, encoding, new lines preferences, and more.
Expand Down
61 changes: 61 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# CSS .NET Coding Standards - Documentation

Welcome to the documentation for CSS .NET Coding Standards.

## 🔧 Interactive Rule Configuration Tool

Use our [Interactive Rule Configuration Tool](./config-tool/) to:

- Browse all 500+ rules with descriptions and help links
- Filter rules by category (Style, Quality, Security, Performance)
- Search rules by ID, title, or description
- Adjust severity levels interactively with live preview
- Apply rule templates for different project types:
- **API Project** - Optimized for Web API projects
- **Library** - Optimized for class libraries
- **Blazor** - Optimized for Blazor applications
- **Test Project** - Relaxed rules for test projects
- Export custom `.editorconfig` snippet to download

### Getting Started

1. Visit the [Configuration Tool](./config-tool/)
2. Browse or search for rules you want to customize
3. Adjust severity levels using the dropdown selectors
4. Click "Export Configuration" to download your custom `.editorconfig`
5. Add the downloaded configuration to your project's `.editorconfig` file

### Rule Categories

- **Style**: Code formatting and naming conventions
- **Quality**: Code quality and maintainability rules
- **Security**: Security-related analysis rules
- **Performance**: Performance optimization rules
- **Other**: Miscellaneous rules

### Severity Levels

- **none**: The rule is disabled
- **silent**: The rule is enabled but doesn't produce any diagnostics
- **suggestion**: Produces an IDE suggestion (green squiggle)
- **warning**: Produces a warning (yellow squiggle)
- **error**: Produces an error (red squiggle)

## Rules Metadata

The complete rules metadata is available in JSON format: [rules-metadata.json](./rules-metadata.json)

This file contains:
- Rule ID
- Title
- Description
- Help URL
- Category
- Default severity
- Package source

## Learn More

- [Main Repository](https://github.com/Clinical-Support-Systems/css-dotnet-codingstandards)
- [NuGet Package](https://www.nuget.org/packages/CSS.DotNet.CodingStandards/)
- [Microsoft .NET Code Analysis Documentation](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview)
92 changes: 92 additions & 0 deletions docs/config-tool/FUTURE_ENHANCEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Future Enhancements

This document outlines potential future enhancements for the Interactive Rule Configuration Tool.

## Code Examples Database

### Goal
Provide code examples showing violations and fixes for each rule.

### Implementation Plan
1. Create a JSON database of code examples:
```json
{
"CA1000": {
"violation": "public class Generic<T> { public static void Method() { } }",
"fix": "public class Generic<T> { public void Method() { } }",
"explanation": "Avoid static members on generic types as they require type arguments"
}
}
```

2. Extend the UI to show examples when expanding a rule
3. Add syntax highlighting for code blocks
4. Source examples from:
- Microsoft documentation
- StyleCop documentation
- Community contributions

### Benefits
- Faster understanding of rule violations
- Visual learning for developers
- Reduced time to fix issues

## Configuration Diff Viewer

### Goal
Show visual differences between selected template and current configuration.

### Implementation Plan
1. Add a "Compare" mode to the UI
2. Highlight rules that differ from defaults
3. Show side-by-side comparison of severities
4. Export diff as a readable report

### Benefits
- Understand impact of template selection
- Review changes before applying
- Document configuration decisions

## Advanced Features

### Rule Dependencies
- Show rules that commonly work together
- Suggest related rules when modifying one
- Group rules by semantic purpose

### Import Existing Configuration
- Allow users to upload their current `.editorconfig`
- Parse and display current settings
- Suggest optimizations or updates

### Team Presets
- Save and share custom templates
- Version control for configurations
- Team collaboration features

### Analytics
- Most commonly modified rules
- Popular template choices
- Configuration patterns by project type

### Integration
- VS Code extension
- Visual Studio extension
- CLI tool for automation
- GitHub Action for validation

## Contributing

If you'd like to contribute to any of these enhancements:
1. Open an issue to discuss the feature
2. Submit a PR with your implementation
3. Update documentation

## Priority

Current priorities:
1. ✅ Core configuration tool (completed)
2. 🔄 Code examples database (in progress)
3. 📋 Configuration diff viewer (planned)
4. 🎯 Import existing configuration (planned)
5. 🤝 Team presets (future)
156 changes: 156 additions & 0 deletions docs/config-tool/USER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Interactive Rule Configuration Tool - User Guide

## Overview

The Interactive Rule Configuration Tool is a web-based application that helps developers customize CSS .NET Coding Standards for their projects without manually editing `.editorconfig` files.

## Features

### 🎯 Browse All Rules
- View all 2046+ analyzer rules from multiple packages
- Each rule includes:
- Rule ID (e.g., CA1000, IDE0055)
- Title and description
- Category (Style, Quality, Security, Performance, Other)
- Default severity level
- Link to official documentation
- Source package information

### 🔍 Advanced Filtering
- **Search**: Find rules by ID, title, or description
- **Category Filter**: Show only rules from specific categories
- **Severity Filter**: Filter by current severity level
- **Pagination**: Navigate through rules efficiently (50 per page)

### 📋 Project Templates
Apply pre-configured rule sets optimized for different project types:

- **Default**: All rules as configured in the base package
- **API Project**: Enhanced security rules for Web API projects
- **Library**: Stricter quality rules for class libraries
- **Blazor**: Optimized for Blazor applications
- **Test Project**: Relaxed rules for test projects

### ⚙️ Interactive Configuration
- Adjust severity for any rule with a dropdown selector:
- **none**: Rule is disabled
- **silent**: Enabled but no diagnostics
- **suggestion**: IDE suggestion (green squiggle)
- **warning**: Warning (yellow squiggle)
- **error**: Error (red squiggle)
- Color-coded severity indicators for easy identification
- Track how many rules you've modified

### 💾 Export Configuration
- Generate a custom `.editorconfig` file with your changes
- Download includes:
- Header with template information
- Generation timestamp
- Only modified rules (unchanged rules use defaults)
- Comments with rule titles

## How to Use

### Step 1: Access the Tool
Visit: https://clinical-support-systems.github.io/css-dotnet-codingstandards/config-tool/

### Step 2: Choose a Template (Optional)
If you're starting from scratch, select a project template that matches your project type. This will apply sensible defaults.

### Step 3: Browse and Filter Rules
Use the search box and filters to find rules you want to customize:
- Search for specific rule IDs (e.g., "CA1000")
- Filter by category (Style, Quality, Security, Performance)
- Filter by severity level

### Step 4: Adjust Severities
Click on the severity dropdown for any rule and select your preferred level. The tool will track your changes.

### Step 5: Export Configuration
Click the "Export Configuration" button at the bottom right to download your custom `.editorconfig` file.

### Step 6: Apply to Your Project
1. Open the downloaded `.editorconfig` file
2. Copy the contents
3. Paste into your project's `.editorconfig` file (or create one if it doesn't exist)
4. Commit the changes

## Statistics Dashboard

The tool displays real-time statistics:
- **Filtered Rules**: Number of rules matching your current filters
- **Modified Rules**: Number of rules you've customized
- **Category Counts**: Distribution of rules by category

## Examples

### Example 1: Relax Styling Rules for Test Projects
1. Select "Test Project" template
2. Search for "style" category
3. Note that many style rules are set to "silent"
4. Export and apply to your test project

### Example 2: Enhance Security for API Projects
1. Select "API Project" template
2. Filter by "Security" category
3. Note that security rules are elevated to "error"
4. Export and apply to your API project

### Example 3: Custom Configuration
1. Start with "Default" template
2. Search for "CA1031" (Do not catch general exception types)
3. Change severity from "none" to "warning"
4. Search for "IDE0055" (Fix formatting)
5. Change severity from "error" to "warning"
6. Export your custom configuration

## Tips

- **Start with a template**: Templates provide sensible defaults for common scenarios
- **Use search effectively**: Search by rule ID when you know what you're looking for
- **Read descriptions**: Click documentation links to understand what each rule does
- **Test incrementally**: Apply changes gradually and test your build
- **Document your choices**: Add comments in your `.editorconfig` explaining why rules were modified

## Technical Details

### Data Source
Rule metadata is automatically generated from:
- Microsoft.CodeAnalysis.NetAnalyzers
- Microsoft.CodeAnalysis.CSharp.CodeStyle
- StyleCop.Analyzers
- Meziantou.Analyzer
- Microsoft.CodeAnalysis.BannedApiAnalyzers

### Updates
The rules metadata is regenerated with each package release, ensuring you always have the latest rule information.

### Browser Compatibility
The tool uses modern web technologies and works best with:
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)

## Troubleshooting

### No rules showing
- Check your internet connection
- Try refreshing the page
- Clear browser cache if needed

### Export not working
- Check that JavaScript is enabled
- Try a different browser
- Check for browser extensions that might block downloads

### Can't find a specific rule
- Use the search feature with the rule ID
- Check if you have any filters applied
- Some rules may be deprecated or renamed

## Support

For issues or questions:
- Check the [main repository](https://github.com/Clinical-Support-Systems/css-dotnet-codingstandards)
- Review the [package documentation](https://www.nuget.org/packages/CSS.DotNet.CodingStandards/)
- Search existing issues or create a new one
Loading
Loading