diff --git a/linter/lint.py b/src/linter/lint.py similarity index 96% rename from linter/lint.py rename to src/linter/lint.py index d461fbd..4c87861 100644 --- a/linter/lint.py +++ b/src/linter/lint.py @@ -1,34 +1,34 @@ -# Last "as" keyword is in the form ab_cd, where "a" and -# "b" are the first letters of the two words of the module -# and "c" and "d" are the first letters of the two words -# of the function of the module. - -from rules.content_about import trailing_slash as ca_ts -from rules.featured_playlists import trailing_slash as fp_ts -from rules.youtubers_names import trailing_slash as yn_ts - - -def main() -> None: - """ - Main function. Used specifically to call print results - by calling functions into rules/. - - Functions: - content_about: trailing_slash, comma_separated - featured_playlists: trailing_slash, closed_backsticks - youtubers_names: trailing_slash, youtube_link - """ - - # "youtubers_names" - print("YouTubers names:") - print(yn_ts()) - # "content_about" - print("Content about:") - print(ca_ts()) - # "featured_playlists" - print("Featured playlists:") - print(fp_ts()) - - -if __name__ == '__main__': - main() +# Last "as" keyword is in the form ab_cd, where "a" and +# "b" are the first letters of the two words of the module +# and "c" and "d" are the first letters of the two words +# of the function of the module. + +from rules.content_about import trailing_slash as ca_ts +from rules.featured_playlists import trailing_slash as fp_ts +from rules.youtubers_names import trailing_slash as yn_ts + + +def main() -> None: + """ + Main function. Used specifically to call print results + by calling functions into rules/. + + Functions: + content_about: trailing_slash, comma_separated + featured_playlists: trailing_slash, closed_backsticks + youtubers_names: trailing_slash, youtube_link + """ + + # "youtubers_names" + print("YouTubers names:") + print(yn_ts()) + # "content_about" + print("Content about:") + print(ca_ts()) + # "featured_playlists" + print("Featured playlists:") + print(fp_ts()) + + +if __name__ == '__main__': + main() diff --git a/linter/readme.md b/src/linter/readme.md similarity index 100% rename from linter/readme.md rename to src/linter/readme.md diff --git a/linter/rules/__init__.py b/src/linter/rules/__init__.py similarity index 100% rename from linter/rules/__init__.py rename to src/linter/rules/__init__.py diff --git a/linter/rules/content_about.py b/src/linter/rules/content_about.py similarity index 92% rename from linter/rules/content_about.py rename to src/linter/rules/content_about.py index 93590b9..cbb9aff 100644 --- a/linter/rules/content_about.py +++ b/src/linter/rules/content_about.py @@ -1,36 +1,36 @@ -import pathlib - -here = pathlib.Path(__file__).parent -file_readme = here / '../../readme.md' -with open(file_readme, 'r') as read_readme: - content = read_readme.readlines() - -CHECKER = "Content about:" - - -def trailing_slash() -> str: - """ - Looks for backslash and the end of all the matching - lines ("Content about:" lines). - """ - - result = ["🟢 0: perfect."] - - for line, value in enumerate(content): - if CHECKER in value: - last = value[-2] - if last != "\\": - if last == " ": - content[line] = f"{value[:-1]}\\\n" - else: - content[line] = f"{value[:-1]} \\\n" - - with open(file_readme, 'w') as write_readme: - write_readme.writelines(content) - - result.append(f"🔴 {line}: backslash. Fixed.") - - if len(result) > 1: - return '\n'.join(result[1:]) - else: - return ''.join(result) +import pathlib + +here = pathlib.Path(__file__).parent +file_readme = here / '../../../readme.md' +with open(file_readme, 'r') as read_readme: + content = read_readme.readlines() + +CHECKER = "Content about:" + + +def trailing_slash() -> str: + """ + Looks for backslash and the end of all the matching + lines ("Content about:" lines). + """ + + result = ["🟢 0: perfect."] + + for line, value in enumerate(content): + if CHECKER in value: + last = value[-2] + if last != "\\": + if last == " ": + content[line] = f"{value[:-1]}\\\n" + else: + content[line] = f"{value[:-1]} \\\n" + + with open(file_readme, 'w') as write_readme: + write_readme.writelines(content) + + result.append(f"🔴 {line}: backslash. Fixed.") + + if len(result) > 1: + return '\n'.join(result[1:]) + else: + return ''.join(result) diff --git a/linter/rules/featured_playlists.py b/src/linter/rules/featured_playlists.py similarity index 95% rename from linter/rules/featured_playlists.py rename to src/linter/rules/featured_playlists.py index 0138845..11bebc4 100644 --- a/linter/rules/featured_playlists.py +++ b/src/linter/rules/featured_playlists.py @@ -1,56 +1,56 @@ -import pathlib - -here = pathlib.Path(__file__).parent -file_readme = here / '../../readme.md' -with open(file_readme, 'r') as read_readme: - content = read_readme.readlines() - -CHECKER = "Featured playlists:" -LENGTH = 124 - - -def trailing_slash() -> str: - """ - Looks for backslash and the end of all the matching - lines ("Featured playlists:" lines) and a line - break tag "
" at the next line. - """ - - result = ["🟢 0: perfect."] - - for line, value in enumerate(content): - if CHECKER in value: - last = value[-2] - if len(value) < LENGTH: - if last != "\\" and "
" not in content[line+1]: - if last == " ": - content[line] = f"{value[:-1]}\\\n
\n" - else: - content[line] = f"{value[:-1]} \\\n
\n" - - with open(file_readme, 'w') as write_readme: - write_readme.writelines(content) - - result.append(f"🔴 {line}: backslash | line break. Fixed.") - elif last != "\\" and "
" in content[line+1]: - if last == " ": - content[line] = f"{value[:-1]}\\\n" - else: - content[line] = f"{value[:-1]} \\\n" - - with open(file_readme, 'w') as write_readme: - write_readme.writelines(content) - - result.append(f"🔴 {line}: backslash. Fixed.") - elif last == "\\" and "
" not in content[line+1]: - content[line+1] = "
\n\n" - - with open(file_readme, 'w') as write_readme: - write_readme.writelines(content) - - result.append(f"🔴 {line}: line break. Fixed.") - - if len(result) > 1: - return '\n'.join(result[1:]) - else: - return ''.join(result) +import pathlib + +here = pathlib.Path(__file__).parent +file_readme = here / '../../../readme.md' +with open(file_readme, 'r') as read_readme: + content = read_readme.readlines() + +CHECKER = "Featured playlists:" +LENGTH = 124 + + +def trailing_slash() -> str: + """ + Looks for backslash and the end of all the matching + lines ("Featured playlists:" lines) and a line + break tag "
" at the next line. + """ + + result = ["🟢 0: perfect."] + + for line, value in enumerate(content): + if CHECKER in value: + last = value[-2] + if len(value) < LENGTH: + if last != "\\" and "
" not in content[line+1]: + if last == " ": + content[line] = f"{value[:-1]}\\\n
\n" + else: + content[line] = f"{value[:-1]} \\\n
\n" + + with open(file_readme, 'w') as write_readme: + write_readme.writelines(content) + + result.append(f"🔴 {line}: backslash | line break. Fixed.") + elif last != "\\" and "
" in content[line+1]: + if last == " ": + content[line] = f"{value[:-1]}\\\n" + else: + content[line] = f"{value[:-1]} \\\n" + + with open(file_readme, 'w') as write_readme: + write_readme.writelines(content) + + result.append(f"🔴 {line}: backslash. Fixed.") + elif last == "\\" and "
" not in content[line+1]: + content[line+1] = "
\n\n" + + with open(file_readme, 'w') as write_readme: + write_readme.writelines(content) + + result.append(f"🔴 {line}: line break. Fixed.") + + if len(result) > 1: + return '\n'.join(result[1:]) + else: + return ''.join(result) diff --git a/linter/rules/youtubers_names.py b/src/linter/rules/youtubers_names.py similarity index 92% rename from linter/rules/youtubers_names.py rename to src/linter/rules/youtubers_names.py index 050ca9f..11ebed8 100644 --- a/linter/rules/youtubers_names.py +++ b/src/linter/rules/youtubers_names.py @@ -1,36 +1,36 @@ -import pathlib - -here = pathlib.Path(__file__).parent -file_readme = here / '../../readme.md' -with open(file_readme, 'r') as read_readme: - content = read_readme.readlines() - -CHECKER = "[**" - - -def trailing_slash() -> str: - """ - Looks for backslash and the end of all the matching - lines (YouTubers names lines). - """ - - result = ["🟢 0: perfect."] - - for line, value in enumerate(content): - if CHECKER in value: - last = value[-2] - if last != "\\": - if last == " ": - content[line] = f"{value[:-1]}\\\n" - else: - content[line] = f"{value[:-1]} \\\n" - - with open(file_readme, 'w') as write_readme: - write_readme.writelines(content) - - result.append(f"🔴 {line}: backslash. Fixed.") - - if len(result) > 1: - return '\n'.join(result[1:]) - else: - return ''.join(result) +import pathlib + +here = pathlib.Path(__file__).parent +file_readme = here / '../../../readme.md' +with open(file_readme, 'r') as read_readme: + content = read_readme.readlines() + +CHECKER = "[**" + + +def trailing_slash() -> str: + """ + Looks for backslash and the end of all the matching + lines (YouTubers names lines). + """ + + result = ["🟢 0: perfect."] + + for line, value in enumerate(content): + if CHECKER in value: + last = value[-2] + if last != "\\": + if last == " ": + content[line] = f"{value[:-1]}\\\n" + else: + content[line] = f"{value[:-1]} \\\n" + + with open(file_readme, 'w') as write_readme: + write_readme.writelines(content) + + result.append(f"🔴 {line}: backslash. Fixed.") + + if len(result) > 1: + return '\n'.join(result[1:]) + else: + return ''.join(result) diff --git a/voter/Procfile b/src/voter/Procfile similarity index 100% rename from voter/Procfile rename to src/voter/Procfile diff --git a/voter/data.json b/src/voter/data.json similarity index 99% rename from voter/data.json rename to src/voter/data.json index 3f409e8..9fe85f0 100644 --- a/voter/data.json +++ b/src/voter/data.json @@ -1,5 +1,5 @@ { - "Tech_With_Tim": 11, + "Tech_With_Tim": 0, "Derek_Banas": 0, "Don_Jones": 0, "Corey_Schafer": 0, diff --git a/voter/main.py b/src/voter/main.py similarity index 100% rename from voter/main.py rename to src/voter/main.py diff --git a/voter/readme.md b/src/voter/readme.md similarity index 100% rename from voter/readme.md rename to src/voter/readme.md diff --git a/voter/requirements.txt b/src/voter/requirements.txt similarity index 100% rename from voter/requirements.txt rename to src/voter/requirements.txt