This repository contains the solution to Homework 2, which focuses on debugging, static analysis, and test-driven development.
The main objectives are:
- Executing static analysis tools and auto-formatting on the provided code.
- Debugging and fixing the
mergeSort
implementation inhw2_debugging.py
. - Writing and running test cases using
pytest
. - Automating static analysis and tests with continuous integration.
- Download
hw2.zip
and unzip it to access the code files.
- Run AutoPep8 to auto-format the Python code.
- Use two static analysis tools (e.g., pylint, pyflake, pyright, Autopep8, Bandit, Radon)
- The file
hw2_debugging.py
contains an implementation of the mergeSort algorithm, which relies on helper methods located inrand.py
. - The current implementation is failing. Analyze the code, fix any issues based on the static analysis recommendations, and ensure the
mergeSort
function works as expected.
- After making code changes, re-run the static analysis tools to confirm no issues remain.
- Save the output (trace files) from the static analysis tools in a folder called
post_traces
.
- Once the
mergeSort
implementation is fixed and the code passes all checks:- Commit your fixed version of
hw2_debugging.py
to your repository. - You can choose to commit it to your existing HW1 repository or create a separate HW2 repository.
- Commit your fixed version of
- Write three test cases to verify the correctness of your
mergeSort
implementation. - The tests should be executable using pytest.
- Configure AutoPep8 and the two static analysis tools to run on every commit in your HW2 repository.
- Add badges to your repository for each of the static analysis tools.
- Configure your new
merge_sort
tests to run on every commit, ensuring that no regression can occur without a test failing.
- Submit a PDF document containing the static analysis traces and a link to your HW2 repository to Moodle.
HW2/
│
├── hw2_debugging.py # The main file containing the mergeSort implementation
├── rand.py # Helper methods used in mergeSort
├── post_traces/ # Folder containing the traces after re-running the static analysis tools
│ ├── pylint_trace.txt
│ ├── Bandit_trace.txt
│ └── ...
├── tests/ # Folder containing test cases for mergeSort
│ ├── test_merge_sort.py
│ └── ...
└── README.md
└── LICENSE.txt
For any questions or issues regarding this assignment, feel free to reach out:
- Email: pemacnic@ncsu.edu
- Email: dguda@ncsu.edu
- Email: aghosh7@ncsu.edu