Restrcitor

What is Restrictor?

The Restrictor CLI tool allows the user to restrict the use of certain criterion or many criteria in a source file, the restriction follows one of three types of restrition explained below.

Types of Restriction:

How does a single criterion restriction work?

Each criterion has a unique character to use with the command, the characters are explained below, the output of the commands is True (following restriction) or False (not following restriction):

Example Commands:

How does many criteria restriction work?

Many Criteria Command:

restrict r source.cpp rules.YAML -Returns the number of missing functions/classes following by the number of extra functions/classes.

Output Options

This command includes an output option -o, the output option is follow by n (number of missing and extra functions) which is the default value or v (verbose, a list of violations with a simple explanation) both n and v are not case sensitive, an example command including v:

restrict r source.cpp rules.YAML -o v -Returns a list of violations with minor explanation.

Restriction File Structure:

The restrictions file is a YAML file type, this file is required for the functionality of the many criteria command.

Restrictions File Example

You can find the sample file in the GitHub files or below:

libraries:
  restriction: at_least
  scope: global
  names:
    - algorithm
    - iostream

keywords:
  restriction: exactly
  scope: int functionC(int, int)
  names:
    - functionC

classes:
  restriction: exactly
  scope: global
  names:
    - class test
    - class Aclass

functions:
  restriction: exactly
  scope: global
  names:
    - int functionA(int, int)
    - template <typename T> int functionD(T)
    - int * functionE(int, int)
    - int ** functionF(int, int)
    - int functionJ(int &)
    - int functionK(int *)

private_functions:
  restriction: exactly
  scope: global
  names:
    - int test::functionG(int, int) const
    - virtual void test::functionH()
    - static int test::functionI(int, int)

Error Scenarios: