ContinuumIO/ciocheck

Name: ciocheck

Owner: Continuum Analytics, Inc.

Description: Continuum Analytics linter, formatter and test suite helper.

Created: 2016-05-25 13:00:46.0

Updated: 2017-11-21 21:45:10.0

Pushed: 2017-12-26 17:38:23.0

Homepage:

Size: 142

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Ciocheck

Build Status

Build Status Build status CircleCI Coverage Status Code Issues Scrutinizer Code Quality

Description

Continuum Analytics linter, formatter and test suite helper.

How does ciocheck work?

It leverages on the different available linting, formatting and testing tools availbale for Python (but other languages could also be added), including:

Linters
Formatters
Test and coverage

Plus some extra goodies, like:

Why ciocheck?

There are many post commit tools out there for testing code quality, but the idea of ciocheck is to perform checks and autoformating before a commit-push, and to use it as part of the CI system, so that if any of the enforced checks does not comply, CI will fail.

Example config file

Configuration is saved in a single file named .ciocheck

---------------------------------------------------------------------------
ocheck
tps://github.com/ContinuumIO/ciocheck
---------------------------------------------------------------------------
check]
rit_config = .ciocheck
ch = origin/master
_mode = commited
_mode = lines
k = pep8,pydocstyle,flake8,pylint,pyformat,isort,autopep8,yapf,coverage,pytest
rce = pep8,pydocstyle,flake8,pylint,pyformat,isort,autopep8,yapf,coverage,pytest

thon (pyformat)
er = # -*- coding: utf-8 -*-
right_file = .ciocopyright
copyright = true
header = true
init = true

---------------------------------------------------------------------------
p8
tps://pep8.readthedocs.io/en/release-1.7.x/intro.html#configuration
---------------------------------------------------------------------------
8]
ude = */tests/*
re = E126,
line-length = 79

---------------------------------------------------------------------------
docstyle
tp://www.pydocstyle.org/en/latest/usage.html#example
---------------------------------------------------------------------------
ocstyle]
ignore = D203,
rit = false

---------------------------------------------------------------------------
ake 8
tps://flake8.readthedocs.io/en/latest/user/configuration.html
---------------------------------------------------------------------------
ke8]
ude = */tests/*
re = E126,
line-length = 79
complexity = 64

---------------------------------------------------------------------------
lint
tps://pylint.readthedocs.io/en/latest/
---------------------------------------------------------------------------
lint:messages]

---------------------------------------------------------------------------
ort
tps://github.com/timothycrosley/isort/wiki/isort-Settings
---------------------------------------------------------------------------
rt]
_first = true
rt_heading_stdlib = Standard library imports
rt_heading_firstparty = Local imports
rt_heading_thirdparty = Third party imports
nt = '    '
n_first_party = ciocheck
n_third_party = six,pytest,autopep8,yapf,pylint
_length = 79
ions = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

---------------------------------------------------------------------------
PF
tps://github.com/google/yapf#formatting-style
---------------------------------------------------------------------------
f:style]
d_on_style = pep8
mn_limit = 79
es_before_comment = 2

---------------------------------------------------------------------------
topep8
tps://pep8.readthedocs.io/en/latest/intro.html#configuration
---------------------------------------------------------------------------
opep8]
ude = */tests/*
re = E126,
line-length = 99
essive = 0

---------------------------------------------------------------------------
verage
tps://coverage.readthedocs.io/en/latest/config.html
---------------------------------------------------------------------------
erage:run]
 =
*/tests/*

erage:report]
_under = 0
_missing = true
_covered = true
ude_lines =
pragma: no cover
def test():
if __name__ == .__main__.:

---------------------------------------------------------------------------
test
tp://doc.pytest.org/en/latest/usage.html
---------------------------------------------------------------------------
est]
pts = -rfew --durations=10
on_functions = test_*
Usage
e: ciocheck [-h] [--disable-formatters] [--disable-linters]
            [--disable-tests] [--file-mode {lines,files,all}]
            [--diff-mode {commited,staged,unstaged}] [--branch BRANCH]
            [--check {pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest}
            [--enforce {pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest}
            [--config CONFIG_FILE]
            folders [folders ...]

Continuum Analytics test suite.

tional arguments:
lder                     Folder to analize. Use from repo root.'

onal arguments:
help, -h                 Show this help message and exit

disable-formatters, -df  Skip all configured formatters

disable-linters, -dl     Skip all configured linters

disable-tests, -dt       Skip running tests

file-mode, -fm           {lines,files,all}
                         Define if the tool should run on modified lines of
                         files (default), modified files or all files

diff-mode, -dm           {commited,staged,unstaged}
                         Define diff mode. Default mode is commited.

branch, -b BRANCH        Define branch to compare to. Default branch is
                         "origin/master"

check, -c                {pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest}
                         Select tools to run. Default is "pep8"

enforce, -e              {pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest}
                         Select tools to enforce. Enforced tools will fail if a
                         result is obtained. Default is none.

config, -cf CONFIG_FILE  Select a config file to use. Default is none.

Check format of imports only in some_module.

Use ciocheck from the root of the git repo (for now…).

ocheck some_module/
Installation
nda install ciocheck -c conda-forge
For development
nda install ciocheck -c conda-forge
thon setup.py develop

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.