Skip to content

Commit

Permalink
make 'doc_dir' test recursive for subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
OniriCorpe committed Mar 21, 2024
1 parent 259ebcd commit 75b29cf
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions package_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,20 +590,24 @@ def doc_dir(app):
"""
)

if os.path.exists(app.path + "/doc/screenshots"):
if os.path.exists(os.path.join(app.path, "doc/screenshots")):
du_output = subprocess.check_output(["du", "-sb", app.path + "/doc/screenshots"], shell=False)
screenshots_size = int(du_output.split()[0])
if screenshots_size > 512000:
yield Info("Consider keeping the content of doc/screenshots under ~512Kb for better UI/UX once the screenshots will be integrated in the webadmin app's catalog (to be discussed with the team)")

for path in os.listdir(app.path + "/doc/screenshots"):
if path == ".gitkeep":
continue
if os.path.isdir(path):
continue
if all(not path.lower().endswith(ext) for ext in [".jpg", ".jpeg", ".png", ".gif", ".webp"]):
yield Warning("In the doc/screenshots folder, only .jpg, .jpeg, .png, .webp and .gif are accepted")
break
for _, _, files in os.walk(os.path.join(app.path, "doc/screenshots")):
for file in files:
if file == ".gitkeep":
continue
if all(
not file.lower().endswith(ext)
for ext in [".jpg", ".jpeg", ".png", ".gif", ".webp"]
):
yield Warning(
"In the doc/screenshots folder, only .jpg, .jpeg, .png, .webp and .gif are accepted"
)
break

@test()
def doc_dir_v2(app):
Expand Down

0 comments on commit 75b29cf

Please sign in to comment.