Skip to content

Commit

Permalink
Merge pull request #212 from GatorEducator/bug/fix-merge-206
Browse files Browse the repository at this point in the history
Fix line endings and formatting and upgrade Travis CI
  • Loading branch information
gkapfham authored Jan 28, 2020
2 parents 5e4dfed + a3b8f03 commit e299b93
Show file tree
Hide file tree
Showing 9 changed files with 389 additions and 327 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ environment:
# build and test with two versions of Python
matrix:
# Use Python 3.7
- PYTHON_VERSION: 3.7.4
- PYTHON_VERSION: 3.7.5
PYTHON_PATH: C:\Python37
# Use Python 3.6
- PYTHON_VERSION: 3.6.8
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Convert line endings to be LF, following the Unix standard
* text eol=lf
472 changes: 248 additions & 224 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Want to learn about our linting checks? Check us out on our website,
descriptions of our linting checks and more! To get an idea of the linting checks we
offer, here is a quick list:

1. ConfirmFileExists
1. ConfirmFileExists

2. CountCommandOutput

Expand Down
66 changes: 51 additions & 15 deletions gator/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ def invoke_all_comment_checks(
if comment_type == constants.comments.Single_Line:
# check comments in Java
if language == constants.languages.Java:
met_or_exceeded_count, actual_count, comment_count_details = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
comment_count_details,
) = entities.entity_greater_than_count(
filecheck,
directory,
expected_count,
Expand All @@ -102,7 +106,11 @@ def invoke_all_comment_checks(
)
# check comments in Python
if language == constants.languages.Python:
met_or_exceeded_count, actual_count, comment_count_details = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
comment_count_details,
) = entities.entity_greater_than_count(
filecheck,
directory,
expected_count,
Expand All @@ -113,7 +121,11 @@ def invoke_all_comment_checks(
elif comment_type == constants.comments.Multiple_Line:
# check comments in Java
if language == constants.languages.Java:
met_or_exceeded_count, actual_count, comment_count_details = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
comment_count_details,
) = entities.entity_greater_than_count(
filecheck,
directory,
expected_count,
Expand All @@ -122,7 +134,11 @@ def invoke_all_comment_checks(
)
# check comments in Python
if language == constants.languages.Python:
met_or_exceeded_count, actual_count, comment_count_details = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
comment_count_details,
) = entities.entity_greater_than_count(
filecheck,
directory,
expected_count,
Expand Down Expand Up @@ -213,7 +229,11 @@ def invoke_all_comment_checks(
def invoke_all_paragraph_checks(filecheck, directory, expected_count, exact=False):
"""Perform the paragraph check and return the results."""
met_or_exceeded_count = 0
met_or_exceeded_count, actual_count, actual_count_dictionary = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
actual_count_dictionary,
) = entities.entity_greater_than_count(
filecheck, directory, expected_count, fragments.count_paragraphs, exact
)
# create the message and the diagnostic
Expand Down Expand Up @@ -266,7 +286,11 @@ def invoke_all_minimum_word_count_checks(
):
"""Perform the word count check and return the results."""
met_or_exceeded_count = 0
met_or_exceeded_count, actual_count, actual_count_dictionary = entities.entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
actual_count_dictionary,
) = entities.entity_greater_than_count(
filecheck, directory, expected_count, count_function, exact
)
# create the message and the diagnostic
Expand Down Expand Up @@ -346,7 +370,11 @@ def invoke_all_total_word_count_checks(
):
"""Perform the word count check and return the results."""
met_or_exceeded_count = False
met_or_exceeded_count, actual_count, actual_count_dictionary = entities.entity_greater_than_count_total(
(
met_or_exceeded_count,
actual_count,
actual_count_dictionary,
) = entities.entity_greater_than_count_total(
filecheck, directory, expected_count, count_function, exact
)
met_or_exceeded_count = util.greater_than_equal_exacted(
Expand Down Expand Up @@ -431,7 +459,11 @@ def invoke_all_fragment_checks(
):
"""Perform the check for a fragment existence in file or contents and return the results."""
met_or_exceeded_count = 0
met_or_exceeded_count, actual_count, actual_count_dictionary = fragments.specified_entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
actual_count_dictionary,
) = fragments.specified_entity_greater_than_count(
fragment,
fragments.count_specified_fragment,
expected_count,
Expand Down Expand Up @@ -526,7 +558,11 @@ def invoke_all_regex_checks(
):
"""Perform the check for a regex existence in file or contents and return the results."""
met_or_exceeded_count = 0
met_or_exceeded_count, actual_count, actual_count_dictionary = fragments.specified_entity_greater_than_count(
(
met_or_exceeded_count,
actual_count,
actual_count_dictionary,
) = fragments.specified_entity_greater_than_count(
regex,
fragments.count_specified_regex,
expected_count,
Expand Down Expand Up @@ -693,9 +729,9 @@ def invoke_all_markdown_checks(
# perform the count, saving the details in a way that preserves information if the
# filecheck was given as a wildcard (i.e., "*.py")
(
met_or_exceeded_count,
actual_count,
), count_dictionary = markdown.specified_tag_greater_than_count(
(met_or_exceeded_count, actual_count,),
count_dictionary,
) = markdown.specified_tag_greater_than_count(
markdown_tag,
markdown.count_specified_tag,
expected_count,
Expand Down Expand Up @@ -759,9 +795,9 @@ def invoke_all_count_checks(
"""Perform the check for the count of lines in file or contents and return the results."""
met_or_exceeded_count = 0
(
met_or_exceeded_count,
actual_count,
), actual_count_dictionary = fragments.specified_source_greater_than_count(
(met_or_exceeded_count, actual_count,),
actual_count_dictionary,
) = fragments.specified_source_greater_than_count(
expected_count, filecheck, directory, contents, exact
)
# create a message for a file in directory
Expand Down
2 changes: 1 addition & 1 deletion tests/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_check_extraction_from_commandline_arguments_has_help_single_checker():


def test_check_extraction_from_commandline_arguments_has_help_two_checkers_one_invalid(
tmpdir
tmpdir,
):
"""Ensure that checker finding and help extraction works for a provided checker."""
testargs = [os.getcwd()]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_garbage_glob_ext_returns_no_matching_paths(tmpdir):


def test_garbage_glob_file_returns_no_matching_paths_more_garbage_markdown_names(
tmpdir
tmpdir,
):
"""Ensure that creating a garbage globbed path returns no matches."""
hello_file_one = tmpdir.join("hello1.txt")
Expand Down
78 changes: 39 additions & 39 deletions tests/test_fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,15 @@ def test_count_single_line_from_file_with_threshold(tmpdir):
directory = tmpdir.dirname + "/" + tmpdir.basename + "/" + "subdirectory"
hello_file = "Hello.java"
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is False

Expand All @@ -571,28 +571,28 @@ def test_count_single_line_from_file_with_threshold_and_wildcards(tmpdir):
directory = tmpdir.dirname + "/" + tmpdir.basename + "/" + "subdirectory"
hello_file = "*.java"
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is False
hello_file = "*.*"
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
assert actual_count == 1
assert exceeds_threshold[0] is False

Expand All @@ -606,9 +606,9 @@ def test_count_no_line_from_incorrect_file(tmpdir):
directory = tmpdir.dirname + "/" + tmpdir.basename + "/" + "subdirectory"
hello_file = "#$#@ll*.java&&@@@"
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(1, hello_file, directory, "")
assert actual_count == 0
assert exceeds_threshold[0] is False

Expand Down Expand Up @@ -636,21 +636,21 @@ def test_count_multiple_lines_from_file_with_threshold(tmpdir):
directory = tmpdir.dirname + "/" + tmpdir.basename + "/" + "subdirectory"
hello_file = "Hello.java"
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(2, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(2, hello_file, directory, "")
assert actual_count == 3
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(3, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(3, hello_file, directory, "")
assert actual_count == 3
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(100, hello_file, directory, "")
assert actual_count == 3
assert exceeds_threshold[0] is False

Expand Down Expand Up @@ -688,21 +688,21 @@ def test_count_multiple_lines_from_contents_with_threshold():
'/* hello world */\nString s = new String("hello");\n//this is a comment'
)
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(2, "", "", hello_contents)
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(2, "", "", hello_contents)
assert actual_count == 3
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(3, "", "", hello_contents)
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(3, "", "", hello_contents)
assert actual_count == 3
assert exceeds_threshold[0] is True
(
exceeds_threshold,
actual_count,
), _ = fragments.specified_source_greater_than_count(100, "", "", hello_contents)
(exceeds_threshold, actual_count,),
_,
) = fragments.specified_source_greater_than_count(100, "", "", hello_contents)
assert actual_count == 3
assert exceeds_threshold[0] is False

Expand Down
Loading

0 comments on commit e299b93

Please sign in to comment.