Update linter

This commit is contained in:
Jose De Freitas 2021-02-11 18:24:13 -05:00
parent 2265b0c0ea
commit 90f77ed3e7
5 changed files with 14 additions and 5 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.vscode
.vscode
__pycache__

View File

@ -1,5 +1,6 @@
from rules import (content_about, featured_playlists, youtubers_names)
def main():
"""
Main function. Used specifically to call print results
@ -9,7 +10,7 @@ def main():
print("Every YouTubers names are good.", "\n")
else:
print("'YouTubers name' errors:\n", '\n'.join(["Error at line {}: there should be a trailing '\\'.".format(i) for i in youtubers_names.youtubers_name_errors_nums]), "\n")
if len(content_about.content_about_errors_nums) == 0:
print("Every 'Content about' sections are good.", "\n")
else:
@ -20,5 +21,6 @@ def main():
else:
print("'Featured playlists' errors:\n", '\n'.join(["Error at line {}: there should be a trailing '\\'.".format(i) for i in featured_playlists.featured_playlists_errors_nums]))
if __name__ == '__main__':
main()

View File

@ -5,14 +5,16 @@ file_readme = here / './../readme.md'
with open(file_readme, 'r') as read_readme:
content_readme = read_readme.readlines()
def content_about():
content_about_errors_nums = []
content_about_line = 'Content about:'
for j, i in enumerate(content_readme):
if content_about_line in i:
if i[-2] != '\\':
content_about_errors_nums.append(j)
return content_about_errors_nums
content_about_errors_nums = content_about()

View File

@ -5,15 +5,17 @@ file_readme = here / './../readme.md'
with open(file_readme, 'r') as read_readme:
content_readme = read_readme.readlines()
def featured_playlists():
featured_playlists_errors_nums = []
featured_playlists_line = 'Featured playlists:'
featured_playlists_dlen = 124
for j, i in enumerate(content_readme):
if featured_playlists_line in i:
if len(i) < featured_playlists_dlen and i[-2] != '\\':
featured_playlists_errors_nums.append(j)
return featured_playlists_errors_nums
featured_playlists_errors_nums = featured_playlists()

View File

@ -5,14 +5,16 @@ file_readme = here / './../readme.md'
with open(file_readme, 'r') as read_readme:
content_readme = read_readme.readlines()
def youtubers_names():
youtubers_name_errors_nums = []
youtuber_count_char = '[**'
for j, i in enumerate(content_readme):
if youtuber_count_char in i:
if i[-2] != '\\':
youtubers_name_errors_nums.append(j)
return youtubers_name_errors_nums
youtubers_name_errors_nums = youtubers_names()