mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2025-01-03 03:20:48 -05:00
Add rules
This commit is contained in:
parent
90f77ed3e7
commit
fd81b02e26
0
linter/rules/__init__.py
Normal file
0
linter/rules/__init__.py
Normal file
@ -1,20 +1,34 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
here = pathlib.Path(__file__).parent
|
here = pathlib.Path(__file__).parent
|
||||||
file_readme = here / './../readme.md'
|
file_readme = here / '../../test.md'
|
||||||
with open(file_readme, 'r') as read_readme:
|
with open(file_readme, 'r') as read_readme:
|
||||||
content_readme = read_readme.readlines()
|
content_readme = read_readme.readlines()
|
||||||
|
|
||||||
|
|
||||||
def content_about():
|
def content_about():
|
||||||
content_about_errors_nums = []
|
"""
|
||||||
|
Looks for trailing slashes and words separated by commas at
|
||||||
|
every "Content about:" section found in the readme.md file
|
||||||
|
(this is, the list itself).
|
||||||
|
"""
|
||||||
|
|
||||||
|
content_about_result = 'No errors found.'
|
||||||
|
# content_about_errors = {}
|
||||||
content_about_line = 'Content about:'
|
content_about_line = 'Content about:'
|
||||||
|
|
||||||
for j, i in enumerate(content_readme):
|
for j, i in enumerate(content_readme):
|
||||||
if content_about_line in i:
|
if content_about_line in i:
|
||||||
|
# content_about_words = i[len(content_about_line):-2]
|
||||||
|
|
||||||
if i[-2] != '\\':
|
if i[-2] != '\\':
|
||||||
content_about_errors_nums.append(j)
|
content_readme[j] = i.replace('&', '\\')
|
||||||
return content_about_errors_nums
|
with open(file_readme, 'w') as write_readme:
|
||||||
|
write_readme.writelines(content_readme)
|
||||||
|
content_about_result = "Found errors. Fixed them."
|
||||||
|
# content_about_errors.append(j)
|
||||||
|
return content_about_result
|
||||||
|
# return content_about_errors
|
||||||
|
|
||||||
|
|
||||||
content_about_errors_nums = content_about()
|
print(content_about())
|
||||||
|
Loading…
Reference in New Issue
Block a user