Skip to content

Commit fa5199f

Browse files
committed
Update to JADNC v5.1
1 parent 2c6a1e7 commit fa5199f

26 files changed

+250
-106
lines changed

Diff for: .config/dotnet-tools.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2021.3.4",
6+
"version": "2022.2.3",
77
"commands": [
88
"jb"
99
]
1010
},
1111
"regitlint": {
12-
"version": "6.0.8",
12+
"version": "6.1.1",
1313
"commands": [
1414
"regitlint"
1515
]
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
"dotnet-reportgenerator-globaltool": {
24-
"version": "5.1.4",
24+
"version": "5.1.3",
2525
"commands": [
2626
"reportgenerator"
2727
]

Diff for: .editorconfig

+33-29
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ indent_style = space
66
indent_size = 4
77
charset = utf-8
88
trim_trailing_whitespace = true
9-
end_of_line = lf
109
insert_final_newline = true
1110

12-
[*.{csproj,json}]
11+
[*.{config,csproj,css,js,json,props,ruleset,xslt}]
1312
indent_size = 2
1413

1514
[*.{cs}]
16-
#### .NET Coding Conventions ####
15+
#### C#/.NET Coding Conventions ####
1716

18-
# Organize usings
17+
# 'using' directive preferences
1918
dotnet_sort_system_directives_first = true
19+
csharp_using_directive_placement = outside_namespace:suggestion
20+
21+
# Namespace declarations
22+
csharp_style_namespace_declarations = file_scoped:suggestion
2023

2124
# this. preferences
2225
dotnet_style_qualification_for_field = false:suggestion
@@ -30,13 +33,15 @@ dotnet_style_predefined_type_for_member_access = true:suggestion
3033

3134
# Modifier preferences
3235
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
36+
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
3337
csharp_style_pattern_local_over_anonymous_function = false:silent
3438

3539
# Expression-level preferences
3640
dotnet_style_operator_placement_when_wrapping = end_of_line
3741
dotnet_style_prefer_auto_properties = true:suggestion
3842
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
3943
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
44+
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
4045

4146
# Parameter preferences
4247
dotnet_code_quality_unused_parameters = non_public:suggestion
@@ -54,38 +59,38 @@ csharp_style_expression_bodied_properties = true:suggestion
5459
# Code-block preferences
5560
csharp_prefer_braces = true:suggestion
5661

57-
# Expression-level preferences
58-
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
59-
60-
# 'using' directive preferences
61-
csharp_using_directive_placement = outside_namespace:suggestion
62-
63-
64-
#### C# Formatting Rules ####
65-
6662
# Indentation preferences
6763
csharp_indent_case_contents_when_block = false
6864

6965
# Wrapping preferences
7066
csharp_preserve_single_line_statements = false
7167

68+
# 'var' usage preferences
69+
csharp_style_var_for_built_in_types = false:suggestion
70+
csharp_style_var_when_type_is_apparent = true:suggestion
71+
csharp_style_var_elsewhere = false:suggestion
72+
73+
# Parentheses preferences
74+
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
75+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
76+
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion
7277

73-
#### Naming styles ####
78+
#### Naming Style ####
7479

7580
dotnet_diagnostic.IDE1006.severity = warning
7681

7782
# Naming rules
78-
dotnet_naming_rule.private_const_fields_should_be_pascal_case.symbols = private_const_fields
79-
dotnet_naming_rule.private_const_fields_should_be_pascal_case.style = pascal_case
80-
dotnet_naming_rule.private_const_fields_should_be_pascal_case.severity = warning
83+
dotnet_naming_rule.const_fields_should_be_pascal_case.symbols = const_fields
84+
dotnet_naming_rule.const_fields_should_be_pascal_case.style = pascal_case
85+
dotnet_naming_rule.const_fields_should_be_pascal_case.severity = warning
8186

8287
dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.symbols = private_static_readonly_fields
8388
dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.style = pascal_case
8489
dotnet_naming_rule.private_static_readonly_fields_should_be_pascal_case.severity = warning
8590

86-
dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.symbols = private_static_or_readonly_fields
87-
dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.style = camel_case_prefix_with_underscore
88-
dotnet_naming_rule.private_static_or_readonly_fields_should_start_with_underscore.severity = warning
91+
dotnet_naming_rule.private_fields_should_start_with_underscore.symbols = private_fields
92+
dotnet_naming_rule.private_fields_should_start_with_underscore.style = camel_case_prefix_with_underscore
93+
dotnet_naming_rule.private_fields_should_start_with_underscore.severity = warning
8994

9095
dotnet_naming_rule.locals_and_parameters_should_be_camel_case.symbols = locals_and_parameters
9196
dotnet_naming_rule.locals_and_parameters_should_be_camel_case.style = camel_case
@@ -96,25 +101,24 @@ dotnet_naming_rule.types_and_members_should_be_pascal_case.style = pascal_case
96101
dotnet_naming_rule.types_and_members_should_be_pascal_case.severity = warning
97102

98103
# Symbol specifications
99-
dotnet_naming_symbols.private_const_fields.applicable_kinds = field
100-
dotnet_naming_symbols.private_const_fields.applicable_accessibilities = private
101-
dotnet_naming_symbols.private_const_fields.required_modifiers = const
104+
dotnet_naming_symbols.const_fields.applicable_kinds = field
105+
dotnet_naming_symbols.const_fields.applicable_accessibilities = *
106+
dotnet_naming_symbols.const_fields.required_modifiers = const
102107

103108
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
104109
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private
105-
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static,readonly
110+
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly
106111

107-
dotnet_naming_symbols.private_static_or_readonly_fields.applicable_kinds = field
108-
dotnet_naming_symbols.private_static_or_readonly_fields.applicable_accessibilities = private
109-
dotnet_naming_symbols.private_static_or_readonly_fields.required_modifiers = static readonly
112+
dotnet_naming_symbols.private_fields.applicable_kinds = field
113+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
110114

111-
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = local,parameter
115+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = local, parameter
112116
dotnet_naming_symbols.locals_and_parameters.applicable_accessibilities = *
113117

114118
dotnet_naming_symbols.types_and_members.applicable_kinds = *
115119
dotnet_naming_symbols.types_and_members.applicable_accessibilities = *
116120

117-
# Naming styles
121+
# Style specifications
118122
dotnet_naming_style.pascal_case.capitalization = pascal_case
119123

120124
dotnet_naming_style.camel_case_prefix_with_underscore.required_prefix = _

Diff for: .gitignore

+64-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33
##
4-
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
4+
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
# User-specific files
77
*.rsuser
@@ -90,16 +90,14 @@ StyleCopReport.xml
9090
*.tmp_proj
9191
*_wpftmp.csproj
9292
*.log
93+
*.tlog
9394
*.vspscc
9495
*.vssscc
9596
.builds
9697
*.pidb
9798
*.svclog
9899
*.scc
99100

100-
# MacOS file systems
101-
**/.DS_STORE
102-
103101
# Chutzpah Test files
104102
_Chutzpah*
105103

@@ -134,9 +132,6 @@ _ReSharper*/
134132
*.[Rr]e[Ss]harper
135133
*.DotSettings.user
136134

137-
# JetBrains Rider
138-
.idea/
139-
140135
# TeamCity is a build add-in
141136
_TeamCity*
142137

@@ -148,7 +143,9 @@ _TeamCity*
148143
!.axoCover/settings.json
149144

150145
# Coverlet is a free, cross platform Code Coverage Tool
151-
coverage*[.json, .xml, .info]
146+
coverage*.json
147+
coverage*.xml
148+
coverage*.info
152149

153150
# Visual Studio code coverage results
154151
*.coverage
@@ -297,6 +294,17 @@ node_modules/
297294
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
298295
*.vbw
299296

297+
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
298+
*.vbp
299+
300+
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
301+
*.dsw
302+
*.dsp
303+
304+
# Visual Studio 6 technical files
305+
*.ncb
306+
*.aps
307+
300308
# Visual Studio LightSwitch build output
301309
**/*.HTMLClient/GeneratedArtifacts
302310
**/*.DesktopClient/GeneratedArtifacts
@@ -353,6 +361,9 @@ ASALocalRun/
353361
# Local History for Visual Studio
354362
.localhistory/
355363

364+
# Visual Studio History (VSHistory) files
365+
.vshistory/
366+
356367
# BeatPulse healthcheck temp database
357368
healthchecksdb
358369

@@ -365,5 +376,50 @@ MigrationBackup/
365376
# Fody - auto-generated XML schema
366377
FodyWeavers.xsd
367378

379+
# VS Code files for those working on multiple tools
380+
.vscode/*
381+
!.vscode/settings.json
382+
!.vscode/tasks.json
383+
!.vscode/launch.json
384+
!.vscode/extensions.json
385+
*.code-workspace
386+
387+
# Local History for Visual Studio Code
388+
.history/
389+
390+
# Windows Installer files from build outputs
391+
*.cab
392+
*.msi
393+
*.msix
394+
*.msm
395+
*.msp
396+
397+
# JetBrains Rider
398+
*.sln.iml
399+
400+
#############################################
401+
### Additions specific to this repository ###
402+
#############################################
403+
404+
# MacOS file systems
405+
**/.DS_STORE
406+
368407
# Sqlite example databases
369408
*.db
409+
410+
# JetBrains IDEs Rider/IntelliJ (based on https://intellij-support.jetbrains.com/hc/en-us/articles/206544839)
411+
**/.idea/**/*.xml
412+
**/.idea/**/*.iml
413+
**/.idea/**/*.ids
414+
**/.idea/**/*.ipr
415+
**/.idea/**/*.iws
416+
**/.idea/**/*.name
417+
**/.idea/**/*.properties
418+
**/.idea/**/*.ser
419+
**/.idea/**/shelf/
420+
**/.idea/**/dictionaries/
421+
**/.idea/**/libraries/
422+
**/.idea/**/artifacts/
423+
**/.idea/**/httpRequests/
424+
**/.idea/**/dataSources/
425+
!**/.idea/**/codeStyles/*

Diff for: .idea/.idea.JsonApiDotNetCore.MongoDb/.idea/.gitignore

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/.idea.JsonApiDotNetCore.MongoDb/.idea/codeStyles/Project.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/.idea.JsonApiDotNetCore.MongoDb/.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Build.ps1

+17-10
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ function CheckLastExitCode {
88

99
function RunInspectCode {
1010
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
11-
# passing --build instead of --no-build as workaround for https://youtrack.jetbrains.com/issue/RSRP-487054
12-
dotnet jb inspectcode JsonApiDotNetCore.MongoDb.sln --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
11+
dotnet jb inspectcode JsonApiDotNetCore.MongoDb.sln --no-build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
1312
CheckLastExitCode
1413

1514
[xml]$xml = Get-Content "$outputPath"
@@ -40,16 +39,21 @@ function RunCleanupCode {
4039
# When running in cibuild for a pull request, this reformats only the files changed in the PR and fails if the reformat produces changes.
4140

4241
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) {
43-
Write-Output "Running code cleanup on changed files in pull request"
44-
4542
# In the past, we used $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT for the merge commit hash. That is the pinned hash at the time the build is enqueued.
4643
# When a force-push happens after that, while the build hasn't yet started, this hash becomes invalid during the build, resulting in a lookup error.
47-
# To prevent failing the build for unobvious reasons we use HEAD, which is always the latest version.
48-
$mergeCommitHash = git rev-parse "HEAD"
49-
$targetCommitHash = git rev-parse "$env:APPVEYOR_REPO_BRANCH"
44+
# To prevent failing the build for unobvious reasons we use HEAD, which is always a detached head (the PR merge result).
45+
46+
$headCommitHash = git rev-parse HEAD
47+
CheckLastExitCode
5048

51-
dotnet regitlint -s JsonApiDotNetCore.MongoDb.sln --print-command --disable-jb-path-hack --jb --profile='\"JADNC Full Cleanup\"' --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $mergeCommitHash -b $targetCommitHash --fail-on-diff --print-diff
49+
$baseCommitHash = git rev-parse "$env:APPVEYOR_REPO_BRANCH"
5250
CheckLastExitCode
51+
52+
if ($baseCommitHash -ne $headCommitHash) {
53+
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
54+
dotnet regitlint -s JsonApiDotNetCore.MongoDb.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
55+
CheckLastExitCode
56+
}
5357
}
5458
}
5559

@@ -100,8 +104,11 @@ CheckLastExitCode
100104
dotnet build -c Release
101105
CheckLastExitCode
102106

103-
RunInspectCode
104-
RunCleanupCode
107+
# https://youtrack.jetbrains.com/issue/RSRP-488628/Breaking-InspectCode-fails-with-Roslyn-Worker-process-exited-unexpectedly-after-update
108+
if ($env:APPVEYOR_BUILD_WORKER_IMAGE -ne 'Ubuntu') {
109+
RunInspectCode
110+
RunCleanupCode
111+
}
105112

106113
dotnet test -c Release --no-build --collect:"XPlat Code Coverage"
107114
CheckLastExitCode

Diff for: Directory.Build.props

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<PropertyGroup>
33
<TargetFrameworkName>net6.0</TargetFrameworkName>
44
<AspNetVersion>6.0.*</AspNetVersion>
5-
<JsonApiDotNetCoreVersion>5.0.1</JsonApiDotNetCoreVersion>
5+
<JsonApiDotNetCoreVersion>5.1.0</JsonApiDotNetCoreVersion>
66
<MongoDBDriverVersion>2.15.0</MongoDBDriverVersion>
7-
<JsonApiDotNetCoreMongoDbVersionPrefix>5.0.2</JsonApiDotNetCoreMongoDbVersionPrefix>
7+
<JsonApiDotNetCoreMongoDbVersionPrefix>5.1.0</JsonApiDotNetCoreMongoDbVersionPrefix>
88
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
99
<WarningLevel>9999</WarningLevel>
1010
<Nullable>enable</Nullable>
@@ -14,8 +14,8 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
18-
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.0" PrivateAssets="All" />
17+
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
18+
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.2" PrivateAssets="All" />
1919
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
2020
</ItemGroup>
2121

@@ -31,8 +31,8 @@
3131

3232
<!-- Test Project Dependencies -->
3333
<PropertyGroup>
34-
<CoverletVersion>3.1.2</CoverletVersion>
34+
<CoverletVersion>3.2.0</CoverletVersion>
3535
<MoqVersion>4.16.1</MoqVersion>
36-
<TestSdkVersion>17.1.0</TestSdkVersion>
36+
<TestSdkVersion>17.4.0</TestSdkVersion>
3737
</PropertyGroup>
3838
</Project>

0 commit comments

Comments
 (0)