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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ trim_trailing_whitespace = false
# SA1309: Field names should not begin with underscore
dotnet_diagnostic.SA1309.severity = none

# SA1000: Keywords should be spaced correctly
dotnet_diagnostic.SA1000.severity = none

# SA1200: Using directive should appear within a namespace declaration
dotnet_diagnostic.SA1200.severity = none

# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = none

# SA1202: Elements should be ordered by accessibility
dotnet_diagnostic.SA1202.severity = none

# SA1208: System using directives should be placed before other using directives
dotnet_diagnostic.SA1208.severity = none

# SA1633: File should have header
Expand Down
2 changes: 1 addition & 1 deletion .kiro/specs/dotnet-api-diff/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Each task should follow this git workflow:
- **Git Workflow**: Create branch `feature/task-4.2-name-mapping`, commit, push, and create PR
- _Requirements: 6.1, 6.2, 6.3, 6.4_

- [ ] 4.3 Implement exclusion and breaking change classification
- [x] 4.3 Implement exclusion and breaking change classification
- Create ChangeClassifier to categorize changes as breaking, non-breaking, or excluded
- Implement exclusion pattern matching with wildcard support
- Write unit tests for breaking change detection and exclusion logic
Expand Down
17 changes: 17 additions & 0 deletions .kiro/steering/product.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DotNet API Diff Tool

DotNet API Diff is a command-line tool for comparing public APIs between different versions of .NET assemblies. The tool helps developers and library maintainers identify breaking changes and track API evolution.

## Core Functionality

- Compares public APIs between two .NET assembly versions
- Detects breaking changes, additions, removals, and modifications
- Generates reports in multiple formats (Console, JSON, XML, HTML, Markdown)
- Analyzes types, methods, properties, fields, and events
- Classifies changes by severity

## Target Audience

- Library maintainers who need to track API compatibility
- Development teams enforcing semantic versioning
- CI/CD pipelines for automated API compatibility checks
75 changes: 75 additions & 0 deletions .kiro/steering/structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Project Structure

## Solution Organization

The solution follows a clean separation between source code and tests:

```
DotNetApiDiff.sln
├── src/
│ └── DotNetApiDiff/ # Main project
├── tests/
│ └── DotNetApiDiff.Tests/ # Test project
└── scripts/ # Utility scripts
```

## Source Code Organization

The main project is organized by feature/responsibility:

```
src/DotNetApiDiff/
├── ApiExtraction/ # API extraction and comparison logic
│ ├── ApiComparer.cs # Compares APIs between assemblies
│ ├── ApiExtractor.cs # Extracts API information from assemblies
│ ├── DifferenceCalculator.cs # Calculates differences between APIs
│ ├── MemberSignatureBuilder.cs # Builds member signatures
│ ├── NameMapper.cs # Maps names between assemblies
│ └── TypeAnalyzer.cs # Analyzes type information
├── AssemblyLoading/ # Assembly loading functionality
│ ├── AssemblyLoader.cs # Loads assemblies for analysis
│ └── IsolatedAssemblyLoadContext.cs # Isolates assembly loading
├── Interfaces/ # Core service interfaces
│ ├── IApiComparer.cs
│ ├── IApiExtractor.cs
│ ├── IAssemblyLoader.cs
│ ├── IDifferenceCalculator.cs
│ ├── IMemberSignatureBuilder.cs
│ ├── INameMapper.cs
│ ├── IReportGenerator.cs
│ └── ITypeAnalyzer.cs
├── Models/ # Data models
│ ├── ApiChange.cs
│ ├── ApiComparison.cs
│ ├── ApiDifference.cs
│ ├── ApiMember.cs
│ ├── ComparisonResult.cs
│ ├── Enums.cs
│ └── Configuration/ # Configuration models
│ ├── BreakingChangeRules.cs
│ ├── ComparisonConfiguration.cs
│ ├── ExclusionConfiguration.cs
│ ├── FilterConfiguration.cs
│ └── MappingConfiguration.cs
└── Program.cs # Main entry point
```

## Test Organization

Tests mirror the structure of the main project:

```
tests/DotNetApiDiff.Tests/
├── ApiExtraction/ # Tests for API extraction components
├── Assembly/ # Tests for assembly loading
├── Models/ # Tests for data models
│ └── Configuration/ # Tests for configuration models
└── coverage.info # Coverage report
```

## Architecture Patterns

1. **Dependency Injection** - The application uses Microsoft's DI container for service resolution
2. **Interface-based Design** - All components are defined by interfaces in the Interfaces folder
3. **Clean Separation of Concerns** - Each component has a single responsibility
4. **Configuration Objects** - Dedicated configuration classes in Models/Configuration
75 changes: 75 additions & 0 deletions .kiro/steering/tech.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Technical Stack

## Framework and Language

- .NET 8.0
- C# with nullable reference types enabled
- Console application

## Dependencies

- Microsoft.Extensions.DependencyInjection - For dependency injection
- Microsoft.Extensions.Logging - For structured logging
- System.Reflection.Metadata - For assembly inspection

## Testing Framework

- xUnit - Primary testing framework
- Moq - Mocking library
- coverlet - Code coverage tool

## Build System

The project uses multiple build systems:

1. **MSBuild/dotnet CLI** - Primary build system
2. **Taskfile** - Task runner for common development workflows

## Common Commands

### Basic dotnet commands

```bash
# Build the solution
dotnet build

# Run tests
dotnet test

# Run the application
dotnet run --project src/DotNetApiDiff/DotNetApiDiff.csproj -- --old old.dll --new new.dll
```

### Taskfile commands

```bash
# List all available tasks
task

# Build the solution
task build

# Run all tests
task test

# Generate code coverage report
task coverage

# View coverage report in browser
task coverage:view

# Format code
task code:format

# Run code quality checks
task code:quality

# Run CI build sequence
task ci
```

## Code Style and Analysis

- StyleCop.Analyzers - For code style enforcement
- Microsoft.CodeAnalysis.NetAnalyzers - For .NET code quality analysis
- .editorconfig - For consistent code style across editors
10 changes: 8 additions & 2 deletions src/DotNetApiDiff/ApiExtraction/ApiComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class ApiComparer : IApiComparer
private readonly IApiExtractor _apiExtractor;
private readonly IDifferenceCalculator _differenceCalculator;
private readonly INameMapper _nameMapper;
private readonly IChangeClassifier _changeClassifier;
private readonly ILogger<ApiComparer> _logger;

/// <summary>
Expand All @@ -23,16 +24,19 @@ public class ApiComparer : IApiComparer
/// <param name="apiExtractor">API extractor for getting API members</param>
/// <param name="differenceCalculator">Calculator for detailed change analysis</param>
/// <param name="nameMapper">Mapper for namespace and type name transformations</param>
/// <param name="changeClassifier">Classifier for breaking changes and exclusions</param>
/// <param name="logger">Logger for diagnostic information</param>
public ApiComparer(
IApiExtractor apiExtractor,
IDifferenceCalculator differenceCalculator,
INameMapper nameMapper,
IChangeClassifier changeClassifier,
ILogger<ApiComparer> logger)
{
_apiExtractor = apiExtractor ?? throw new ArgumentNullException(nameof(apiExtractor));
_differenceCalculator = differenceCalculator ?? throw new ArgumentNullException(nameof(differenceCalculator));
_nameMapper = nameMapper ?? throw new ArgumentNullException(nameof(nameMapper));
_changeClassifier = changeClassifier ?? throw new ArgumentNullException(nameof(changeClassifier));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}

Expand Down Expand Up @@ -80,10 +84,12 @@ public ComparisonResult CompareAssemblies(Assembly oldAssembly, Assembly newAsse
// Compare types
var typeDifferences = CompareTypes(oldTypes, newTypes).ToList();

// Add the differences to the result
// Classify and add the differences to the result
foreach (var diff in typeDifferences)
{
result.Differences.Add(diff);
// Classify the difference using the change classifier
var classifiedDiff = _changeClassifier.ClassifyChange(diff);
result.Differences.Add(classifiedDiff);
}

// Update summary statistics
Expand Down
Loading
Loading