StaticAnalyzerTool

QA StaticAnalyzerTool project 1
description : tool written in python that reads c++ source code and try to detect Logical Errors such as

  • Unreachable code
  • Magic number
  • Do the attributes
  • more than three parameters

Team members :

  • Mohamad Nasser
  • Yaseen Asaliya
  • Motaz Hashhoush

Working principle:

  • Data reading and Tokens Mohamad Nasser
    read the c++ source code from .txt file and then use tokizing logic
    to give each line a token to his state for example : int x = 5; //will get Declaration token

  • Unreachable code Mohamad Nasser
    the code detect the line that contains return statment
    and then see all possibiltes to this return such as
    alone return without if
    inside if

    also the code can detect the unreachable lines cused by similar nested if stetments 
    
  • Magic number/string Yaseen Asaliya
    the code detect all line that contain number or string such as : if(x == -1)
    return "str"
    ,and it will
    be check the magic value if it not initial value for a variable
    for example or any case that apply the magic number it will be stored
    in result list to print it later.

  • Do the attributes Motaz Hashhoush
    The order of the data type is checked in each prototype function and the order should be like this : integer, string, character .
    It also checks the values that are sent when this function is called so that they must be on the same data type parameters as in the function.
    Example. we have this prototype function bool Check( int status, string name, char startChar)
    and we have the call of this function Check(1.5, 'D', "Data"); the call violates the data type standards in the function .

  • more than three parameters Motaz Hashhoush
    Each function must contain no more than three parameters,
    that's why we check the number of parameters by the number of commas ","
    if the number of commas is equal to two, then this means that we have three parameters,
    and if the number of commas is greater than two, this indicates that we have more than three parameters and it is not permissible .


see distribution of tasks Tasks
see how to run our project Run