Giter Site home page Giter Site logo

arcatch-wrong's Introduction

ArCatch

ArCatch is a tool for static-architecture conformance checking of exception handling design. ArCatch aims at enforcing exception handling design decisions in Java projects, providing:

  • A declarative domain-specific language (ArCatch.Rules) for expressing design constraints regarding exception handling; and
  • A design rule checker (ArCatch.Checker) to automatically verify the exception handling conformance.

Furthermore, ArCatch provides support for several kinds of dependence relation concerning the exception handling design, such as raising, re-raising, remapping, signaling, handling, and flow.

ArCatch in 5 steps

  1. Configuration

    ArCatch.config("source code path", "binary code (.jar) path");
  2. Module Declaration

    ModuleElement view = ArCatch.element()
    	.module("View")
    	.matching("banksys.view.\\w+")
    	.build();
    
    ModuleElement control = ArCatch.element()
    	.module("Control")
    	.matching("banksys.control.\\w+")
    	.build();
    
    ModuleElement model = ArCatch.element()
    	.module("Model")
    	.matching("banksys.model.\\w+")
    	.build();
  3. Exception Declaration

    ExceptionElement controlEx = ArCatch.element()
    	.exception("ControlEx")
    	.matching("banksys.control.exception.\\w+")
    	.build();
    
    ExceptionElement modelEx = ArCatch.element()
    	.exception("ModelEx")
    	.matching("banksys.model.exception.\\w+")
    	.build();
  4. Design Rule Especification

    DesignRule r1 = ArCatch.rule()
    	.only(model)
    	.canRaise(modelEx)
    	.build();
    
    DesignRule r2 = ArCatch.rule()
    	.only(model)
    	.canSignal(modelEx)
    	.build();
    
    DesignRule r3 = ArCatch.rule()
    	.module(control)
    	.mustHandle(modelEx)
    	.build();
    
    DesignRule r4 = ArCatch.rule()
    	.module(control)
    	.canOnlySignal(controlEx)
    	.build();
    
    DesignRule r5 = ArCatch.rule()
    	.exception(modelEx)
    	.cannotFlow(model, control, view)
    	.build();
    
    DesignRule r6 = ArCatch.rule()
    	.only(control)
    	.canRemap(modelEx)
    	.to(controlEx)
    	.build();
    
    DesignRule r7 = ArCatch.rule()
    	.module(view)
    	.mustHandle(controlEx)
    	.build();
    
    DesignRule r8 = ArCatch.rule()
    	.module(view)
    	.cannotHandle(modelEx)
    	.build();
  5. Checking Rules

    ArCatch.checker().addRule(r1);
    ...
    ArCatch.checker().addRule(r8);
    
    ArCatch.checker().checkAll();

    OR

    boolean resultR1 = ArCatch.checker().check(r1);
    ...
    boolean resultR7 = ArCatch.checker().check(r8);

Conformance Report

ArCatch.Checker provides a report containing useful information on which design rules have been violated and where such violations take place in the software source code. If ArCatch.checker().checkAll() is used a text-based conformance chacking report is generated at ./report folder. However, if ArCatch.checker().check(rule) is employed, you can access information abou rule violation performing rule.getReport(). In the following we show an example of ArCatch.Checker conformance checking report:

========================================================================================================
ArCatch.Checker Exception Handling Conformance Checking Report
--------------------------------------------------------------------------------------------------------
Label: (V) = Rule Pass | (X) = Rule Fail
========================================================================================================
...
--------------------------------------------------------------------------------------------------------
(X) R2: only (Model) can signal (ModelEx) 8 ms

 -Model module implementation classes:
  -banksys.model.AbstractAccount
  -banksys.model.OrdinaryAccount
  -banksys.model.SavingsAccount
  -banksys.model.SpecialAccount
  -banksys.model.TaxAccount

 -ModelEx exception implementation classes:
  -banksys.model.exception.InsufficientFundsException
  -banksys.model.exception.NegativeAmountException

 -Rule Violations
	-Method [banksys.control.BankController.doDebit(java.lang.String, double)] is signaling the exception [lib.exceptions.InsufficientFundsException]
	-Method [banksys.control.BankController.doDebit(java.lang.String, double)] is signaling the exception [lib.exceptions.NegativeAmountException]
--------------------------------------------------------------------------------------------------------
...

External Dependencies

In ArCatch.Checker, all source code information relevant for the checking process is extracted using:

arcatch-wrong's People

Contributors

lincolnrocha avatar vladymir avatar

Watchers

 avatar

arcatch-wrong's Issues

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.