Skip to content

Commit 613b074

Browse files
authored
Merge pull request #2 – Add indent and autopep8 infrastructure
#2
2 parents 7a859f4 + 0473e87 commit 613b074

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

.indent.pro

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--blank-lines-after-declarations
2+
--blank-lines-after-procedures
3+
--braces-after-func-def-line
4+
--braces-on-if-line
5+
--braces-on-struct-decl-line
6+
--break-after-boolean-operator
7+
--comment-indentation25
8+
--comment-line-length79
9+
--continue-at-parentheses
10+
--dont-cuddle-do-while
11+
--dont-cuddle-else
12+
--indent-level4
13+
--line-length79
14+
--no-space-after-casts
15+
--no-space-after-function-call-names
16+
--no-space-after-parentheses
17+
--no-tabs
18+
--procnames-start-lines
19+
--space-after-for
20+
--space-after-if
21+
--space-after-while
22+
--swallow-optional-blank-lines
23+
-T PyCFunction
24+
-T PyObject
25+
-T PyMethodDef
26+
-T LDAP
27+
-T LDAPMod
28+
-T LDAPMessage
29+
-T LDAPControl
30+
-T LDAPObject
31+
-T sasl_interact_t

Doc/contributing.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ Specify a different one using, for example::
102102

103103
Notable targets are:
104104

105+
``make autoformat``
106+
Automatically re-formats C and Python code to conform to Python style
107+
guides (`PEP 7`_ and `PEP 8`_).
108+
Note that no backups are made – please commit any other changes before
109+
using this target.
110+
111+
Requires the ``indent`` program and the ``autopep8`` Python module.
112+
113+
.. _PEP 7: https://www.python.org/dev/peps/pep-0007/
114+
.. _PEP 8: https://www.python.org/dev/peps/pep-0008/
115+
105116
``make lcov lcov-open``
106117
Generate and view test coverage for C code.
107118
Requires LCOV_.

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LCOV_REPORT_OPTIONS=--show-details -no-branch-coverage \
55
--title "python-ldap LCOV report"
66
SCAN_REPORT=build/scan_report
77
PYTHON_SUPP=/usr/share/doc/python3-devel/valgrind-python.supp
8+
AUTOPEP8_OPTS=--aggressive
89

910
.NOTPARALLEL:
1011

@@ -13,7 +14,7 @@ all:
1314

1415
.PHONY: clean
1516
clean:
16-
rm -rf build dist *.egg-info $(VENV) .tox MANIFEST
17+
rm -rf build dist *.egg-info .tox MANIFEST
1718
rm -f .coverage .coverage.*
1819
find . \( -name '*.py[co]' -or -name '*.so*' -or -name '*.dylib' \) \
1920
-delete
@@ -77,3 +78,15 @@ valgrind: build $(PYTHON_SUPP)
7778
echo "Found definitive leak, see build/valgrind.log"; \
7879
exit 1; \
7980
fi
81+
82+
# Code autoformatter
83+
.PHONY: autoformat indent autopep8
84+
autoformat: indent autopep8
85+
86+
indent:
87+
indent Modules/*.c Modules/*.h
88+
rm -f Modules/*.c~ Modules/*.h~
89+
90+
autopep8:
91+
$(PYTHON) -m autopep8 -r -i -j0 $(AUTOPEP8_OPTS) \
92+
Demo Lib Tests setup.py

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy