Skip to content

Commit 4ff1220

Browse files
committed
Refactoring
1 parent 4a75a89 commit 4ff1220

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

scripts/gen_doc.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@
99
DIRECTORIES = ["src", "tests/unit", "tests/integration", "tests/e2e"]
1010

1111
# README.md files won't be generated in following directories
12-
DIRS_TO_SKIP = [
12+
DIRS_TO_SKIP = {
1313
"tests/integration",
1414
"tests/e2e",
1515
"tests/e2e/configuration",
16-
"tests/e2e",
17-
"tests/e2e/configuration",
1816
"tests/e2e/rag",
1917
"tests/e2e/secrets",
2018
"tests/e2e/skills",
2119
"tests/e2e/skills/echo",
2220
"tests/e2e/skills/echo/references",
2321
"tests/e2e/skills/summarize",
2422
"tests/e2e/skills/summarize/references",
25-
]
23+
}
2624

2725

2826
def generate_docfile(directory: Path) -> None:
@@ -70,15 +68,18 @@ def generate_documentation_on_path(path: Path) -> None:
7068
path (str or os.PathLike): Directory in which to generate the README.md file.
7169
"""
7270
directory = path
71+
72+
# directory can be skipped if it's part of DIRS_TO_SKIP global list.
73+
if path.as_posix() in DIRS_TO_SKIP:
74+
print(f"[gendoc] Skipping {path}")
75+
return
76+
7377
cwd = os.getcwd()
74-
os.chdir(directory)
78+
os.chdir(path)
7579

7680
try:
77-
if str(directory) in DIRS_TO_SKIP:
78-
print(f"[gendoc] Skipping {directory}")
79-
else:
80-
print(f"[gendoc] Generating README.md in: {directory}")
81-
generate_docfile(directory)
81+
print(f"[gendoc] Generating README.md in: {path}")
82+
generate_docfile(path)
8283
finally:
8384
os.chdir(cwd)
8485

0 commit comments

Comments
 (0)