FIT2107 Assessment #4 (25%) Code Review and Code Quality
—--------—--------—--------—--------—--------—--------
Assessment Overview |
Objective: As a result of this assessment, you will
|
Late Submission and Extension Policy |
Late Submission: Late penalty of 10% per day after the due date, including the weekends. Extensions: No extensions will be given in normal circumstances. An extension may be granted in special circumstances as per the faculty policy (please use this google form). Extensions must be applied online at the following link: https://www.monash.edu/exams/changes/special-consideration. |
—--------—--------—--------—--------—--------—--------
Task 1: CI/CD (2%)
The purpose of CI/CD (Continuous Integration/Continuous Deployment) is to automate and streamline the software development and deployment processes. It is a set of practices that aims to improve the efficiency, reliability, and speed of delivering software applications to end-users. CI/CD involves a combination of tools, automation, and best practices to achieve its goals. CI focuses on merging code changes from multiple developers into a shared repository regularly, typically multiple times a day. Each code change triggers an automated build process, which compiles the code, runs automated tests, and checks for any integration issues. For Task 1, the assessment will focus on setting up the Continuous Integration and Continuous Delivery in GitLab. Please perform the following tasks.
Please set up CI/CD in GitLab to automatically perform static analysis tools
(pycodestyles, pydocstyles, pylint, flakes8, mypy) and automated testing with the
following CI/CD pipeline. Each of the static analysis tools must successfully check
only the megamart.py, but the job is allowed to fail (since all warnings are not fixed
yet). On the other hand, the testing must be passed (successfully executed).
-
Once the CI/CD is setup, it is expected that you may have to create a new branch. The branch name can be anything, up to your choice.
Report Submission:
(1%) Please submit the URL and the screenshot for your CI/CD pipeline. The first commit of the new branch may not be correct, which is acceptable. Please only submit the URL of the pipeline when the testing step is passed, while static analysis tools must generate warnings, but the jobs can be fail. The CI/CD pipeline should be the same as requested.
(1%) What issues did you encounter during setting up the CI/CD, why did that happen, how do you fix them?
Task 2: Code Review Automation via Static Analysis Tools (9%)
Code review is effective, yet often known to be time-consuming and expensive. Thus, static analysis tools play a crucial role in code review automation and have several important purposes, e.g., improving code quality, code readability, detecting bugs, and accelerating code review practices. Assuming that you are a QA expert, you are asked to use static analysis tools, analyse code quality issues, and write a report to submit to the Board of Directors of Monash MegaMart. You must use the following six static analysis tools (i.e., pycodestyles, pydocstyles, lizard, pylint, flakes8, mypy), run them locally on your machine, and write a report to answer the following questions.
4. (6%) For each tool, please analyse all files in the GitLab repository.
-
How many issues/categories are found? Categories refer to the types of the
warnings provided by the tool. For example, https://www.flake8rules.com/, “E101 - Indentation contains mixed spaces and tabs” is an example of the categories.
-
Please present a barchart (Y=Categories, X=#Issues Found) for each tool and analyse the distribution of the categories discovered.
c. In the report, please focus on the megamart.py only.
i. In the megamart.py, please report only the top-10 most common
unique categories (i.e., only the top 10 categories across the tools that
you have found). If you find more than 10 categories, please feel free
to limit the report to the top-10 categories. However, for those who
have already completed this part of the report, feel free to submit what
you have done and we will consider your effort during the marking.
ii. If the categories are duplicated with other static analysis tools, you
can report only once (Updated 11 October 2023).
iii. For each category,
-
What is it? Why?
-
What is the previous code?
-
How do you fix them?
-
The previous and the fixed code should be presented in a code
diff format.
5. (1%) Please create a Comparison Summary Table.
Aspects/Tools |
pycodestyl es |
pydocstyl es |
pylint |
pyflakes |
mypy |
lizard |
Total Issues found across all files in the entire repository |
||||||
Score (if any) |
||||||
# Issues found for the |
megamart.py |
||||||
# Fixed Issues for the megamart.py |
||||||
# Remaining Issues Unfixed |
6. (2%) Based on the entire repository provided, write a conclusion to advise the MegaMart board of Directors about the following:
-
Which files and which functions have the highest number of code quality issues? What are the most common issues of that file and that function ?
-
Which files and which functions are most complex (in terms of cyclomatic
complexity)?
- The raw warnings/logs from the tools should be included in the Appendix only
Task 3: Bug Fixing and Merge Request (14%)
Once all of the issues are discovered, please do your best to fix them all until they are resolved. Once all issues are resolved locally, please perform the following steps:
(2%) Create a merge request to propose an improved version of the megamart.py. That means the CI/CD pipeline should focus on the megamart.py, not all files in the repo. Please submit the URL and the screenshot of the merge request. The merge request must include the title and the description, and must be informative. See Week 9 slides for an example of informative merge requests
<screenshot>
(12%) Check the status of the CI/CD pipeline for megamart.py. Please submit the URL and the screenshot of the CI/CD pipeline of the improved version.
<screenshot>
-
● If all issues are resolved, we expect that all stages of the CI/CD pipeline are passed (green).
-
● The improved megamart.py must be originally from the original megamart.py. That means we are able to view the code diff (all changed lines are traceable).