Releases: nunit/nunit.analyzers
NUnit Analyzers 3.0 (and 2.0)
NUnit Analyzers 3.0 (and 2.0) - January 18, 2021
This release of the NUnit Analyzers adds the possibility to suppress compiler errors based on context.
Initially, we support the suppression of errors arising from nullable reference types (many thanks to
Manfred Brands for this major contribution). This functionality depends on a newer version of Roslyn
which is not supported in Visual Studio 2017 (only in Visual Studio 2019).
So we have decided to release two versions of the analyzers: versions starting with 2.x can be used in Visual
Studio 2017 and versions starting with 3.x can be used in Visual Studio 2019 (the major version number matches
the major version number of Roslyn). Most features will be available in both the 2.x versions and the 3.x versions,
unless they require Roslyn functionality that is only available in the 3.x versions.
The release also contains some bugfixes to existing diagnostics.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #157 Suppress nullability warnings after Is.Not.Null constraint
- #329 Analyzer to warn against comparison operators in actual expression
- #333 Add nullable suppression for Assert.Throws
Bugs
- #320 Incorrect NUnit1011 when TestCaseSource references a base class member
- #322 NUnit2021 false positive for IEquatable
- #332 NUnit2026 shouldn't fire when CustomEqualityComparer is used
Tooling, Process, and Documentation
NUnit Analyzers 0.6
NUnit Analyzers 0.6 - November 24, 2020
This release of the NUnit Analyzers corrects several false positives from the analyzers.
We have also added a dependency on the Microsoft.CodeAnalysis.Analyzers package to help
us follow Roslyn best practices. The analyzer project is now multi-targeting to allow
us to better use Nullable Reference Types in the codebase.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Bugs
- #300 NUnit2041 false positives
- #302 False positive NUnit1004 for test functions that receive array parameters
- #304 Unable to compile test project when classlib with TestCaseSources is referenced
- #306 NUnit2022 rule has false positive on hierarchies when using And
- #308 NUnit1028 false positives
- #311 NUnit1028 vs. IDisposable
- #312 NUNIT1003 false positive
Tooling, Process, and Documentation
NUnit Analyzers 0.5
NUnit Analyzers 0.5 - September 30, 2020
This release of the NUnit Analyzers adds three new diagnostics. One for ensuring that only test methods are public in a test class, one disallowing the SameAs constraint on non-reference types, and one enforcing that only compatible types are used in a comparison constraint. We have also extended several of the existing diagnostics so that they apply to more cases.
Furthermore, we have significantly improved the performance of many of the existing diagnostics - inspired by work done on the xunit.analyzers.
Finally, the documentation has been improved with additional information in the index and information about configuration of the diagnostics using .editorconfig, and we have added StyleCop and FxCop analyzers to enforce the coding standard.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Features and Enhancements
- #147 Analyzer for non-test methods to be non-public
- #197 Handle custom type converters
- #270 Get inspiration from the performance improvements made for the xunit.analyzers
- #273 NUnit2003: Add code fix with less explicit overload for testing if something is true
- #276 SameAs should warn if used with value types
- #279 Augment SameAsIncompatibleTypes and EqualToIncompatibleTypes to apply for more cases
- #293 Make diagnostic's severity consistent
Bugs
- #274 NUnit2021 fires on delegates
- #290 Not treating Func and Action properly for type compatibility.
- #280 Consider overload resolution when transforming to comparison constraints
Tooling, Process, and Documentation
- #20 Add StyleCop.Analyzers & fix warnings
- #191 Make it possible to run tests both in .NET framework and .NET Core
- #210 index.md in the documentation should also contain information about Severity
- #267 chore: Bump version to 0.5
- #268 Correct typo in NUnit1027 documentation
- #271 Documentation: Add section for each analyzer on how to configure severity using an .editorconfig file
- #288 Add FxCop Roslyn analyzer
- #296 fix: Make code compile in both targets
NUnit Analyzers 0.4
NUnit Analyzers 0.4 - July 25, 2020
This release of the NUnit Analyzers adds 13 new diagnostics and codefixes for asserts in the classical model -
e.g. Assert.Greater, Assert.IsNotEmpty, Assert.IsNotInstanceOf etc. We have also improved the handling of
asserts against constants and variables of type Task.
In addition, we now properly handle ValueSourceAttribute and test methods decorated with both a
TestAttribute and a TestCaseSourceAttribute/TestCaseAttribute. We have also added a diagnostic and codefix
to ensure that test methods are public.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Structure, TestCase, and TestCaseSource
- #93 Analyzer to ensure that the "target" of ValueSourceAttribute exists and is static
- #212 Nunit1007 - ignore [Test] attribute when [TestCaseSource] is present
- #215 Expected a warning when no arguments are specified for a parameterized test method
- #245 Ensure that Test Methods are Public
Assertions
- #233 Code fix switching Has.Length to Has.Count for NUnit2022
- #256 NUnit2007 should not fire if both sides are constant
- #257 Need more rules for Classic Model with codefix to transform to Constraint model
- #258 NUnit2023 fires on variables of type Task
Process, documentation, and tooling
NUnit Analyzers 0.3
NUnit Analyzers 0.3 - May 20, 2020
This release of the NUnit Analyzers improves the documentation of all the diagnostics.
Furthermore, we have added the following analyzers and diagnostics:
- an analyzer for proper usage of string constraints,
- an analyzer for proper usage of ContainsConstraint,
- an analyzer for proper usage of Does.Contain and Contains.Item,
- six new diagnostics to handle the full scope of the TestCaseSource attribute.
The release contains contributions from the following users (in alphabetical order):
Issues Resolved
Structure, TestCase, and TestCaseSource
- #204 Extend TestCaseSourceUsesStringAnalyzer to handle all constructors of TestCaseSourceAttribute
- #209 NUnit1001 and NUnit1005 complains about string to integer conversion
- #214 Add diagnostics and tests for all cases of TestCaseSourceUsesStringAnalyzer
- #227 TestCaseSource: Fix codefix for nameof so that it also works when the source is in another class
Assertions
- #219 Add warning when string analyzers are used against non-string actual argument
- #221 Add warning when ContainsConstraint is used against incompatible argument type
- #229 Fix EqualToIncompatibleTypesAnalyzer false positive
- #230 False positive NUnit2020 for Has.None.SameAs
- #235 Fix StringConstraintAnalyzer false positive for delegate/task
- #240 Add SomeItemsIncompatibleTypesAnalyzer
Process, documentation, and tooling
- #201 chore: Bump version to 0.3
- #202 chore: Add nuget badge and update download section
- #205 Document all the analyzers
- #208 Analyzers List: Add icon for "enabled by default"
- #216 refac: Replace Tuples with ValueTuples
- #222 Use nullable reference types
- #225 chore: Add missing documentation files to solution
- #226 Nullable fixes
- #228 Tests fixes
- #234 Improve every text: titles, messages, and descriptions of the analyzers and code-fixes
NUnit Analyzers 0.2
NUnit Analyzers 0.2 - April 13, 2020
This is the initial release of the NUnit Analyzers. The release consists of analyzers
and code fixes for:
- proper usage of the TestCaseAttribute,
- proper usage of ParallelScopeAttribute,
- translation of assertions written in the classic model into the constraint model,
- proper usage of some of the most used assertions (Is.EqualTo, Is.SameAs, Has.Count,
Has.Property(...), Is.Null).
The full list of analyzers can be found at https://github.com/nunit/nunit.analyzers/blob/master/documentation/index.md.
The release contains contributions from the following users (in alphabetical order):
- @304NotModified
- @aolszowka
- @Dreamescaper
- @JasonBock
- @jcurl
- @JohanLarsson
- @MaximRouiller
- @mgyongyosi
- @mikkelbu
- @stevenaw
Issues Resolved
Structure and TestCase
- #1 TestCase analyser doesn't handle nullables
- #7 Feature request: Look for async void tests
- #8 TestCaseUsageAnalyzer throws NullReferenceException for non-existent attribute
- #11 NRE in AnalyzePositionalArgumentsAndParameters
- #14 NRE in AttributeArgumentSyntaxExtensions.CanAssignTo
- #28 NRE when writing an attribute before adding a reference to NUnit
- #41 Only examine TestCaseAttribute if reference to NUnit exists
- #42 Reorder statements for performance reasons
- #48 Async test method must have non-generic Task return type when no result is expected
- #49 Message: Async test method must have Task return type when a result is expected
- #50 Remove false positive from ExpectedResult when used in connection with async tests
- #54 Analyzer for TestCaseAttribute should also work for generic TestCases
- #55 Analyzer for TestCaseAttribute should also work for nullable types
- #56 Analyzer for TestCaseAttribute should work when passed 1 to 3 arguments
- #57 Make conversions work in netcoreapp2.0
- #64 Add an Analyzer to Verify ParallelScope Usage
- #75 Add error if tests/testcases have a return value, but no ExpectedResult
- #76 Add initial class for test method analyzer
- #79 NUNIT_7 does not cater for Task and ValueTask
- #80 Suggestion: Analyzer Should Fix TestCaseSource(string) usage to use nameof()
- #86 Simplify TestCaseUsage
- #92 Analyzer to ensure that the "target" of TestCaseSourceAttribute exists and is static
- #106 Add fixer for the TestCaseSource(StringConstant) analyzer
- #118 Async Tests display warning about missing Expected
- #123 Generalise TestMethodUsageAnalyzer to support custom awaitables
- #148 Analyzer update needed for string->datetime offset conversion in testcaseattribute
- #150 Analyzers and refactorings to use string constraints instead of methods
- #162 NUnit1001: False positive
- #165 AD0001 Crash: TestCase contains int instead of enum
- #169 NUnit1001 False Positive with params in the list
- #186 False error when Uri is parameter and string is argument
- #196 Avoid loading new assemblies into the VS process
Assertions
- #12 NRE in ClassicModelAssertUsageAnalyzer.AnalyzeInvocation
- #13 "Sequence contains no elements" in ClassicModelAssertUsageAnalyzer.AnalyzeInvocation
- #39 Warning if actual type does not match expected type
- #40 Warning if literal or const value is provided as actual value
- #83 NUNIT_7 Throws Unexpectedly On Integer to Decimal Conversions
- #90 Check that checks against null is done on reference types
- #117 Code fix for ConstActualValueUsageAnalyzer
- #124 Warning if IgnoreCase is used for non-string constraint argument
- #128 Add analyzer to capture missing properties
- #129 Warning if actual value is same as expected
- #145 Make analyzers suggesting refactoring to the constraint model default disabled?
- #146 Add analyzer and code fix for Is.EqualTo usage
- #152 Fix CodeFix for logical not expression
- #153 Constraint model suggestion for Assert.AreSame
- #154 Warning when SameAs compares expressions of incompatible types
- #158 Add collection contains analyzer and codefix
- #160 Do not replace line breaks in code fixes
- #163 Feature: Assert.IsNull / Assert.IsNotNull Classic to Fluent
- #168 Add Analyzers for Assert.[Is][Not]Null(expr)
- #174 Introduce ConstraintExpression
- #175 EqualToIncompatibleTypesAnalyzer should not warn if constraint expression has conditional parts
- #178 Fix EqualToIncompatibleTypesAnalyzer boxing false positive
- #179 EqualToIncompatibleTypes should warn if two different enums compared
- #184 Fix Property analyzer for inherited interface
- #187 Fix EqualTo diagnostic when errors present
Process and tooling
- #16 Make the extension work with VS 2017
- #17 Add CI support for master and PRs
- #19 New project format and netstandard for analyzer project
- #21 Remove dependency on NUnit for analyzer project
- #22 Add editorconfig
- #23 Use get-only properties for FixableDiagnosticIds
- #25 Add initial cake script
- #27 Update README.md
- #30 Refine cake configuration
- #32 Update readme
- #33 Add information to CONTRIBUTING.md
- #36 Make Pack work
- #37 Add myget feed to tooling
- #38 Make all cs files conform to editorconfig
- #43 Create nuget package on AppVeyor
- #44 Set package version
- #46 Add badge to MyGet Feed
- #47 Examine concurrent execution af analyzers
- #61 Update Download section
- #63 Make Appveyor run tests before creating nuget package
- #68 Add images to README.md
- #70 Simplify test in this project
- #71 Small cleanup
- #72 Fixing repository url metadata
- #74 Add Installation element
- #84 Partition the analyzers into categories and create identifier ranges for each category
- #85 Give all analyzers unique identifiers
- #87 Simplify TestMethodUsageAnalyzerTests and TestCaseSourceUsesStringAnalyzerTests
- #88 Upload test results to AppVeyor
- #96 Document implemented analyzers and fixers
- #98 Replace tuples with named tuples
- #101 Rewrite tests of CodeFixes with Gu.Roslyn.Asserts
- #102 Remove nunit.analyzers.integrationtests and nunit.analyzers.playground projects
- #103 Transfer ClassicModelAssertUsage tests to Gu.Roslyn.Asserts
- #104 Remove unused methods
- #105 Move test data into code
- #116 Fix licenseUrl element in nuspec, will be deprecated
- #126 Update README and move content to CONTRIBUTING
- #131 Bump versions of nunit, nunit-console, and NUnit3TestAdapter
- #132 Update nunit.analyzers.csproj
- #134 Constraint analyzers have a lot of repeating code
- #135 Pre-release nuget packages should be created with unique assembly versions
- #139 Tests checking documentation
- #140 Add helplinks pointing to analyzer docs
- #141 Improve documentation of analyzers and fixers
- #144 feat: Add motivation and examples for classical assertions
- #182 Remove warning from "Pack"
- #183 fix: Make version numbers consistent
- #185 chore: Bump version
- #192 Add missing information to nuget package
- #194 fix: Replace invalid tokens in suffix