Clinic Opinionated Codebase Oversight and Analysis
Project description
Clinic Opinionated Codebase Oversight and Analysis
This repository was developed in order to generate automated reports on how well codebases adhere to the coding standards of the University of Chicago's DSI Clinic course.
The goals of this codebase is to provide a quick and easy way to review code and to alert contributors where their code may be failing.
Installation
pip install dsi-cocoa
To install the package from the local files, run the following command from the root of the repository:
python3 -m pip install .
cocoa
This package contains a module evaluate_repo which runs code testing libraries against a repository. There are multiple ways that we want to be able to run this repo:
- We want to be able to clone
cocoaand then use it as part of their process. - We want administrators to be able to give it a list of repos to generate reports on all repos.
- (Eventually) We want it to be able to run as a github action on the repo itself.
- (Eventually) We want to be able to have adminstrative repo that can run it on other repos.
How to run
Via command line:
cocoa /path/to/repo
As a python script:
python3 src/cocoa/evaluate_repo.py /path/to/repo
As a Python module:
from cocoa.evaluate_repo import evaluate_repo
evaluate_repo('/path/to/repo', False)
A few important notes:
- Make sure to
git pullbefore running this code. - This will get branch information for all branches.
- This will only run the analysis (
pyflakeson python files) for the code in the current branch. So if you run this while your current branch ismainit will run onmain.
Options
If you want to do linting on Python files, then you can add the argument "--lint" to the command:
cocoa /path/to/repo --lint
Results are truncated by default. To print all results, use the verbose option:
cocoa /path/to/repo --verbose
Checks
The code run multiple checks on each repo. For each check run there are three possibilities:
- WARNING: Most likely this needs to be fixed.
- INFO: Log information for additional context.
- ERROR: A critical issue that needs to be addressed.
For each of the checks below we have denoted what the check generates.
- Branch Hygiene:
- [WARNING] Branch names
- [INFO] Commit information for live branches.
- File Hygiene:
- [ERROR] Unnecessary and cache file (such as .DS_Store or pycache files)
- Notebook Files (*.ipynb):
- [ERROR] Cells per notebook < 10, lines per cell < 15 and 0 functions defined
- [ERROR] Linting: PyLint, Black, Flake and iSort
- Python Files
- [ERROR] All Code in Functions
- [ERROR] All functions have docstrings
- [ERROR] Code uses off-limit libraries (subprocess)
- [ERROR] Linting: PyLint, Black, Flake and iSort
Github actions
For each of the ERRORS and WARNINGS above there is an associated github action that can be run to create a badge which we put in a table at the top of each clinic repo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dsi_cocoa-0.1.1.tar.gz.
File metadata
- Download URL: dsi_cocoa-0.1.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b07c9bad82ad619971db7aba8891ab4817db84d43dbc97a23d9693000d4c2e3
|
|
| MD5 |
08c22f895092371bf75c4787fea1e728
|
|
| BLAKE2b-256 |
65dce84dc027bdc24a758fdef7887111c39c83db11d0c9fb86474a6f562c75c0
|
File details
Details for the file dsi_cocoa-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dsi_cocoa-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63b11d41980542bbc19d66a15908103fabb09decb1ccf6acb351055990f3b39
|
|
| MD5 |
22856bf2ef6fe2fa1fe0ffe1f0ffdc1e
|
|
| BLAKE2b-256 |
71040079c8ede2797abcbc415ddf4b59b09812444797b7fe8c0e26326da5bf10
|