Release 9.5 introduces 9 new rules for C# and VB.NET developers, providing guidelines and best practices for handling date and time operations within their applications.
These rules cover a wide range of topics, including time zone conventions, common pitfalls, date parsing and formatting, time arithmetic, and more.
This release includes also one additional security rule and introduces fixes for false negatives and false positives.
Thanks to @Corniel for his contribution by implementing a new codefix for S6610 (#7517) and fixing a FP in S6354 (#7504).
New Rules
Date & time
7080 - [C#, VB.NET] New rule S6588: Use DateTime(Offset).UnixEpoch instead of pointing to that date using the constructor
7085 - [C#, VB.NET] New rule S6566: Always use DateTimeOffset instead of DateTime
7083 - [C#, VB.NET] New rule S6561: Do not use DateTime.Now for benchmarking or timing operations
7081 - [C#, VB.NET] New rule S6562: Always set the DateTimeKind when creating a new DateTime object
7079 - [C#, VB.NET] New rule S6585: Don't hardcode the format provider when turning dates and times to string
7078 - [C#, VB.NET] New Rule S6580: Always use DateTime.Parse overloads with an IFormatProvider parameter
7077 - [C#, VB.NET] New rule S6575: Use TimeZoneInfo.FindSystemTimeZoneById instead of TimezoneConverter
7076 - [C#, VB.NET] New Rule S6563: Use UTC when recoding DateTime instants
7490|7086 - [C#, VB.NET] New rule S3363: Date and time should not be used as types for primary keys
Others
7290 - [C#] New rule S6640: Allowing unsafe code is security-sensitive
7261 - [C#] Fix S2077 FN: Add support for Mono.Data.Sqlite
7323 - [C#] Fix S2068 FN: add support for SecureString
9.4
Release 9.4 brings one new rule for C# and four new rules for VB.NET. It also brings improvements by migrating two more rules to the new symbolic execution engine, fixing false positives, and improving memory allocation.
Thanks to @sharwell for his contribution by reporting 7438.
Thanks to @Corniel for his contribution by implementing new rule S2925 in 7342.
New Rules
7305 - [VB.NET] New rule S3966: Objects should not be disposed more than once
7304 - [VB.NET] New rule S1944: Invalid casts should not be made
7303 - [VB.NET] New rule S4158: Empty collections should not be accessed or iterated
7342 - [C#, VB.NET] New Rule: S2925 Do not use Thread.Sleep() in a test
Improvements
7302 - [C#] Migrate S3966 to the new Symbolic Execution engine
7300 - [C#] Migrate S4158 to the new Symbolic Execution engine
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps SonarAnalyzer.CSharp from 9.3.0.71466 to 9.5.0.73987.
Release notes
Sourced from SonarAnalyzer.CSharp's releases.
... (truncated)
Commits
31e3fbe
Fix S6566: change file name (#7549)8679b2e
Update RSPECs as part of the LayC second migration (batch#6) (#7546)9499b84
Modify S6580: Update RSPEC (#7544)d8023fe
Update RSPEC for datetime rules (#7541)5735c1f
Update RSPECs as part of the LayC second migration (batch#4) (#7540)5b9856d
Remove redundant DiagnosticAnalyzer attributes (#7539)995813c
Adds quickfix for rule S6588 (#7536)c51db9b
New Rule S6580: Use a format provider when parsing date and time (#7525)6fc100a
Bump vbnet plugin size (#7538)d48fd57
Bump C# rule count (#7537)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)