torquemada

Combination code checking tool that integrates Flake8, Black, and others kinds of code tests specific to an example code / course creation environment.

Installation

$ pip install torquemada

Usage

$ torq myprog.py

or

$ torq module

Supports

torquemada has been tested manually with Python 3.9, unittests to be added soon

Command Line Options

torq is a combination style checker and linter for Python scripts. It is used to verify compliance for code displayed in example files or a screencast, with a very particular, very opionated style. The command is built on top of Black and Flake8. Any code tortured by torq is run through Black, then corrected to remove double blank lines, run through Flake8, then run through a series of custom verifications.

Run “torq –actions” for a detailed list of what each action does and in what order.

usage: torq [-h] [--quiet] [--version] [--actions] [--no-black]
            [--no-singlespace] [--no-headercheck] [--no-repltest] [--no-flake]
            filename

Positional Arguments

filename

Name of file or directory to process

Named Arguments

--quiet

Silences messages that are not errors

Default: False

--version

show program’s version number and exit

--actions

Displays information on the actions torq runs

--no-black

Stops the black action from running

Default: False

--no-singlespace

Stops the singlespace action from running

Default: False

--no-headercheck

Stops the headercheck action from running

Default: False

--no-repltest

Stops the repltest action from running

Default: False

--no-flake

Stops the flake action from running

Default: False

Actions

torq runs a series of actions on the file or directory passed in on the command line. Each action can be turned off with a --no-action argument, where action is replaced with the name of the action in lower case. For example, HeaderCheck can be turned off with -no-headercheck.

The following actions are run in this order:

class torquemada.actions.Black

Runs the Black Python code formatter with a line length of 80

class torquemada.actions.SingleSpace

Removes double blank lines on files ending in .py, undoing part of the Black formatting

class torquemada.actions.HeaderCheck

Verifies that .py files start with a comment including the file name

class torquemada.actions.REPLTest

Runs doctest on files ending in .repl

class torquemada.actions.Flake

Runs the Flake8 Python linter

Indices and tables