Skip to content

Commit

Permalink
Set up pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Jul 2, 2021
1 parent 263ebc8 commit a7a1f73
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E127,E201,E202,E203,E231,E252,E266,E402,E999,F841,W503,W605
max-line-length = 80
exclude = .git,docs,docsrc,scripts,cmdstanpy_tutorial.py,rtd_change_default_version.py
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
exclude: 'docsrc'
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
# isort should run before black as black sometimes tweaks the isort output
- repo: https://github.com/PyCQA/isort
rev: 5.9.1
hooks:
- id: isort
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 21.6b0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
# local uses the user-installed pylint, this allows dependency checking
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [--rcfile=.pylintrc]
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension-pkg-whitelist=ujson

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
ignore=docsrc/

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
Expand Down
1 change: 1 addition & 0 deletions test/test_generate_quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import unittest

from pandas.testing import assert_frame_equal

from cmdstanpy.cmdstan_args import Method
Expand Down
3 changes: 1 addition & 2 deletions test/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import unittest

from cmdstanpy.cmdstan_args import CmdStanArgs, SamplerArgs
from cmdstanpy.stanfit import RunSet, InferenceMetadata
from cmdstanpy.stanfit import InferenceMetadata, RunSet
from cmdstanpy.utils import EXTENSION, check_sampler_csv


HERE = os.path.dirname(os.path.abspath(__file__))
DATAFILES_PATH = os.path.join(HERE, 'data')

Expand Down
1 change: 0 additions & 1 deletion test/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from time import time

import numpy as np

import pytest
from testfixtures import LogCapture

Expand Down

0 comments on commit a7a1f73

Please sign in to comment.