Giter Site home page Giter Site logo

exceptionalstatistics's Introduction

ExceptionalStatistics

Using Roslyn to gather statistics on bad exception handling - i.e. empty "catch-all" blocks.

Getting Started

Install the ExceptionalStatistics tool from NuGet - that's it.

Prerequisites

The ExceptionalStatistics tool targets .NET 7.

Usage

You can look for bad exceptional handlers by either providing the location of a solution file:

ExceptionalStatistics --sln "C:\MyDirectory\MySolutionFile.sln"

Or, you give a directory as the starting point - ExceptionalStatistics will enumerate all files within that directory and subdirectories for C# files:

ExceptionalStatistics --dir "C:\MyDirectory"

In either case, you should see output something like this:

Total number of files: 12704
Number of statements: 903409
Number of expressions: 3900845
Number of bad catch blocks: 43
Number of empty catch blocks with filters: 64

Bad Catch Clauses

        File: M:\repos\roslyn2\src\VisualStudio\Core\Def\EditAndContinue\EditAndContinueFeedbackDiagnosticFileProvider.cs
                Microsoft.VisualStudio.LanguageServices.EditAndContinue.EditAndContinueFeedbackDiagnosticFileProvider.OnFeedbackSemaphoreDeleted()
                Start line location: 134
                End line location: 134
        File: M:\repos\roslyn2\src\Workspaces\Remote\Core\BrokeredServiceConnection.cs
                Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection.OnUnexpectedException()
                Start line location: 410
                End line location: 410

Feedback

If you run into any issues, please add them here.

exceptionalstatistics's People

Contributors

jasonbock avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

exceptionalstatistics's Issues

Project and Solution Updates

Tasks:

  • Add Directory.Packages.props
  • Update settings in Directory.Build.props, like AnalysisMode, Copyright, TargetFramework, and Version
  • Fix any warnings and errors
  • Update README.md to be more informative
  • Add CHANGELOG.md (and remember to add different sections, see Rocks)
  • Create a NuGet package on build
  • Use raw string literals now
  • Why is File nullable in StatisticsGatherer?
  • Get the directory from the command line
  • Have Statistics implement IAdditionOperators
  • Maybe use MSBuildWorkspace to parse solution/project. Just default to that.
  • Add an icon
  • Release 1.0.0 and tag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.