Giter Site home page Giter Site logo

databasecritics's Introduction

Database Critics Browser

Installation

DCB is integrated to Myrddin but can also be used in standalone mode.

Install in standalone mode

Metacello new
    baseline: 'DatabaseCritics';
    repository: 'github://juliendelplanque/DatabaseCritics/repository';
    load: 'UI-standalone'.

Use this project as a dependency

To use this project as a dependency of your project, simply add the following code snippet to you Configuration/Baseline:

spec baseline: 'DatabaseCritics' with: [
    spec repository: 'github://juliendelplanque/DatabaseCritics/repository' ].

How to use this project

This section explains you how to check a famix model programatically using this framework. The generation of the model is not the responsability of this tool. So in the following explanations, we will assume that you generated a Famix-SQL model and the variable model holds it.

Do a critic (Famix-SQL model checking)

The following code checks the model with all rules defined in the image:

"Create the model checker."
mc := DCModelChecker withAllRulesButThresholdsOn: model.

"Run rules on the entities."
mc checkEntities.

It is possible to choose the rules to apply on the model using a block:

"Create the model checker with rules that can be applied
on FAMIXTable entities only."
mc := DCModelChecker
	on: model
	withRulesSatisfying: [ :rule | rule acceptEntityClass: FAMIXTable ].

Another way to create a model checker is to specify the rules to use explicitly:

mc := DCModelChecker
	on: model
	withRules: { DCMissingPrimaryKey new . DCUnusedPrimaryKey new }.

There are other messages defined in DCModelChecker class to instantiate it.

Once the model checker has been built, it is ready to run the rules on the model. To do that simple use #checkEntities message:

mc checkEntities.

After this message has been performed, the rules held by the model checker hold entities of the model that are violating them. You can access these rules using rules message:

mc rules.

Classify the results of a critic

Once model's entities have been checked, it is possible to classify them as a tree using, eventually, multiple level of classification.

The classification method are defined as subclasses of DCRuleClassification class. For example, if rules have to be classified according to their criticity, the following code would do the job:

classification := DCSeverityClassification rules: mc rules.

Once the classification has been created, you can access the root of the tree build using root message:

classification root.

The object returned by the preceding expression is a DCRoot object, subclass of DCGroup object. These object are useful for results exportation which is detailed later in this document.

Mark an entity as a false positive for a rule

Let rule be the rule holding entities (i.e. the model checker has already run this rule on the model) and entity be the entity that should be marked as a false positive. The following code mark the entity entity as a false positive for the rule rule:

rule addFalsePositive: entity.

From the moment this expressionha been performed, the entity will not appear in the result of DCRule>>entitiesViolatingTheRuleWithoutFalsePositives.

databasecritics's People

Contributors

juliendelplanque avatar

Watchers

 avatar  avatar  avatar

databasecritics'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.