diff --git a/linter/rules/__init__.py b/linter/rules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/linter/rules/content_about.py b/linter/rules/content_about.py index 59f4f87..ccf4819 100644 --- a/linter/rules/content_about.py +++ b/linter/rules/content_about.py @@ -1,20 +1,34 @@ import pathlib here = pathlib.Path(__file__).parent -file_readme = here / './../readme.md' +file_readme = here / '../../test.md' with open(file_readme, 'r') as read_readme: content_readme = read_readme.readlines() 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:' for j, i in enumerate(content_readme): if content_about_line in i: + # content_about_words = i[len(content_about_line):-2] + if i[-2] != '\\': - content_about_errors_nums.append(j) - return content_about_errors_nums + content_readme[j] = i.replace('&', '\\') + 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())