mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 03:40:14 +00:00
make tox env for code-checks
This executes: check-debugging, check-interfaces, check-miscaptures, find-trailing-spaces, check-umids, pyflakes. Other changes: * fix check-umids.py to take starting points. run it as `check-umids.py src` instead of `check-umids.py src/allmydata/*.py` * check-debugging: rewrite in python to run from tox: tox doesn't like to run shell scripts. * put check-interfaces.py last: it produces lots of warnings, but passes anyways. The others only produce significant output if they fail.
This commit is contained in:
parent
d641aef2a3
commit
36c57c74f4
9
Makefile
9
Makefile
@ -66,11 +66,15 @@ smoketest:
|
|||||||
|
|
||||||
.PHONY: code-checks
|
.PHONY: code-checks
|
||||||
#code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
|
#code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
|
||||||
code-checks: check-debugging check-miscaptures -find-trailing-spaces -check-umids pyflakes
|
code-checks: check-interfaces check-debugging check-miscaptures -find-trailing-spaces -check-umids pyflakes
|
||||||
|
|
||||||
|
.PHONY: check-interfaces
|
||||||
|
$(PYTHON) misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
|
||||||
|
@echo
|
||||||
|
|
||||||
.PHONY: check-debugging
|
.PHONY: check-debugging
|
||||||
check-debugging:
|
check-debugging:
|
||||||
misc/coding_tools/check-debugging.sh
|
$(PYTHON) misc/coding_tools/check-debugging.py
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
.PHONY: check-miscaptures
|
.PHONY: check-miscaptures
|
||||||
@ -120,7 +124,6 @@ count-lines:
|
|||||||
# probably work.
|
# probably work.
|
||||||
|
|
||||||
# src/allmydata/test/bench_dirnode.py
|
# src/allmydata/test/bench_dirnode.py
|
||||||
# misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
|
|
||||||
|
|
||||||
|
|
||||||
# The check-speed and check-grid targets are disabled, since they depend upon
|
# The check-speed and check-grid targets are disabled, since they depend upon
|
||||||
|
22
misc/coding_tools/check-debugging.py
Executable file
22
misc/coding_tools/check-debugging.py
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#! /usr/bin/python
|
||||||
|
|
||||||
|
# ./check-debugging.py src
|
||||||
|
|
||||||
|
import sys, re, os
|
||||||
|
|
||||||
|
ok = True
|
||||||
|
umids = {}
|
||||||
|
|
||||||
|
for starting_point in sys.argv[1:]:
|
||||||
|
for root, dirs, files in os.walk(starting_point):
|
||||||
|
for fn in [f for f in files if f.endswith(".py")]:
|
||||||
|
fn = os.path.join(root, fn)
|
||||||
|
for lineno,line in enumerate(open(fn, "r").readlines()):
|
||||||
|
lineno = lineno+1
|
||||||
|
mo = re.search(r"\.setDebugging\(True\)", line)
|
||||||
|
if mo:
|
||||||
|
print "Do not use defer.setDebugging(True) in production"
|
||||||
|
print "First used here: %s:%d" % (fn, lineno)
|
||||||
|
sys.exit(1)
|
||||||
|
print "No cases of defer.setDebugging(True) were found, good!"
|
||||||
|
sys.exit(0)
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
OUTPUT=$(grep -R '\.setDebugging(True)' src/allmydata)
|
|
||||||
|
|
||||||
if [[ -n $OUTPUT ]] ; then
|
|
||||||
echo "Do not use defer.setDebugging(True) in production:"
|
|
||||||
echo $OUTPUT
|
|
||||||
exit 1
|
|
||||||
fi
|
|
@ -1,14 +1,16 @@
|
|||||||
#! /usr/bin/python
|
#! /usr/bin/python
|
||||||
|
|
||||||
# ./rumid.py foo.py
|
# ./check-umids.py src
|
||||||
|
|
||||||
import sys, re, os
|
import sys, re, os
|
||||||
|
|
||||||
ok = True
|
ok = True
|
||||||
umids = {}
|
umids = {}
|
||||||
|
|
||||||
for fn in sys.argv[1:]:
|
for starting_point in sys.argv[1:]:
|
||||||
fn = os.path.abspath(fn)
|
for root, dirs, files in os.walk(starting_point):
|
||||||
|
for fn in [f for f in files if f.endswith(".py")]:
|
||||||
|
fn = os.path.join(root, fn)
|
||||||
for lineno,line in enumerate(open(fn, "r").readlines()):
|
for lineno,line in enumerate(open(fn, "r").readlines()):
|
||||||
lineno = lineno+1
|
lineno = lineno+1
|
||||||
if "umid" not in line:
|
if "umid" not in line:
|
||||||
|
14
tox.ini
14
tox.ini
@ -26,6 +26,20 @@ commands =
|
|||||||
tahoe --version
|
tahoe --version
|
||||||
coverage run --branch -m allmydata.test.run_trial --rterrors --reporter=timing {posargs:allmydata}
|
coverage run --branch -m allmydata.test.run_trial --rterrors --reporter=timing {posargs:allmydata}
|
||||||
|
|
||||||
|
[testenv:codechecks]
|
||||||
|
passenv = USERPROFILE HOMEDRIVE HOMEPATH
|
||||||
|
skip_install = True
|
||||||
|
deps = --editable=.[test]
|
||||||
|
commands =
|
||||||
|
pyflakes src static misc setup.py
|
||||||
|
python misc/coding_tools/check-umids.py src
|
||||||
|
python misc/coding_tools/check-debugging.py
|
||||||
|
python misc/coding_tools/find-trailing-spaces.py -r src static misc setup.py
|
||||||
|
python misc/coding_tools/check-miscaptures.py
|
||||||
|
# note: check-interfaces.py imports everything, so it must be run
|
||||||
|
# from a populated virtualenv
|
||||||
|
python misc/coding_tools/check-interfaces.py
|
||||||
|
|
||||||
[testenv:deprecations]
|
[testenv:deprecations]
|
||||||
basepython=python2.7
|
basepython=python2.7
|
||||||
passenv = USERPROFILE HOMEDRIVE HOMEPATH
|
passenv = USERPROFILE HOMEDRIVE HOMEPATH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user