Skip to content

Commit

Permalink
Restyled by yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Feb 17, 2022
1 parent 47331e8 commit c6ae291
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions other/analysis/check_includes
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ ALLOWLIST: Tuple[str, ...] = (
"vpx/vpx_image.h",
)

out = (
subprocess.run(
["grep", "-R", "^#include <.*>", "other", "toxav", "toxcore", "toxencryptsave"],
check=True,
capture_output=True,
)
.stdout.decode("utf-8")
.rstrip()
)
out = (subprocess.run(
[
"grep", "-R", "^#include <.*>", "other", "toxav", "toxcore",
"toxencryptsave"
],
check=True,
capture_output=True,
).stdout.decode("utf-8").rstrip())

errors = 0
for line in out.split("\n"):
Expand All @@ -45,15 +44,15 @@ for line in out.split("\n"):
allowlist = ALLOWLIST
if filename == "toxcore/ccompat.h":
allowlist += ("assert.h", "alloca.h", "malloc.h", "stdlib.h")
header = include[include.index("<") + 1 : include.index(">")]
header = include[include.index("<") + 1:include.index(">")]
if header not in allowlist:
source = filename[:-2] + ".c"
print(
f"{filename}: includes system header <{header}>, which is not allowed in .h files"
)
print(
" " * len(filename)
+ f" consider including it in {source} and exporting an abstraction, instead"
" " * len(filename) +
f" consider including it in {source} and exporting an abstraction, instead"
)
errors += 1

Expand Down

0 comments on commit c6ae291

Please sign in to comment.