Giter Site home page Giter Site logo

charygao / exceptionalresharper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csharpanalyzers/exceptionalresharper

0.0 2.0 0.0 6.16 MB

Extension for ReSharper which analyzes thrown and documented C# exceptions and suggests improvements

License: Microsoft Public License

Batchfile 0.18% C# 99.82%

exceptionalresharper's Introduction

Exceptional for ReSharper

Exceptional is an extension for ReSharper which analyzes thrown and documented C# exceptions and suggests improvements.

Motivation

When working with a code base - whether it is a small one or a big one - developers constantly encounter issues caused by wrong exception handling. There may be an excellent exception handling policy, but it is the developer who must execute this policy on its own code. Even with no policy defined, there are good practices on how to properly handle exceptions. This extension allows you to seamlessly apply these good practices with a couple of key strokes.

Generally, the public API should be documented and thrown exceptions should be part of this documentation. But even if documenting thrown exceptions is pretty easy, the maintenance of the code that is using a particular method or property is not. This is where this extension comes into play: The extension analyzes call sites and provides hints on exceptions thrown from that invocations. If an exception is either not caught or not documented then you will be proposed to fix this problem. The extension also checks other good practices, for example that an inner exception is provided when rethrowing a new exception.

Installation

Requires ReSharper v8.2, v9, v10 or later

  • Open the ReSharper menu in Visual Studio and select Extension Manager...
  • Search for Exceptional and install the extension

Open the menu ReSharper / Options... / Exceptional to configure the extension.

Check out the extension in the ReSharper plugin gallery (targets the latest R# version):

Old versions:

Features

Thrown exception not documented or caught

Warning: Exceptions thrown outside the scope of method\property that are not documented in methods xml documentation (thrown with use of throw keyword).

Fix: Document or catch thrown exception.

Warning: Exception thrown outside the scope of method\property that are not documented in methods xml documentation (thrown from another invocation).

Fix: Document or catch thrown exception.

Documented exception is not thrown

Warning: Exceptions documented in XML documentation that are not thrown from method/property.

Fix: Remove documentation of not thrown exception.

Catch-all clauses

Warning: General catch-all clauses should be avoided.

Not passing inner exception

Warning: Throwing new exception from catch clause should include message and inner exception.

Do not throw System.Exception

Warning: Throwing System.Exception should be avoided.

More features to come...

(This project has originally been hosted on CodePlex)

exceptionalresharper's People

Contributors

ricosuter avatar yazgoo avatar pedromagueija avatar nunofilipecosta avatar olsh avatar minibrain avatar cadbloke avatar

Watchers

高亚斌 avatar  avatar

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.