diff --git a/Makefile b/Makefile index eb9c291ee..7d76b4cab 100644 --- a/Makefile +++ b/Makefile @@ -249,3 +249,11 @@ show_scope: show_type:show_scope .PHONY: show_type +# grep recursively, ignore binary files, print file line, print file name +# exclude dot dirs, exclude pylintrc (would match the notes) +# exclude notebooks (sometimes matches in svg text), match the notes in this directory +todo: + @NOTES_ARGS=$$(poetry run python ./script/make_utils/get_pylintrc_notes.py \ + --pylintrc-path pylintrc);\ + grep -rInH --exclude-dir='.[^.]*' --exclude=pylintrc --exclude='*.ipynb' "$${NOTES_ARGS}" . +.PHONY: todo diff --git a/script/make_utils/get_pylintrc_notes.py b/script/make_utils/get_pylintrc_notes.py new file mode 100644 index 000000000..c108ca93b --- /dev/null +++ b/script/make_utils/get_pylintrc_notes.py @@ -0,0 +1,30 @@ +"""File to get pylintrc notes""" + +import argparse +import configparser +from pathlib import Path + + +def main(args): + """Entry point""" + + pylintrc_file_path = Path(args.pylintrc_path).resolve() + config = configparser.ConfigParser() + config.read(pylintrc_file_path) + notes = sorted(map(lambda x: x.strip(), config["MISCELLANEOUS"]["notes"].split(","))) + # Make sure we at least have todo in there without writing it otherwise we'll match + notes.append("TO" + "DO") + notes_for_grep_search = r"\|".join(notes) + print(notes_for_grep_search) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser("Parse pylintrc notes", allow_abbrev=False) + + parser.add_argument( + "--pylintrc-path", type=str, required=True, help="Path to pylintrc ini config" + ) + + cli_args = parser.parse_args() + + main(cli_args)