Skip to main content

Clinic Opinionated Codebase Oversight and Analysis

Project description

Clinic Opinionated Codebase Oversight and Analysis

Cocoa Error Analysis

Pre-commit

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 goal 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

This package depends on ruff being available in your environment.

python3 -m pip install dsi-cocoa ruff==0.4.10

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

Options

Results are truncated by default. To print all results, use the verbose option:

cocoa /path/to/repo --verbose

Cocoa evaluates the main branch by default. To evaluate a different branch, use the branch argument:

cocoa /path/to/repo --branch branch-name

To evaluate files created or modified after a certain date, use the date option:

cocoa /path/to/repo --date YYYY-MM-DD

All options can be combined like so:

cocoa /path/to/repo --verbose --branch <branch-name> --date YYYY-MM-DD

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

There is a Github action located here that runs cocoa on pushes to the main branch. The action has an associated badge that can be displayed at the top of your repo to show passing or failing status. The badge code can be copied from the raw text of this readme.

To override the --date or --branch options run in the action, create an environment named "cocoa_standards" in your repository, then create environment variables called BRANCH_NAME and REVIEW_AFTER_DATE.

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.5.9.tar.gz (14.1 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.5.9-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dsi_cocoa-0.5.9.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for dsi_cocoa-0.5.9.tar.gz
Algorithm Hash digest
SHA256 624f60757dc669fae2b1dc52ef50b1536c81e2779e0a5bd7db389164b75f14a5
MD5 4adfc6e49a2c194b7d64ac39e8b84e9c
BLAKE2b-256 05b5b6453d74e549a312095a7019cb8e51de7d362adab88ee2a846ab0be768c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dsi_cocoa-0.5.9-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for dsi_cocoa-0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 50f4bb46b3b53ddd42e854e79740b73b7912f72ee1b9126246d2cc8ba51b01ca
MD5 2b6b9e48e5f9e13d4a4acd5e939ad706
BLAKE2b-256 0908d859da0272b2cd4f7a3b67a568fb43cb403ff99c6a804da485edbc9186c1

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