Skip to content

Commit 1746a97

Browse files
committed
Better project structure
1 parent f31f092 commit 1746a97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+220
-188
lines changed

.coveragerc

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1+
[run]
2+
branch = True
3+
timid = True
4+
source =
5+
.
6+
omit =
7+
.tox/*
8+
/usr/*
9+
*/tmp*
10+
setup.py
11+
112
[report]
213
exclude_lines =
3-
# Don't complain about defensive assertions
4-
raise NotImplementedError
5-
raise AssertionError
14+
# Have to re-enable the standard pragma
15+
\#\s*pragma: no cover
616

7-
# Don't complain about non-runnable code
8-
if __name__ == .__main__.:
17+
# Don't complain if tests don't hit defensive assertion code:
18+
^\s*raise AssertionError\b
19+
^\s*raise NotImplementedError\b
20+
^\s*return NotImplemented\b
21+
^\s*raise$
922

10-
omit =
11-
/usr/*
12-
py_env/*
13-
*/__init__.py
23+
# Don't complain if non-runnable code isn't run:
24+
^if __name__ == ['"]__main__['"]:$
1425
15-
# Ignore test coverage
16-
tests/*
26+
[html]
27+
directory = coverage-html
1728
18-
# Don't complain about our pre-commit file
19-
pre-commit.py
29+
# vim:ft=dosini

.gitignore

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
*.pyc
2-
.pydevproject
3-
.pre-commit-files
4-
.project
1+
*.egg-info
2+
*.iml
3+
*.py[co]
4+
.*.sw[a-z]
55
.coverage
6-
/py_env
7-
*.db
86
.idea
9-
build
7+
.pre-commit-files
8+
.project
9+
.pydevproject
10+
.tox
11+
/venv*
12+
coverage-html
1013
dist
11-
*.egg-info
12-
*.iml

.travis.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
language: python
2-
3-
python:
4-
- 2.6
5-
- 2.7
6-
7-
install: pip install virtualenv
8-
script: make coverage
2+
env: # These should match the tox env list
3+
- TOXENV=py26
4+
- TOXENV=py27
5+
install: pip install tox --use-mirrors
6+
script: tox
97

108

9+
# Special snowflake. Our tests depend on making real commits.
1110
before_install:
1211
- git config --global user.name "Travis CI"
1312
- git config --global user.email "user@example.com"

Makefile

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,17 @@
1+
.PHONY: all
2+
all: venv test
13

2-
TEST_TARGETS =
3-
ITEST_TARGETS = -m integration
4-
UTEST_TARGETS = -m "not(integration)"
4+
.PHONY: venv
5+
venv:
6+
tox -e venv
57

6-
DEBUG=
7-
8-
all: _tests
9-
10-
integration:
11-
$(eval TEST_TARGETS := $(ITEST_TARGETS))
12-
13-
unit:
14-
$(eval TEST_TARGETS := $(UTEST_TARGETS))
15-
16-
utests: test
17-
utest: test
8+
.PHONY: tests test
189
tests: test
19-
test: unit _tests
20-
itests: itest
21-
itest: integration _tests
22-
23-
_tests: py_env
24-
bash -c 'source py_env/bin/activate && py.test tests $(TEST_TARGETS) $(DEBUG)'
25-
26-
ucoverage: unit coverage
27-
icoverage: integration coverage
28-
29-
coverage: py_env
30-
bash -c 'source py_env/bin/activate && \
31-
coverage erase && \
32-
coverage run `which py.test` tests $(TEST_TARGETS) && \
33-
coverage report -m'
34-
35-
py_env: requirements.txt setup.py
36-
rm -rf py_env
37-
virtualenv py_env
38-
bash -c 'source py_env/bin/activate && pip install -r requirements.txt'
10+
test:
11+
tox
3912

13+
.PHONY: clean
4014
clean:
41-
rm -rf py_env
15+
find . -iname '*.pyc' | xargs rm -f
16+
rm -rf .tox
17+
rm -rf ./venv-*

UNLICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

example_hooks.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Hooks are set up as follows
32
# - id: hook_id
43
# name: 'Readable name'

example_pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
- repo: git@github.com:pre-commit/pre-commit-hooks
32
sha: cd74dc150c142c3be70b24eaf0b02cae9d235f37
43
hooks:

pre_commit/clientlib/validate_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from __future__ import print_function
32

43
import argparse

pre_commit/clientlib/validate_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
21
import re
32
import sys
43

54
from pre_commit.clientlib.validate_base import get_run_function
65
from pre_commit.clientlib.validate_base import get_validator
76

87

9-
class InvalidConfigError(ValueError): pass
8+
class InvalidConfigError(ValueError):
9+
pass
1010

1111

1212
CONFIG_JSON_SCHEMA = {

pre_commit/clientlib/validate_manifest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
21
import sys
32

43
from pre_commit.clientlib.validate_base import get_run_function
54
from pre_commit.clientlib.validate_base import get_validator
65
from pre_commit.languages.all import all_languages
76

87

9-
class InvalidManifestError(ValueError): pass
8+
class InvalidManifestError(ValueError):
9+
pass
1010

1111

1212
MANIFEST_JSON_SCHEMA = {

0 commit comments

Comments
 (0)