roshansadath / SOEN6431-SCM-Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compute Software Metrics

roshansadath opened this issue · comments

Refer to #3

Using radon library in python to obtain the Cyclomatic Complexity, Raw Metrics, Maintainability Index and the Halstead Complexity Metrics: Read Radon docs

Cyclomatic Complexity : radon cc -j "./" -O metrics/cc_metrics_R.json
RAW Metrics : radon raw -j "./" -O metrics/raw_metrics_R.json
Maintainability Index : radon mi -j "./" -O metrics/mi_metrics_R.json
Halstead Complexity Metrics : radon hal -j "./" -O metrics/hal_metrics_R.json

PyFlakes for Source Code Error Checking is not a good idea, as it omits the PEP8 style check.
Try Looking into Flake8 instead, which includes all of PyFlakes functionality along with strong PEP8 Style Checking.

We can obtain the Source Code Errors along with the Codes using flake8 Read Flake8 Docs

flake8 --output-file="metrics/flake8_metrics_R.txt" "./"

pyntch library is used to check the possible runtime errors statically. However, it cannot be used in this case as it is only compatible with Python2.x version.

A much more detailed and accurate analysis of the Source Code can be obtained by using PyLint, an open-source Linter for Python. Read PyLint Docs

pylint --recursive=y --output-format=text:"metrics/pylint_metrics_R.txt",colorized "./"

--recursive=y : finds all .py files in the directory and performs checking

We can also obtain the run-time of the candidate R for different configurations, with different input parameters and grids. This can be done using the time library.
We can set the start_time at the beginning of execution and end_time at the moment the training of the DQN model is completed.

The execution format is python pacman.py -p PacmanDQN -n 6000 -x 5000 -l smallGrid
where, the model runs for 6000 episodes out of which 5000 episodes are for training on the smallGrid.

By choosing distinct number of episodes and layouts, we can obtain different execution times of the program.