Skip to content

Commit

Permalink
ci: guide contributor to fix the category
Browse files Browse the repository at this point in the history
See apache#4710 (comment)

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
  • Loading branch information
spacewander committed Aug 3, 2021
1 parent 1b247c8 commit bc4aa98
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions utils/check-category.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def collect_fn(entries, topic):
collect_fn(entries, item)

def check_category(root):
with open(root + "config.json") as f:
index = root + "config.json"
with open(index) as f:
entries = []

data = json.load(f)
Expand All @@ -50,18 +51,19 @@ def check_category(root):
for e in entries:
fn = root + e + EXT
if not path.exists(fn):
print("Entry %s in the sidebar can't be found" % fn)
print("Entry %s in the sidebar can't be found. Please remove it from %s."
% (fn, index))
return False

deny_list = ["examples/plugins-hmac-auth-generate-signature", "config", "README"]
entries.extend(deny_list)
ignore_list = ["examples/plugins-hmac-auth-generate-signature", "config", "README"]
entries.extend(ignore_list)
existed_files = []
for parent, dirs, files in os.walk(root):
for fn in files:
existed_files.append(path.join(parent[len(root):], path.splitext(fn)[0]))
for fn in existed_files:
if fn not in entries:
print("File %s%s%s is not indexed" % (root, fn, EXT))
print("File %s%s%s is not indexed. Please add it to %s." % (root, fn, EXT, index))
return False
return True

Expand Down

0 comments on commit bc4aa98

Please sign in to comment.