Skip to content

Commit 423a251

Browse files
authored
Merge branch 'master' into asteroids-pygame-project
2 parents b7e3a22 + e3643d4 commit 423a251

File tree

19 files changed

+165
-0
lines changed

19 files changed

+165
-0
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ jobs:
3939
. venv/bin/activate
4040
flake8
4141
black --check .
42+
43+
- run:
44+
name: Directory layout check
45+
command: |
46+
. venv/bin/activate
47+
python .circleci/dircheck.py

.circleci/dircheck.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""
2+
Linter to ensure standard folder structure
3+
"""
4+
import pathlib
5+
import re
6+
import sys
7+
8+
IGNORELIST = {
9+
"venv",
10+
"asyncio-walkthrough",
11+
"build-a-gui-with-wxpython",
12+
"consuming-apis-python",
13+
"flask-connexion-rest-part-3",
14+
"flask-connexion-rest-part-4",
15+
"generators",
16+
"intro-to-threading",
17+
"introduction-combining-data-pandas-merge-join-and-concat",
18+
"linked-lists-python",
19+
"nearbyshops",
20+
"oop-in-java-vs-python",
21+
"opencv-color-spaces",
22+
"openpyxl-excel-spreadsheets-python",
23+
"pygame-a-primer",
24+
"pyqt-calculator-tutorial",
25+
"python-dash",
26+
"python-eval-mathrepl",
27+
"rp-portfolio",
28+
"storing-images",
29+
"understanding-asynchronous-programming",
30+
}
31+
FOLDER_NAME_RE = re.compile(r"^[-a-z0-9]{5,}\Z")
32+
33+
has_errors = False
34+
35+
for f in sorted(pathlib.Path(".").glob("*")):
36+
if not f.is_dir():
37+
continue
38+
if str(f).startswith("."):
39+
continue
40+
if str(f) in IGNORELIST:
41+
continue
42+
43+
if not FOLDER_NAME_RE.search(str(f)):
44+
print(
45+
f"{f}: ensure folder name only uses "
46+
f"lowercase letters, numbers, and hyphens"
47+
)
48+
has_error = True
49+
50+
files = sorted(_.name for _ in f.glob("*"))
51+
if "README.md" not in files:
52+
print(f"{f}: no README.md found")
53+
has_errors = True
54+
55+
if has_errors:
56+
print(
57+
"""-----------------------
58+
Please ensure new sample projects are added using the correct
59+
folder structure:
60+
61+
* New files should go into a top-level subfolder, named after the
62+
article slug (lowercase, dashes). For example: my-awesome-article/
63+
64+
* Top-level sample project folders should contain a README.md file.
65+
For example: my-awesome-article/README.md
66+
67+
This helps us keep the repo clean and easy to browse on GitHub.
68+
69+
Thanks!
70+
"""
71+
)
72+
sys.exit(1)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)