Skip to content

Commit 7f735f8

Browse files
committed
new: added pre-commit hooks and install script
1 parent fd98e87 commit 7f735f8

File tree

5 files changed

+197
-6
lines changed

5 files changed

+197
-6
lines changed

.gitignore

+139-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,146 @@
1-
*.pyc
2-
venv/
3-
4-
# build output from 'python setup.py install'
5-
build/
6-
71
# Generated files
82
filters/sample_*
93
def/AUTOGEN.net
104
tests/characterization_data/filters_actual
115
tools/new_lint_errors.txt
126

137

8+
# Recommended python excludes
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class
13+
14+
# C extensions
15+
*.so
16+
17+
# Distribution / packaging
18+
.Python
19+
build/
20+
develop-eggs/
21+
dist/
22+
downloads/
23+
eggs/
24+
.eggs/
25+
lib/
26+
lib64/
27+
parts/
28+
sdist/
29+
var/
30+
wheels/
31+
share/python-wheels/
32+
*.egg-info/
33+
.installed.cfg
34+
*.egg
35+
MANIFEST
36+
37+
# PyInstaller
38+
# Usually these files are written by a python script from a template
39+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40+
*.manifest
41+
*.spec
42+
43+
# Installer logs
44+
pip-log.txt
45+
pip-delete-this-directory.txt
46+
47+
# Unit test / coverage reports
48+
htmlcov/
49+
.tox/
50+
.nox/
51+
.coverage
52+
.coverage.*
53+
.cache
54+
nosetests.xml
55+
coverage.xml
56+
*.cover
57+
*.py,cover
58+
.hypothesis/
59+
.pytest_cache/
60+
cover/
61+
62+
# Translations
63+
*.mo
64+
*.pot
65+
66+
# Django stuff:
67+
*.log
68+
local_settings.py
69+
db.sqlite3
70+
db.sqlite3-journal
71+
72+
# Flask stuff:
73+
instance/
74+
.webassets-cache
75+
76+
# Scrapy stuff:
77+
.scrapy
78+
79+
# Sphinx documentation
80+
docs/_build/
81+
82+
# PyBuilder
83+
.pybuilder/
84+
target/
85+
86+
# Jupyter Notebook
87+
.ipynb_checkpoints
88+
89+
# IPython
90+
profile_default/
91+
ipython_config.py
92+
93+
# pyenv
94+
# For a library or package, you might want to ignore these files since the code is
95+
# intended to run in multiple environments; otherwise, check them in:
96+
# .python-version
97+
98+
# pipenv
99+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
101+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
102+
# install all needed dependencies.
103+
#Pipfile.lock
104+
105+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
106+
__pypackages__/
107+
108+
# Celery stuff
109+
celerybeat-schedule
110+
celerybeat.pid
111+
112+
# SageMath parsed files
113+
*.sage.py
114+
115+
# Environments
116+
.env
117+
.venv
118+
env/
119+
venv/
120+
ENV/
121+
env.bak/
122+
venv.bak/
123+
124+
# Spyder project settings
125+
.spyderproject
126+
.spyproject
127+
128+
# Rope project settings
129+
.ropeproject
130+
131+
# mkdocs documentation
132+
/site
133+
134+
# mypy
135+
.mypy_cache/
136+
.dmypy.json
137+
dmypy.json
138+
139+
# Pyre type checker
140+
.pyre/
141+
142+
# pytype static type analyzer
143+
.pytype/
144+
145+
# Cython debug symbols
146+
cython_debug/

.pre-commit-config.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://gitlab.com/pycqa/flake8
3+
rev: '3.8.3'
4+
hooks:
5+
- id: flake8
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v3.1.0
8+
hooks:
9+
- id: check-executables-have-shebangs
10+
- id: debug-statements
11+
- id: detect-private-key
12+
- id: end-of-file-fixer
13+
- id: requirements-txt-fixer
14+
- id: trailing-whitespace

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33

44
Capirca is a tool designed to utilize common definitions of networks, services and high-level policy files to facilitate the development and manipulation of network access control lists (ACLs) for various platforms. It was developed by Google for internal use, and is now open source.
55

6+
To install the dev environment in machines that support bash files, run the `dev-install` script provided.
7+
8+
```bash
9+
$ dev-install
10+
```
11+
612
## Community
713
Capirca has a channel on the [NetworkToCode slack](https://networktocode.slack.com/).

dev-install

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
pip install -e .
4+
pip install pre-commit
5+
# Install the pre-commit hooks as well
6+
pre-commit install

setup.cfg

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
.github,
5+
__pycache__,
6+
dist,
7+
build,
8+
debian,
9+
*.egg,
10+
*.egg-info,
11+
*.venv,
12+
*.archive,
13+
def,
14+
policies,
15+
doc
16+
max-line-length = 100
17+
max-complexity = 10
18+
filename = *.py
19+
ignore =
20+
E111,
21+
E114,
22+
E121,
23+
E731,
24+
C901,
25+
F821
26+
27+
28+
[tool:pytest]
29+
markers =
30+
unit: Marks a unit test
31+
sanity: Marks a sanity test
32+
testpaths = tests

0 commit comments

Comments
 (0)