-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from GatorEducator/fix/handle-bad-file
Fix/handle bad file
- Loading branch information
Showing
6 changed files
with
98 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
"""Returns the list of commands to be run through gatorgrader.""" | ||
|
||
from pathlib import Path | ||
|
||
from gatorgrade.input.command_line_generator import generate_checks | ||
from gatorgrade.input.in_file_path import parse_yaml_file | ||
from gatorgrade.input.in_file_path import reformat_yaml_data | ||
|
||
|
||
def parse_config(file): | ||
def parse_config(file: Path): | ||
"""Parse the input yaml file and generate specified checks. | ||
Args: | ||
file: Yaml file containing gatorgrade and shell command checks | ||
Returns: | ||
Returns a dictionary that specifies shell commands and gatorgrade commands | ||
""" | ||
parse_con = generate_checks( | ||
reformat_yaml_data(parse_yaml_file(file)) | ||
) # Call previously generated function to modify file | ||
return parse_con | ||
# parse the YAML file using parse_yaml_file provided by gatorgrade | ||
parsed_yaml_file = parse_yaml_file(file) | ||
# the parsed YAML file contains some contents in a list and thus | ||
# the tool should generate a GatorGrader check for each element in list | ||
if len(parsed_yaml_file) > 0: | ||
# after reformatting the parse YAML file, | ||
# use it to generate all of the checks; | ||
# these will be valid checks that are now | ||
# ready for execution with this tool | ||
parse_con = generate_checks(reformat_yaml_data(parsed_yaml_file)) | ||
return parse_con | ||
# return an empty list because of the fact that the | ||
# parsing process did not return a list with content; | ||
# allow the calling function to handle the empty list | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters