|
| 1 | +from __future__ import annotations |
1 | 2 | import argparse
|
2 | 3 | import logging
|
3 | 4 | import ssl
|
|
12 | 13 |
|
13 | 14 | issue_url_template_base = "https://github.com/TheRenegadeCoder/sample-programs/issues/new"
|
14 | 15 | issue_url_template_query = "?assignees=&labels=enhancement,{label}&template=code-snippet-request.md&title=Add+{project}+in+{language}"
|
| 16 | +naming_conventions = { |
| 17 | + "camel": "helloWorld", |
| 18 | + "hyphen": "hello-world", |
| 19 | + "lower": "helloworld", |
| 20 | + "pascal": "HelloWorld", |
| 21 | + "underscore": "hello_world" |
| 22 | +} |
15 | 23 |
|
16 | 24 |
|
17 | 25 | def main():
|
@@ -207,24 +215,46 @@ def _build_readme(self, language: LanguageCollection) -> None:
|
207 | 215 | # Testing
|
208 | 216 | page.add_heading("Testing", level=2)
|
209 | 217 | test_data = language.testinfo()
|
210 |
| - if not test_data: |
| 218 | + untestable_data = language.untestable_info() |
| 219 | + if test_data: |
| 220 | + extension = test_data["folder"]["extension"] |
| 221 | + naming = test_data["folder"]["naming"] |
211 | 222 | page.add_paragraph(
|
212 |
| - """ |
213 |
| - This language currently does not feature testing. If you'd like to help in the efforts to test all of |
214 |
| - the code in this repo, consider creating a testinfo.yml file with the following information: |
215 |
| - """ |
| 223 | + f"The following list shares details about how we name all Sample Programs in {language}:" |
216 | 224 | )
|
217 |
| - page.add_code("folder:\n extension:\n naming:\n\ncontainer:\n image:\n tag:\n cmd:", lang="yml") |
218 |
| - else: |
| 225 | + page.add_unordered_list([ |
| 226 | + f"Extension: {extension}", |
| 227 | + f"Naming Convention: {naming}" |
| 228 | + ]) |
| 229 | + |
| 230 | + page.add_paragraph('For example, the "Hello World" sample would be named this:') |
| 231 | + page.add_unordered_list([f"{naming_conventions[naming]}{extension}"]) |
| 232 | + |
219 | 233 | page.add_paragraph(
|
220 |
| - f"The following list shares details about what we're using to test all Sample Programs in {language}." |
| 234 | + f"The following list shares details about what we're using to test all Sample Programs in {language}:" |
221 | 235 | )
|
222 | 236 | page.add_unordered_list([
|
223 | 237 | f"Docker Image: {test_data['container']['image']}",
|
224 | 238 | f"Docker Tag: {test_data['container']['tag']}"
|
225 | 239 | ])
|
226 |
| - glotter = page.add_paragraph("See the Glotter2 project for more information on how to create a testinfo file.") |
227 |
| - glotter.insert_link("Glotter2 project", "https://github.com/rzuckerm/glotter2") |
| 240 | + elif untestable_data: |
| 241 | + page.add_paragraph( |
| 242 | + f"{language} cannot be tested for the following reason:" |
| 243 | + ) |
| 244 | + page.add_unordered_list([untestable_data[0]["reason"]]) |
| 245 | + else: |
| 246 | + page.add_paragraph( |
| 247 | + """ |
| 248 | + This language currently does not feature testing. If you'd like to help in the efforts to test all of |
| 249 | + the code in this repo, consider creating a testinfo.yml file with the following information: |
| 250 | + """ |
| 251 | + ) |
| 252 | + page.add_code("folder:\n extension:\n naming:\n\ncontainer:\n image:\n tag:\n cmd:", lang="yml") |
| 253 | + |
| 254 | + if not untestable_data: |
| 255 | + glotter = page.add_paragraph("See the Glotter2 project for more information on how to create a testinfo file.") |
| 256 | + glotter.insert_link("Glotter2 project", "https://github.com/rzuckerm/glotter2") |
| 257 | + |
228 | 258 | page.add_horizontal_rule()
|
229 | 259 | page.add_block(_generate_credit())
|
230 | 260 |
|
|
0 commit comments