Package: ciocheck
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ContinuumIO/ciocheck/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ContinuumIO/ciocheck/?branch=master)[![Code Issues](https://www.quantifiedcode.com/api/v1/project/ccc68df612024e7e8fd386ffe2252a95/badge.svg)](https://www.quantifiedcode.com/app/project/ccc68df612024e7e8fd386ffe2252a95)# ciocheckContinuum Analytics linter, formater and test suite helper.# How does ciocheck work?It leverages on the different available linting, formatting and testing toolsavailbale for Python, including:## Linters- [pep8](https://pep8.readthedocs.io/)  (Style check for code)- [pydocstyle](https://pydocstyle.readthedocs.io/en/latest/)  (Style check for docstrings)- [flake8](http://flake8.readthedocs.io/en/latest/)  (Style check based on [pep8](https://pep8.readthedocs.io/) and [pyflakes](https://github.com/pyflakes/pyflakes))- [pylint](https://pylint.readthedocs.io/)  (Code quality check)## Formaters- [autopep8](https://github.com/hhatto/autopep8)  (Code formater)- [yapf](https://github.com/google/yapf)  (Code formater)- [isort](https://github.com/timothycrosley/isort/)  (Import statements formater)## Test and coverage- [pytest-cov](http://pytest-cov.readthedocs.io/en/latest/)  (Run code [coverage](http://coverage.readthedocs.io/en/latest) with the [pytest](http://pytest.org/latest/) library)Plus some extra goodies, like:- Single file configuration for all the tools (still working on eliminatingredundancy)- Auto addition of `__init__.py` files for folders containing python files- Auto addition of custom encoding and copyright header for python files- Run the tools for staged/unstaged or committed diffs only (git support only)- Run the tools for modified lines, modified files or all files.# Why ciocheck?There are many post commit tools out there for testing code quality, but theidea of ciocheck is to perform checks and autoformating before a commit-push.# Example config fileConfiguration is saved in a single file named `.ciocheck````ini# -----------------------------------------------------------------------------# ciocheck# https://github.com/ContinuumIO/ciocheck# -----------------------------------------------------------------------------[ciocheck]inherit_config = .ciocheckbranch = origin/masterdiff_mode = commitedfile_mode = linescheck = pep8,pydocstyle,flake8,pylint,pyformat,isort,autopep8,yapf,coverage,pytestenforce = pep8,pydocstyle,flake8,pylint,pyformat,isort,autopep8,yapf,coverage,pytest# Python (pyformat)header = # -*- coding: utf-8 -*-copyright_file = '.cioencoding'add_copyright = trueadd_header = trueadd_init = true# -----------------------------------------------------------------------------# pep8# https://pep8.readthedocs.io/en/release-1.7.x/intro.html#configuration# -----------------------------------------------------------------------------[pep8]exclude = */tests/*ignore = E126,max-line-length = 79# -----------------------------------------------------------------------------# pydocstyle# http://www.pydocstyle.org/en/latest/usage.html#example# -----------------------------------------------------------------------------[pydocstyle]add-ignore = D203,inherit = false# -----------------------------------------------------------------------------# Flake 8# http://flake8.readthedocs.io/en/latest/config.html# -----------------------------------------------------------------------------[flake8]exclude = */tests/*ignore = E126,max-line-length = 79max-complexity = 64# -----------------------------------------------------------------------------# pylint# https://pylint.readthedocs.io/en/latest/# -----------------------------------------------------------------------------#[pylint:messages]# -----------------------------------------------------------------------------# isort# https://github.com/timothycrosley/isort/wiki/isort-Settings# -----------------------------------------------------------------------------[isort]from_first = trueimport_heading_stdlib = Standard library importsimport_heading_firstparty = Local importsimport_heading_thirdparty = Third party importsindent = '    'known_first_party = ciocheckknown_third_party = six,pytest,autopep8,yapf,pylintline_length = 79sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER# -----------------------------------------------------------------------------# YAPF# https://github.com/google/yapf#formatting-style# -----------------------------------------------------------------------------[yapf:style]based_on_style = pep8column_limit = 79spaces_before_comment = 2# -----------------------------------------------------------------------------# autopep8# http://pep8.readthedocs.io/en/latest/intro.html#configuration# -----------------------------------------------------------------------------[autopep8]exclude = */tests/*ignore = E126,max-line-length = 99aggressive = 0# -----------------------------------------------------------------------------# Coverage# http://coverage.readthedocs.io/en/latest/config.html# -----------------------------------------------------------------------------[coverage:run]omit =*/tests/*[coverage:report]fail_under = 0show_missing = trueskip_covered = trueexclude_lines =# Have to re-enable the standard pragmapragma: no cover# Ignore local file testingdef test():if __name__ == .__main__.:# -----------------------------------------------------------------------------# pytest# http://doc.pytest.org/en/latest/usage.html# -----------------------------------------------------------------------------[pytest]addopts = -rfew --durations=10python_functions = test_*```# Usage```bashusage: 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} [{pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest} ...]][--enforce {pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest} [{pep8,pydocstyle,flake8,pylint,pyformat,isort,yapf,autopep8,coverage,pytest} ...]][--config CONFIG_FILE]folders [folders ...]Run Continuum Analytics test suite.positional arguments:folder                    Folder to analize. Use from repo root.'optional 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 offiles (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 aresult 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...).```bash$ ciocheck some_module/```