Skip to content
44 changes: 44 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# EditorConfig is awesome: https://EditorConfig.org

# See also Directory.Build.Props for additional analyzer settings

root = true

[*]
# Enforce line endings to be LF
end_of_line = lf
# Enforce indentation to be 4 spaces
indent_style = spaces
indent_size = 4
# Insert a final new line at the end of the file
insert_final_newline = true

[*.cs]

# Style faults should be warnings
dotnet_analyzer_diagnostic.category-Style.severity = warning

# Enforce file scoped namespaces
csharp_style_namespace_declarations = file_scoped:suggestion
# Place 'using' directives outside of namespaces
csharp_using_directive_placement = outside_namespace:true
# Order 'using' directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Suggest the use of var when the type is apparent
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# Suggest using expression bodies
csharp_style_expression_bodied_methods = when_on_single_line
dotnet_diagnostic.IDE0022.severity = suggestion
# Don't mix non-braces and braces for ifs
csharp_prefer_braces = when_multiline

# "Expression body is never used"
dotnet_diagnostic.IDE0058.severity = none
# "'if' statement can be simplified"
dotnet_diagnostic.IDE0046.severity = suggestion
# "Do not declare static members on generic types"
dotnet_diagnostic.CA1000.severity = none
# "Instantiate argument exceptions correctly"
dotnet_diagnostic.CA2208.severity = suggestion
4 changes: 1 addition & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
*.sh text eol=lf
**/all-tests.js eol=lf
* text eol=lf

###############################################################################
# Set default behavior for command prompt diff.
Expand Down
2 changes: 2 additions & 0 deletions Digdir.Domain.Dialogporten.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Digdir.Domain.Dialogporten.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{33E486B1-3279-4645-B536-AB640D560C45}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
docker-compose.yml = docker-compose.yml
README.md = README.md
EndProjectSection
Expand Down
20 changes: 20 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4" PrivateAssets="all" />
</ItemGroup>

<!--
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
-->

<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisMode>Recommended</AnalysisMode>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>

</Project>