linfo2335-programming-parad.../project-3/regex
Brieuc Dubois 07597c819e Project 3 2024-05-23 14:47:31 +02:00
..
code Project 3 2024-05-23 14:47:31 +02:00
detect_flaws.py Project 3 2024-05-23 14:47:31 +02:00
flaw_3.py Project 3 2024-05-23 14:47:31 +02:00
flaw_4.py Project 3 2024-05-23 14:47:31 +02:00
flaw_5.py Project 3 2024-05-23 14:47:31 +02:00
flaw_6.py Project 3 2024-05-23 14:47:31 +02:00
hardcodedlist.py Project 3 2024-05-23 14:47:31 +02:00
readme.md Project 3 2024-05-23 14:47:31 +02:00
result.csv Project 3 2024-05-23 14:47:31 +02:00

readme.md

Experience source file for analysing the AST of Python programs using RegEx.

Installation

The Python RegEx module should be include in Python. Use Python 3.7+.

Quick start

Create a new Python file called flaw_1.py. Inside you should import the re module and write your regex checker.
The file should look like this:

import re

def detect_flaw_1(code):
    ...

After creating the regex, add it to the list of regex in the file detect_flaws.py.
To run the code, use python detect_flaws.py. All the result should be in the file result.csv.

Structure

File structure

Keep the structure simple.

code/
flaw_1.py
...
flaw_n.py
detect_flaws.py
readme.md
result.csv

CSV structure

Please keep the structure of the output csv file.

code;flaw_1;flaw_2;...;flaw_n
code1;True;False;...;False
...
coden;False;True;...False

detect_flaws.py structure

You can change this file as you want. But as said before, please keep the same output format in the csv.
The example function detect_hardcoded_list(code) can be changed. The number and the type of the arguments can be changed. You can also write some python code to help you detect the flaws but the main detection should be done by the RegEx.

Result

At the end, please provide all the content of this folder. Even unfinished code will be useful! All the code is anonymous.