|
20 | 20 | PYLINT_BASE_PATH = Path(__file__).resolve().parent.parent.parent
|
21 | 21 | """Base path to the project folder"""
|
22 | 22 |
|
23 |
| -PYLINT_MESSAGES_PATH = os.path.join(PYLINT_BASE_PATH, "doc", "messages") |
| 23 | +PYLINT_MESSAGES_PATH = PYLINT_BASE_PATH / "doc" / "messages" |
24 | 24 | """Path to the messages documentation folder"""
|
25 | 25 |
|
26 | 26 |
|
@@ -89,9 +89,9 @@ def _get_all_messages(
|
89 | 89 | def _write_message_page(messages_dict: MessagesDict) -> None:
|
90 | 90 | """Create or overwrite the file for each message."""
|
91 | 91 | for category, messages in messages_dict.items():
|
92 |
| - category_dir = os.path.join(PYLINT_MESSAGES_PATH, category) |
93 |
| - if not os.path.exists(category_dir): |
94 |
| - os.makedirs(category_dir) |
| 92 | + category_dir = PYLINT_MESSAGES_PATH / category |
| 93 | + if not category_dir.exists(): |
| 94 | + category_dir.mkdir(parents=True, exist_ok=True) |
95 | 95 | for message in messages:
|
96 | 96 | messages_file = os.path.join(category_dir, f"{message.name}.rst")
|
97 | 97 | with open(messages_file, "w", encoding="utf-8") as stream:
|
@@ -171,7 +171,7 @@ def _write_messages_list_page(
|
171 | 171 | def _write_redirect_pages(old_messages: OldMessagesDict) -> None:
|
172 | 172 | """Create redirect pages for old-messages."""
|
173 | 173 | for category, old_names in old_messages.items():
|
174 |
| - category_dir = os.path.join(PYLINT_MESSAGES_PATH, category) |
| 174 | + category_dir = PYLINT_MESSAGES_PATH / category |
175 | 175 | if not os.path.exists(category_dir):
|
176 | 176 | os.makedirs(category_dir)
|
177 | 177 | for old_name, new_names in old_names.items():
|
|
0 commit comments