Skip to content

Commit cd8b648

Browse files
Sync analyzer versions and add .editorconfig (#22)
* Initial plan * Update AGENTS.md and sync analyzer package versions - Update AGENTS.md with comprehensive project structure including test directory, docs, issue templates - Add testing information (MSTest framework, test types, commands) - Document code analyzers and their versions - Update test project analyzer packages to match main project (Microsoft.CodeAnalysis.NetAnalyzers 10.0.101, SonarAnalyzer.CSharp 10.17.0.131074) - Add guidance on keeping analyzer versions consistent across projects Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Add .editorconfig and enhance .gitignore - Add comprehensive .editorconfig for consistent code formatting across editors - Enhance .gitignore with additional common patterns (IDE files, OS files, NuGet packages) - Update AGENTS.md to reference .editorconfig Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent 0dd5c0c commit cd8b648

File tree

4 files changed

+285
-10
lines changed

4 files changed

+285
-10
lines changed

.editorconfig

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# All files
7+
[*]
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
# Code files
15+
[*.{cs,csx,vb,vbx}]
16+
indent_size = 4
17+
18+
# XML project files
19+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
20+
indent_size = 2
21+
22+
# XML config files
23+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
24+
indent_size = 2
25+
26+
# JSON files
27+
[*.json]
28+
indent_size = 2
29+
30+
# YAML files
31+
[*.{yml,yaml}]
32+
indent_size = 2
33+
34+
# Shell scripts
35+
[*.sh]
36+
end_of_line = lf
37+
38+
# Markdown files
39+
[*.md]
40+
trim_trailing_whitespace = false
41+
42+
# Dotnet code style settings:
43+
[*.{cs,vb}]
44+
45+
# Sort using and Import directives with System.* appearing first
46+
dotnet_sort_system_directives_first = true
47+
dotnet_separate_import_directive_groups = false
48+
49+
# Avoid "this." and "Me." if not necessary
50+
dotnet_style_qualification_for_field = false:warning
51+
dotnet_style_qualification_for_property = false:warning
52+
dotnet_style_qualification_for_method = false:warning
53+
dotnet_style_qualification_for_event = false:warning
54+
55+
# Use language keywords instead of framework type names for type references
56+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
57+
dotnet_style_predefined_type_for_member_access = true:warning
58+
59+
# Suggest more modern language features when available
60+
dotnet_style_object_initializer = true:suggestion
61+
dotnet_style_collection_initializer = true:suggestion
62+
dotnet_style_coalesce_expression = true:suggestion
63+
dotnet_style_null_propagation = true:suggestion
64+
dotnet_style_explicit_tuple_names = true:suggestion
65+
66+
# CSharp code style settings:
67+
[*.cs]
68+
69+
# Prefer "var" everywhere
70+
csharp_style_var_for_built_in_types = true:suggestion
71+
csharp_style_var_when_type_is_apparent = true:suggestion
72+
csharp_style_var_elsewhere = true:suggestion
73+
74+
# Prefer method-like constructs to have a block body
75+
csharp_style_expression_bodied_methods = false:none
76+
csharp_style_expression_bodied_constructors = false:none
77+
csharp_style_expression_bodied_operators = false:none
78+
79+
# Prefer property-like constructs to have an expression-body
80+
csharp_style_expression_bodied_properties = true:suggestion
81+
csharp_style_expression_bodied_indexers = true:suggestion
82+
csharp_style_expression_bodied_accessors = true:suggestion
83+
84+
# Suggest more modern language features when available
85+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
86+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
87+
csharp_style_inlined_variable_declaration = true:suggestion
88+
csharp_style_throw_expression = true:suggestion
89+
csharp_style_conditional_delegate_call = true:suggestion
90+
91+
# Newline settings
92+
csharp_new_line_before_open_brace = all
93+
csharp_new_line_before_else = true
94+
csharp_new_line_before_catch = true
95+
csharp_new_line_before_finally = true
96+
csharp_new_line_before_members_in_object_initializers = true
97+
csharp_new_line_before_members_in_anonymous_types = true
98+
csharp_new_line_between_query_expression_clauses = true
99+
100+
# Indentation preferences
101+
csharp_indent_block_contents = true
102+
csharp_indent_braces = false
103+
csharp_indent_case_contents = true
104+
csharp_indent_case_contents_when_block = false
105+
csharp_indent_switch_labels = true
106+
csharp_indent_labels = one_less_than_current
107+
108+
# Space preferences
109+
csharp_space_after_cast = false
110+
csharp_space_after_colon_in_inheritance_clause = true
111+
csharp_space_after_comma = true
112+
csharp_space_after_dot = false
113+
csharp_space_after_keywords_in_control_flow_statements = true
114+
csharp_space_after_semicolon_in_for_statement = true
115+
csharp_space_around_binary_operators = before_and_after
116+
csharp_space_around_declaration_statements = false
117+
csharp_space_before_colon_in_inheritance_clause = true
118+
csharp_space_before_comma = false
119+
csharp_space_before_dot = false
120+
csharp_space_before_open_square_brackets = false
121+
csharp_space_before_semicolon_in_for_statement = false
122+
csharp_space_between_empty_square_brackets = false
123+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
124+
csharp_space_between_method_call_name_and_opening_parenthesis = false
125+
csharp_space_between_method_call_parameter_list_parentheses = false
126+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
127+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
128+
csharp_space_between_method_declaration_parameter_list_parentheses = false
129+
csharp_space_between_parentheses = false
130+
csharp_space_between_square_brackets = false
131+
132+
# Wrapping preferences
133+
csharp_preserve_single_line_blocks = true
134+
csharp_preserve_single_line_statements = true
135+
136+
# Naming conventions
137+
[*.{cs,vb}]
138+
139+
# Naming rules
140+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
141+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
142+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
143+
144+
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
145+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
146+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
147+
148+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
149+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
150+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
151+
152+
# Symbol specifications
153+
dotnet_naming_symbols.interface.applicable_kinds = interface
154+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
155+
dotnet_naming_symbols.interface.required_modifiers =
156+
157+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
158+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
159+
dotnet_naming_symbols.types.required_modifiers =
160+
161+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
162+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
163+
dotnet_naming_symbols.non_field_members.required_modifiers =
164+
165+
# Naming styles
166+
dotnet_naming_style.pascal_case.required_prefix =
167+
dotnet_naming_style.pascal_case.required_suffix =
168+
dotnet_naming_style.pascal_case.word_separator =
169+
dotnet_naming_style.pascal_case.capitalization = pascal_case
170+
171+
dotnet_naming_style.begins_with_i.required_prefix = I
172+
dotnet_naming_style.begins_with_i.required_suffix =
173+
dotnet_naming_style.begins_with_i.word_separator =
174+
dotnet_naming_style.begins_with_i.capitalization = pascal_case

.gitignore

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
1+
# Visual Studio and IDEs
12
.vs
2-
*.bak
3-
node_modules
3+
.vscode
4+
.idea
5+
*.user
6+
*.suo
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# Build results
411
bin/
512
obj/
6-
TestResults/
13+
[Dd]ebug/
14+
[Rr]elease/
15+
x64/
16+
x86/
17+
[Aa]rm/
18+
[Aa]rm64/
19+
bld/
20+
[Bb]in/
21+
[Oo]bj/
722
drop/
23+
24+
# Test results
25+
TestResults/
26+
[Tt]est[Rr]esult*/
27+
*.trx
28+
*.coverage
29+
*.coveragexml
30+
31+
# Node.js
32+
node_modules/
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
37+
# Backup files
38+
*.bak
39+
*~
40+
*.swp
41+
42+
# OS files
43+
.DS_Store
44+
Thumbs.db
45+
46+
# NuGet
47+
*.nupkg
48+
*.snupkg
49+
.nuget/

AGENTS.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,53 @@ applications packaged as [.NET Tools][dotnet-tools].
1111

1212
```text
1313
DotnetToolWrapper/
14+
├── .config/
15+
│ └── dotnet-tools.json # .NET tools configuration (sbom-tool, spdx-tool)
1416
├── .github/
17+
│ ├── ISSUE_TEMPLATE/ # GitHub issue templates
18+
│ │ ├── bug_report.yml
19+
│ │ ├── feature_request.yml
20+
│ │ └── config.yml
21+
│ ├── dependabot.yml # Dependabot configuration
1522
│ └── workflows/ # GitHub Actions workflows
1623
│ ├── build.yaml # Reusable build workflow
1724
│ ├── build_on_push.yaml # Triggered on push events
1825
│ └── release.yaml # Release workflow
26+
├── docs/
27+
│ └── usage.md # Detailed usage documentation
1928
├── src/
2029
│ └── DemaConsulting.DotnetToolWrapper/
2130
│ ├── Program.cs # Main application logic
2231
│ └── DemaConsulting.DotnetToolWrapper.csproj
32+
├── test/
33+
│ └── DemaConsulting.DotnetToolWrapper.Tests/
34+
│ ├── IntegrationTests.cs
35+
│ ├── ProgramTests.cs
36+
│ ├── Runner.cs
37+
│ └── DemaConsulting.DotnetToolWrapper.Tests.csproj
2338
├── .cspell.json # Spelling check configuration
39+
├── .editorconfig # Editor configuration for consistent formatting
40+
├── .gitignore # Git ignore patterns
2441
├── .markdownlint.json # Markdown linting configuration
25-
├── README.md # Project documentation
42+
├── AGENTS.md # This file - Agent instructions
43+
├── ARCHITECTURE.md # Architecture documentation
44+
├── CODE_OF_CONDUCT.md # Community code of conduct
45+
├── CONTRIBUTING.md # Contribution guidelines
46+
├── DemaConsulting.DotnetToolWrapper.sln
2647
├── LICENSE # MIT License
48+
├── README.md # Project documentation
49+
├── SECURITY.md # Security policy
2750
└── spdx-workflow.yaml # SBOM enhancement workflow
2851
```
2952

3053
## Key Technologies
3154

3255
- **.NET 8.0, 9.0, 10.0**: Multi-targeted framework versions
3356
- **C# 12**: Programming language
57+
- **MSTest**: Testing framework
3458
- **GitHub Actions**: CI/CD automation
35-
- **SBOM Tools**: Software Bill of Materials generation
59+
- **SBOM Tools**: Software Bill of Materials generation (sbom-tool, spdx-tool)
60+
- **Code Analyzers**: Microsoft.CodeAnalysis.NetAnalyzers 10.0.101, SonarAnalyzer.CSharp 10.17.0.131074
3661

3762
## Development Guidelines
3863

@@ -43,12 +68,29 @@ dotnet restore
4368
dotnet build --configuration Release
4469
```
4570

71+
### Testing the Project
72+
73+
```bash
74+
# Run all tests
75+
dotnet test --configuration Release
76+
77+
# Run tests with detailed output
78+
dotnet test --configuration Release --logger "console;verbosity=detailed"
79+
```
80+
81+
The test project uses MSTest and includes:
82+
83+
- **Unit Tests**: `ProgramTests.cs` - Tests for core program logic
84+
- **Integration Tests**: `IntegrationTests.cs` - End-to-end tests with actual execution
85+
- **Test Runner**: `Runner.cs` - Helper for running the tool in tests
86+
4687
### Code Standards
4788

4889
- **Language Version**: C# 12
4990
- **Nullable Reference Types**: Enabled
5091
- **Implicit Usings**: Enabled
5192
- **Target Frameworks**: net8.0, net9.0, net10.0
93+
- **EditorConfig**: Follow the .editorconfig rules for consistent code formatting
5294

5395
### Workflow Structure
5496

@@ -72,6 +114,11 @@ Quality checks are automated through GitHub Actions:
72114
1. **Multi-targeting**: Always ensure changes are compatible with .NET 8.0, 9.0, and 10.0
73115
2. **Cross-platform**: The tool must work on Windows, Linux, FreeBSD, and macOS
74116
3. **Architecture Support**: Support x86, x64, ARM, ARM64, WASM, and S390x architectures
117+
4. **Testing**: Always run tests after making changes. The CI runs tests on ubuntu-latest,
118+
windows-latest, and macos-latest
119+
5. **Code Quality**: Maintain `TreatWarningsAsErrors` - all warnings must be fixed
120+
6. **Analyzers**: Keep analyzer packages (Microsoft.CodeAnalysis.NetAnalyzers and
121+
SonarAnalyzer.CSharp) at the same version across all projects
75122

76123
### When Modifying Workflows
77124

@@ -98,7 +145,9 @@ Quality checks are automated through GitHub Actions:
98145

99146
### Adding New Dependencies
100147

101-
Update the `.csproj` file in `src/DemaConsulting.DotnetToolWrapper/`
148+
1. Update the `.csproj` file in `src/DemaConsulting.DotnetToolWrapper/`
149+
2. If adding analyzer packages, ensure test project also gets the same version
150+
3. Dependabot is configured to automatically update NuGet packages in the `nuget-dependencies` group
102151

103152
### Modifying Build Output
104153

@@ -115,8 +164,17 @@ Edit the "Create Drop Folder" step in `.github/workflows/build.yaml`
115164
Before committing:
116165

117166
1. Build locally: `dotnet build --configuration Release`
118-
2. Run spelling checks: `npx cspell "**/*.md"`
119-
3. Run markdown linting: `npx markdownlint "**/*.md"`
167+
2. Run tests: `dotnet test --configuration Release`
168+
3. Run spelling checks: `npx cspell "**/*.md"`
169+
4. Run markdown linting: `npx markdownlint "**/*.md"`
170+
171+
## Issue Templates
172+
173+
The repository includes structured issue templates:
174+
175+
- **Bug Report** (`.github/ISSUE_TEMPLATE/bug_report.yml`) - For reporting bugs with system information
176+
- **Feature Request** (`.github/ISSUE_TEMPLATE/feature_request.yml`) - For suggesting new features
177+
- **Config** (`.github/ISSUE_TEMPLATE/config.yml`) - Links to discussions and other resources
120178

121179
## Related Documentation
122180

@@ -125,6 +183,7 @@ Before committing:
125183
- [CONTRIBUTING.md](CONTRIBUTING.md) - Contribution guidelines and development setup
126184
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Community code of conduct
127185
- [SECURITY.md](SECURITY.md) - Security policy and vulnerability reporting
186+
- [docs/usage.md](docs/usage.md) - Comprehensive usage guide with examples
128187
- [LICENSE](LICENSE) - MIT License terms
129188

130189
## Contact

test/DemaConsulting.DotnetToolWrapper.Tests/DemaConsulting.DotnetToolWrapper.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>
20-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
20+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.101">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
2424
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
2525
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
2626
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
27-
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.4.0.108396">
27+
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.17.0.131074">
2828
<PrivateAssets>all</PrivateAssets>
2929
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3030
</PackageReference>

0 commit comments

Comments
 (0)