Added a diagnose flag

Allowing the user to opt-in or out of diagnosing the file
This commit is contained in:
jspijker 2022-11-20 10:46:21 +01:00
parent cec022f330
commit 49305474ea

View File

@ -72,7 +72,7 @@ def formatFile(file: Path, settings):
config.write(f, space_around_delimiters=settings["format"].get("format-profile-space-around-delimiters", True))
def main(files, setting_path, to_format, to_fix, report):
def main(files, setting_path, to_format, to_fix, to_diagnose, report):
if not setting_path:
setting_path = Path(getcwd(), ".printer-linter")
@ -83,6 +83,7 @@ def main(files, setting_path, to_format, to_fix, report):
with open(setting_path, "r") as f:
settings = yaml.load(f, yaml.FullLoader)
if to_fix or to_diagnose:
full_body_check = {}
for file in files:
if file.is_dir():
@ -122,8 +123,9 @@ if __name__ == "__main__":
parser.add_argument("--setting", required=False, type=Path, help="Path to the `.printer-linter` setting file")
parser.add_argument("--report", required=False, type=Path, help="Path where the diagnostic report should be stored")
parser.add_argument("--format", action="store_true", help="Format the files")
parser.add_argument("--diagnose", action="store_true", help="Diagnose the files")
parser.add_argument("--fix", action="store_true", help="Attempt to apply the suggested fixes on the files")
parser.add_argument("Files", metavar="F", type=Path, nargs="+", help="Files or directories to format")
args = parser.parse_args()
main(args.Files, args.setting, args.format, args.fix, args.report)
main(args.Files, args.setting, args.format, args.fix, args.diagnose, args.report)