Releases: nunit/nunit.analyzers
NUnit Analyzers 3.9 (and 2.9)
NUnit Analyzers 3.9 (and 2.9) - October 27, 2023
This release contains bugfixes to NUnit2045 - Use Assert.Multiple - and NUnit1032 -
An IDisposable field/property should be Disposed in a TearDown method - and corrects
a StackOverflowException when tests calls methods recursively.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Bugs
NUnit Analyzers 3.8 (and 2.8)
NUnit Analyzers 3.8 (and 2.8) - September 25, 2023
This release contains a fix to the WithinUsageAnalyzer and handling of false duplicates when
combining NUnit1032 - An IDisposable field/property should be Disposed in a TearDown method -
with LifeCycle.InstancePerTestCase.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #595 NUnit1032 false positive in LifeCycle.InstancePerTestCase test fixture using constructor
Bugs
- #596 WithinUsageAnalyzer threw an exception of type 'System.IndexOutOfRangeException'
Tooling, Process, and Documentation
- #598 Update NUnit1032.md to fix typo Dipose -> Dispose.
NUnit Analyzers 3.7 (and 2.7)
NUnit Analyzers 3.7 (and 2.7) - September 16, 2023
This release contains a lot of improvements and corrections to the supression of non-nullable fields and properties
that are assigned in setup methods (and not in constructors). We have also added suppression of:
- CA1812 - Avoid uninstantiated internal classes - on test classes
- CA1001 - Types that own disposable fields should be disposable - when disposed is called in TearDown methods
The release also contain some improvements to the performance of the analyzers by avoid repeated calls to
GetTypeByMetadataName. Also ValuesAttribute is now also handled by the analyzer in a similar manner as TestCaseAttribute.
Most of the work done in this release have either been driven by or made by @manfred-brands.
The release contains contributions from the following users (in alphabetical order):
- @333fred
- @Corniel
- @andrewimcclement
- @IlIlIllIllI
- @jhinder
- @MaceWindu
- @manfred-brands
- @mikkelbu
- @RenderMichael
- @SeanKilleen
- @stevenaw
Issues Resolved
Features and Enhancements
- #585 NonNullableFieldOrPropertyIsUninitializedSuppressor doesn't check async methods called from SetUp
- #582 NonNullableFieldOrPropertyIsUninitializedSuppressor does not detect assignments in try/finally blocks
- #569 Added a suppressor when CA1812 fires on NUnit Test classes.
- #568 Feature request: suppress CA1001 when Dispose is called in the TearDown method
- #561 NUnit2021 error shown when comparing Uri and string
- #548 Use RegisterCompilationStartAction to avoid repeated calls to GetTypeByMetadataName
- #542 Allow the *Source Analyzers to permit Task
- #462 DiagnosticsSuppress does not suppress CS8634
- #344 Add a rule informing that .Within is not valid for non-numeric types.
- #52 Reuse TestCaseAttribute logic for ValuesAttribute improvement
Bugs
- #587 Buggy interaction between the Assert.Multiple fixer and null reference suppression
- #580 False positive for WithinUsageAnalyzer
- #559 FP NUnit1001: CustomTypeConverters could convert from anything
- #549 Code Fix for NUnit2010 on Ref Structs Creates CS0306
- #541 [NUnit2045] Incorrect refactoring
- #535 DiagnosticSuppressor doesn't suppress values passed as arguments
- #534 QuickFix for Assert.Multiple looses white space before and comments after bug
Tooling, Process, and Documentation
- #579 chore: Bump Microsoft.NET.Test.Sdk
- #578 chore(deps): Bump Microsoft.CodeAnalysis.NetAnalyzers
- #573 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1
- #571 chore(deps): Bump System.Collections.Immutable from 6.0.0 to 7.0.0
- #567 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.6.3 to 17.7.0
- #566 Update CONTRIBUTING.md to fix link to MS documentation.
- #560 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.6.2 to 17.6.3
- #558 chore(deps): Bump StyleCop.Analyzers.Unstable from 1.2.0.435 to 1.2.0.507
- #557 chore(deps): Bump Microsoft.CodeAnalysis.NetAnalyzers from 7.0.1 to 7.0.3
- #556 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.6.1 to 17.6.2
- #553 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.6.0 to 17.6.1
- #551 chore(deps): Bump NUnit3TestAdapter from 4.4.2 to 4.5.0
- #547 chore(deps): Bump CSharpIsNullAnalyzer from 0.1.300 to 0.1.495
- #543 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.0
- #531 Markdown fixes
NUnit Analyzers 3.6.1 (and 2.6.1) - March 10, 2023
NUnit Analyzers 3.6.1 (and 2.6.1) - March 10, 2023
This release of the NUnit Analyzers contain a single bug fix and some updates of dependencies.
The bug fix removes a false from NUnit1030 - "The type of parameter provided by the TestCaseSource
does not match the type of the parameter in the Test method" - when using TestCaseParameters.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Bugs
- #523 False positive for NUnit1030 with TestCaseParameters bug
Tooling, Process, and Documentation
NUnit Analyzers 3.6 (and 2.6)
NUnit Analyzers 3.6 (and 2.6) - February 21, 2023
This release of the NUnit Analyzers improves on the analysis of nullable reference types - in particular
in case of null coalescing operator and tuple deconstruction assignments.
The release also adds two new diagnostics for the TestCaseSource attribute. The diagnostics examines the test data returned
from the TestCaseSource:
- NUnit1029 - The number of parameters provided by the TestCaseSource does not match the number of parameters in the Test method
- NUnit1030 - The type of parameter provided by the TestCaseSource does not match the type of the parameter in the Test method
In addition, the release also contains some bug fixes to existing analyzers, and we have added a GitHub Actions workflow
and status badge.
The release contains contributions from the following users (in alphabetical order):
- @get-me-power
- @Hounsvad
- @JasonBock
- @manfred-brands
- @mikkelbu
- @nowsprinting
- @oskar
- @SeanKilleen
- @yaakov-h
The majority of the code contributions were provided by @manfred-brands.
Issues Resolved
Features and Enhancements
- #503 DiagnosticsSuppressor doesn't suppress null coalescing operator
- #499 DiagnosticSuppressor doesn't detect tuple deconstruction assignments
- #442 Analyzer for TestCaseSource does not check Test method parameters
Bugs
- #509 Giving TestCaseAttribute an explicit decimal for a parameter that is a decimal gives a Nunit 1001 error
- #496 NUnit2045 code-fix does not correctly lift asynchronous assertions into Assert.Multiple
- #475 Code Fix for NUnit2010 on Ref Structs Creates CS1503
Tooling, Process, and Documentation
- #519 chore: Update year to 2023
- #518 fix: Correct MSDN link on new pages
- #516 Replace link to ruleset docs
- #507 chore: Add Github Action build status badge
- #500 Fix path to global.json
- #497 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.3.2 to 17.4.1
- #489 Add note about works with unity3d
- #487 chore(deps): Bump NUnit3TestAdapter from 4.2.1 to 4.3.0
- #486 chore: Bump version to 3.6 (2.6)
- #476 [add] GitHub Actions workflow for running test
NUnit Analyzers 3.5 (and 2.5)
NUnit Analyzers 3.5 (and 2.5) - October 23, 2022
This release of the NUnit Analyzers only fixes the casing in a file name in the nuget file as nuget upload validation failed.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Tooling, Process, and Documentation
NUnit Analyzers 3.4 (and 2.4)
NUnit Analyzers 3.4 (and 2.4) - October 23, 2022
This release of the NUnit Analyzers improves on false positives in the existing analyzers for:
- NUnit2021 - "Incompatible types for EqualTo constraint"
- NUnit2046 - "Use CollectionConstraint for better assertion messages in case of failure"
The release also improves on NUnit3002 - "Field/Property is initialized in SetUp or OneTimeSetUp method" to
also consider initialization in overridden SetUp methods, and adds support for classic StringAssert constraints
in NUnit2007 - "The actual value should not be a constant" - analyzer and code fix.
In addition, the release also contains some bug fixes to existing analyzers.
Moreover, several dependencies have been bumped in this release and the build process has been improved.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #465 False positive for NUnit2021 with Throws/EqualTo contraint
- #459 False positives for NUnit2046 on non-array-like types
- #453 Support classic StringAssert in ConstActualValueUsage analyzer and code fix
- #448 Analyzer doesn't detect non-nullable field set in overridden SetUp method
Bugs
- #440 Analyzer conversion for class with Count property can be incorrect
- #436 Using Has.Count in Assert.Multiple re-raises nullable reference warning
- #420 NUnit2045 raises IndexOutOfRangeException on CodeAnalysis
Tooling, Process, and Documentation
- #479 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.3.1 to 17.3.2 in /src
- #470 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.2.0 to 17.3.1 in /src
- #467 Build Issues
- #463 chore(deps): Bump Nullable from 1.3.0 to 1.3.1 in /src
- #461 chore(deps): Bump Gu.Roslyn.Asserts from 4.2.1 to 4.3.0 in /src
- #456 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0 in /src
- #455 chore(deps): Bump Gu.Roslyn.Asserts from 4.2.0 to 4.2.1 in /src
- #454 Ignore Rider IDE files
- #452 chore(deps): Bump StyleCop.Analyzers.Unstable from 1.2.0.406 to 1.2.0.435 in /src
- #451 Mark build.sh as executable
- #446 Move to latest Gu.Roslyn.Assert nuget packages
- #441 chore(deps): Bump NUnit from 3.13.2 to 3.13.3 in /src
- #440 chore(deps): Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.1.0 in /src
- #437 chore(deps): Bump NUnit3TestAdapter from 4.1.0 to 4.2.1 in /src
- #428 Move to use cake as a dotnet tool
- #419 chore: Bump version to 3.4 (2.4)
- #418 Add README.md to nuget file
- #272 Enforce coding standard more strictly
NUnit Analyzers 3.3 (and 2.3)
NUnit Analyzers 3.3 (and 2.3) - January 8, 2022
This release of the NUnit Analyzers adds a DiagnosticSuppressor for Nullable<T>
, an analyzer and a code fix
for rewriting independent asserts into Assert.Multiple
, and an analyzer and a code fix for replacing calls to
.Length
or .Count()
in the actual expression with inbuilt assertion functionality. The release also contains
some bug fixes to existing analyzers.
Moreover, several dependencies have been bumped in this release.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #414 Add DiagnosticSuppressor for
Nullable<T>
- #389 Idea: Suggest
Assert.Multiple
in tests where Assert statements are called back to back - #330 Analyzer to warn against calling
.Length
or.Count()
in the actual expression
Bugs
- #410 NUnit2044 false-positive on explicit delegate type
- #407 NUnit2022 false-positive on generic Dictionary type bug
Tooling, Process, and Documentation
- #401 chore(deps): Bump NUnit3TestAdapter from 4.0.0 to 4.1.0 in /src
- #398 Ensure all NunitFrameworkConstants are tested
- #397 Allow using C# 9
- #396 chore(deps): Bump Microsoft.NET.Test.Sdk from 16.11.0 to 17.0.0 in /src
- #394 chore(deps): Bump Microsoft.CodeAnalysis.Analyzers from 3.3.2 to 3.3.3 in /src
- #392 Replace netcoreapp2.1 for test with netcoreapp3.1
- #388 chore: Bump version to 3.3 (2.3)
- #381 Update Code of Conduct
NUnit Analyzers 3.2 (and 2.2)
NUnit Analyzers 3.2 (and 2.2) - August 28, 2021
This release of the NUnit Analyzers contains an improvement to the suppression of
'Non-nullable field must contain a non-null value when exiting constructor (CS8618)'
when the field/property is initialized by a method called from a SetUp/OneTimeSetUp method.
Moreover, several dependencies have been bumped in this release.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #385 Supress (even more) 'Non-nullable field must contain a non-null value when exiting constructor (CS8618)'
Tooling, Process, and Documentation
- #384 chore(deps): Bump Microsoft.NET.Test.Sdk from 16.10.0 to 16.11.0 in /src
- #379 chore(deps): Bump StyleCop.Analyzers.Unstable from 1.2.0.333 to 1.2.0.354 in /src
- #376 chore(deps): Bump NUnit3TestAdapter from 3.17.0 to 4.0.0 in /src
- #375 chore(deps): Bump Microsoft.NET.Test.Sdk from 16.9.4 to 16.10.0 in /src
- #374 chore(deps): Bump NUnit from 3.13.1 to 3.13.2 in /src
- #373 chore: Bump version to 3.2 (2.2)
- #367 chore(deps): Bump Microsoft.CodeAnalysis.CSharp.CodeStyle from 3.8.0 to 3.9.0 in /src
NUnit Analyzers 3.1 (and 2.1)
NUnit Analyzers 3.1 (and 2.1) - April 4, 2021
This release of the NUnit Analyzers primarily contains improvements to the analysis of nullable reference types
to handle even more cases.
The release also contain improvements when passing a non-lambda to Throws assertions and when non-delegate actual
value is used with DelayedConstraint.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #368 Extend NonNullableFieldIsUninitialized to also work for properties
- #363 NonNullableFieldIsUninitializedSuppressor fails when there is a constructor
- #360 NonNullableFieldIsUnintializedSuppressor doesn't recognize ExpressionBody
- #357 Warns about passing a non-lambda to Throws assertions
- #353 Replace deprecated FxCopAnalyzer with NetAnalyzer
- #345 Nullable warnings should be suppressed for Assert.Catch()
- #342 Nullable suppression for Assert.Throws does not work in presence of a Assert.Multiple block
- #149 Warning when non-delegate actual value is used with DelayedConstraint
Tooling, Process, and Documentation
- #371 chore(deps): Bump Microsoft.NET.Test.Sdk from 16.9.1 to 16.9.4 in /src
- #370 chore(deps): Bump StyleCop.Analyzers.Unstable from 1.2.0.321 to 1.2.0.333 in /src
- #365 chore(deps): Bump Microsoft.NET.Test.Sdk from 16.8.3 to 16.9.1 in /src
- #358 Bump Gu.Roslyn.Asserts from 3.3.1 to 3.3.2 in /src
- #356 chore: Bump cake bootstrap to latest to make it compatible with Cake 1.0
- #352 Bump NUnit3TestAdapter from 3.15.1 to 3.17.0 in /src
- #351 Bump NUnit from 3.13 to 3.13.1 in /src
- #350 Bump StyleCop.Analyzers.Unstable from 1.2.0.261 to 1.2.0.321 in /src
- #349 Bump Microsoft.NET.Test.Sdk from 16.8.0 to 16.8.3 in /src
- #348 Bump Nullable from 1.2.1 to 1.3.0 in /src
- #347 Update dependabot.yml
- #346 Create dependabot.yml
- #341 chore: Bump version to 3.1 (2.1)