Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable additional static analysis analyzers #27

Open
CBielstein opened this issue Jul 12, 2020 · 3 comments
Open

Enable additional static analysis analyzers #27

CBielstein opened this issue Jul 12, 2020 · 3 comments
Assignees
Labels
code cleanliness Refactors, static analysis, etc.

Comments

@CBielstein
Copy link
Owner

  • Microsoft.CodeAnalysis.FxCopAnalyzers
  • IDisposableAnalyzers
@CBielstein
Copy link
Owner Author

As pointed out in a PR comment here: #19 (comment)

CBielstein added a commit that referenced this issue Oct 26, 2020
## Description

Adds a new static analyzer in the form of [IDisposableAnalyzers](https://www.nuget.org/packages/IDisposableAnalyzers/). The new analyzer immediately caught a violation where the project was not properly disposing a system-level resource, so this change also cleans that up. This is part of #27.

## Changes

* Add IDisposableAnalyzers to the common packages imported by all projects
* Fix violations of the new analyzer

## Verification

* Build passes locally
@CBielstein
Copy link
Owner Author

Maybe investigate others here: https://github.com/dotnet/roslyn-analyzers. I know I've also seen things like IDE0044 being highlighted in vscode, it'd be great to surface some of those in the build.

CBielstein added a commit that referenced this issue Dec 15, 2020
## Description

This is the first of several changes to incrementally enable FxCopAnalyzers in this repository. FxCopAnalyzers allows us to increase code quality of existing code and ensure code quality of new code. Since there are many FxCop violations in this repository, I'm breaking up the large change in to several smaller changes based on project. I will add FxCopAnalyzers to our project Packages.props once the package is enabled everywhere.

This is part of #27 

## Changes

* Adds FxCopAnalyzers to KissTnc and KissTncUnitTests projects
* Fixes FxCop violations in those projects

## Validation

* `dotnet build -c Release` is successful (no violations) on my machine
* Tests are running successfully
CBielstein added a commit that referenced this issue Dec 29, 2020
## Description

Follow up to #54 as work on #27. This enables FxCopAnalyzers in `src/AprsParser` directory.

## Changes

* Disables CA1805:DoNotInitializeUnnecessarily, which disallows initializing a variable to a default value, as I believe it goes against self-documenting code
* Reverts a few lines in `src/KissTnc` that were modified for CA1805
* Enables FxCop in AprsParser project by adding the nuget package to the project
* Fixes violations in `src/AprsParser`
* Updates AprsParserUnitTests as required

## Validation

* `dotnet build -c Release` at root succeeds
* All tests are passing
* Console app successfully receives packets from APRS-IS
@CBielstein CBielstein self-assigned this Mar 3, 2021
CBielstein added a commit that referenced this issue Mar 9, 2021
## Description

Follows up on #60 to enable FxCop in the AprsParserUnitTests. Part of #27.

## Changes

* Enables FxCop in the AprsParserUnitTests project
* Switches test methods to reuse code with inline data
* Renamed PacketUnitTests.cs to PacketInformationFieldUnitTests.cs to segment from future tests and keep test file sizes lower
* Added some more specific skip messages in a few test methods linking to new issues in GitHub
* Fixed one bug in decoding a comment on a maidenhead packet that was revealed while refactoring tests
* Other fixes

## Validation

* Build passes (`dotnet build -c Release` at the root)
* Tests pass (`dotnet test` at the root)
@CBielstein
Copy link
Owner Author

As per conversation here: dotnet/roslyn#33558 and here https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#enable-on-build, enabling more analyzers on the build (such as the IDExxxx error codes) requires .NET 5 or higher. This is similar to #81, which would also require a newer .NET version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanliness Refactors, static analysis, etc.
Projects
None yet
Development

No branches or pull requests

1 participant