Skip to content

Commit a1344cd

Browse files
tdicolatannewt
authored andcommitted
Refactor to add basic bundle ignore list including the bundle itself.
1 parent 81227d9 commit a1344cd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

adabot/circuitpython_libraries.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
ERRRO_UNABLE_PULL_REPO_EXAMPLES = "Unable to retrieve examples folder contents"
5050
ERROR_WIKI_DISABLED = "Wiki should be disabled"
5151

52+
# Constant for bundle repo name.
53+
BUNDLE_REPO_NAME = "Adafruit_CircuitPython_Bundle"
54+
55+
# Repos to ignore for validation they exist in the bundle. Add repos by their
56+
# full name on Github (like Adafruit_CircuitPython_Bundle).
57+
BUNDLE_IGNORE_LIST = [BUNDLE_REPO_NAME]
58+
5259

5360
def parse_gitmodules(input_text):
5461
"""Parse a .gitmodules file and return a list of all the git submodules
@@ -209,8 +216,9 @@ def validate_repo_state(repo):
209216
if not repo["permissions"]["push"]:
210217
errors.append(ERROR_MISSING_LIBRARIANS)
211218
if not is_repo_in_bundle(full_repo["clone_url"], bundle_submodules) and \
212-
not repo["name"] == "Adafruit_CircuitPython_Bundle": # Bundle doesn't
213-
# bundle itself.
219+
not repo["name"] in BUNDLE_IGNORE_LIST: # Don't assume the bundle will
220+
# bundle itself and possibly
221+
# other repos.
214222
errors.append(ERROR_NOT_IN_BUNDLE)
215223
return errors
216224

@@ -223,7 +231,7 @@ def validate_contents(repo):
223231
if not (repo["owner"]["login"] == "adafruit" and
224232
repo["name"].startswith("Adafruit_CircuitPython")):
225233
return []
226-
if repo["name"] == "Adafruit_CircuitPython_Bundle":
234+
if repo["name"] == BUNDLE_REPO_NAME:
227235
return []
228236

229237
content_list = github.get("/repos/" + repo["full_name"] + "/contents/")

0 commit comments

Comments
 (0)