Skip to main content

Clinic Opinionated Codebase Oversight and Analysis

Project description

update readme for testing

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:

  1. We want to be able to clone cocoa and then use it as part of their process.
  2. We want administrators to be able to give it a list of repos to generate reports on all repos.
  3. (Eventually) We want it to be able to run as a github action on the repo itself.
  4. (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:

  1. Make sure to git pull before running this code.
  2. This will get branch information for all branches.
  3. This will only run the analysis (pyflakes on python files) for the code in the current branch. So if you run this while your current branch is main it will run on main.

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:

  1. WARNING: Most likely this needs to be fixed.
  2. INFO: Log information for additional context.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsi_cocoa-0.3.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsi_cocoa-0.3.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file dsi_cocoa-0.3.0.tar.gz.

File metadata

  • Download URL: dsi_cocoa-0.3.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dsi_cocoa-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e11720ee86f632f0902e3b75609ec2d347e10c895b3bfc43846408a7a55f918
MD5 b68d2e50d1eab52e1597c7edfe50e65e
BLAKE2b-256 7fd480612720fb982376f8bc87952d5a112a1acc47b8fde3f0e85c41d566f966

See more details on using hashes here.

File details

Details for the file dsi_cocoa-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dsi_cocoa-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for dsi_cocoa-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e98e4d93ad0e69ec9c7b555c52aad80065f767fd924444ca7ab918835c9a5136
MD5 d7e7f8c558e570027339211a72fcfc7e
BLAKE2b-256 10d1be41d118ce9974cc72c5038e43c5c008fa2ab354453fcf21aab8d2ac8cf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page