From 46e3858596b28af653551b37523eb60b88356a3a Mon Sep 17 00:00:00 2001 From: PhilipOlwoc Date: Mon, 9 Dec 2024 16:35:51 -0500 Subject: [PATCH] fix: fixed traceback error --- gatorgrade/generate/generate.py | 1 + gatorgrade/main.py | 10 +--------- gatorgrade/output/output.py | 11 +++++++++++ gatorgrade/output/quotes.json | 17 ----------------- 4 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 gatorgrade/output/quotes.json diff --git a/gatorgrade/generate/generate.py b/gatorgrade/generate/generate.py index 8dd91164..4dafe19e 100644 --- a/gatorgrade/generate/generate.py +++ b/gatorgrade/generate/generate.py @@ -119,6 +119,7 @@ def write_yaml_of_paths_list( "description": f"Complete all TODOs in {file_path_fixed}", "check": "MatchFileFragment", "options": {"fragment": "TODO", "count": 0, "exact": True}, + "motivation": "You're doint Great" } ] } diff --git a/gatorgrade/main.py b/gatorgrade/main.py index d6de48ee..bb215b2e 100644 --- a/gatorgrade/main.py +++ b/gatorgrade/main.py @@ -45,14 +45,6 @@ def gatorgrade( 3. the name of the file or environment variable\ 4. use 'env md GITHUB_STEP_SUMMARY' to create GitHub job summary in GitHub Action", ), - run_status_bar: bool = typer.Option( - False, - "--run_status_bar", - help="Enable a progress bar for checks running/not running.", - ), - no_status_bar: bool = typer.Option( - False, "--no_status_bar", help="Disable the progress bar entirely." - ), run_motivation: bool = typer.Option( False, "--motivation", help="Enable a motivational message" ), ): """Run the GatorGrader checks in the specified gatorgrade.yml file.""" @@ -64,7 +56,7 @@ def gatorgrade( # there are valid checks and thus the # tool should run them with run_checks if len(checks) > 0: - checks_status = run_checks(checks, report, run_status_bar, no_status_bar, run_motivation) + checks_status = run_checks(checks, report, )#run_status_bar, #no_status_bar, run_motivation) # no checks were created and this means # that, most likely, the file was not # valid and thus the tool cannot run checks diff --git a/gatorgrade/output/output.py b/gatorgrade/output/output.py index 3c447e5f..4cbca8c4 100644 --- a/gatorgrade/output/output.py +++ b/gatorgrade/output/output.py @@ -76,6 +76,10 @@ def _run_gg_check(check: GatorGraderCheck) -> CheckResult: file_name = check.gg_args[i + 3] file_path = dir_name + "/" + file_name break + motivation = "" + if "--motivation" in check.gg_args: + index_of_motivation = check.gg_args.index("--hint") + motivation = check.gg_args[index_of_motivation + 1] # If arguments are formatted incorrectly, catch the exception and # return it as the diagnostic message # Disable pylint to catch any type of exception thrown by GatorGrader @@ -90,6 +94,7 @@ def _run_gg_check(check: GatorGraderCheck) -> CheckResult: json_info=check.json_info, diagnostic=diagnostic, path=file_path, + motivation=motivation ) @@ -189,6 +194,9 @@ def create_markdown_report_file(json: dict) -> str: if "file" == i: val = check["options"]["file"] markdown_contents += f"\n\t- **file:** {val}" + if "motivation" == i: + val = check["options"]["motivation"] + markdown_contents += f"\n\t- **file:** {val}" elif "command" in check: val = check["command"] markdown_contents += f"\n\t- **command:** {val}" @@ -344,6 +352,7 @@ def run_checks( # and print what ShellCheck command that Gatorgrade ran if len(failed_results) > 0: print("\n-~- FAILURES -~-\n") + print("Rebekah Test") for result in failed_results: # main.console.print("This is a result") # main.console.print(result) @@ -359,6 +368,8 @@ def run_checks( rich.print( f"[blue] → Run this command: [green]{result.run_command}\n" ) + #if result.motivation != "": + # determine how many of the checks passed and then # compute the total percentage of checks passed passed_count = len(results) - len(failed_results) diff --git a/gatorgrade/output/quotes.json b/gatorgrade/output/quotes.json deleted file mode 100644 index 219954ac..00000000 --- a/gatorgrade/output/quotes.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "low_motivation": [ - "The journey of 1000 miles begins with a single step", - "Keep pushing, you're just getting started!", - "Hang in there; the best is yet to come!" - ], - "mid_motivation": [ - "50% there", - "Halfway there, keep going strong!", - "You're making great progress!" - ], - "high_motivation": [ - "Congrats, you're done!", - "Almost there, don't give up now!", - "Finish line is in sight!" - ] -}