-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New configuration option - Allowing "pylint:" commments #973
Merged
Merged
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
67b7523
Release v2.6.2! (#957)
david-yz-liu 80e65c6
Merge branch 'master' of https://github.com/pyta-uoft/pyta
AinaMerch 516d40f
changes so far
AinaMerch 16cac58
Trying something
AinaMerch a6d76e4
Middle
AinaMerch a34d029
Merge branch 'master' of https://github.com/pyta-uoft/pyta into new-c…
AinaMerch 59678fe
Please work
AinaMerch cdc7964
Testcase
AinaMerch 3ba6091
testcase draft
AinaMerch 7b70934
tests
AinaMerch b4612db
Merge branch 'master' of https://github.com/pyta-uoft/pyta into new-c…
AinaMerch 36475f2
changes after pull request review
AinaMerch 865ee7a
Modification to docs
AinaMerch b698282
Merge branch 'master' of https://github.com/pyta-uoft/pyta into new-c…
AinaMerch 872a2b6
Revised based on review (except test cases)
AinaMerch ad1726d
Merge branch 'master' of https://github.com/pyta-uoft/pyta into new-c…
AinaMerch 955f467
added tests
AinaMerch 33dc11f
Fixed merge conflicts
AinaMerch 6d8e235
final changes
AinaMerch fbc8f1b
deleted files
AinaMerch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def some_function(): | ||
david-yz-liu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
x = 5 # pylint: disable something | ||
y = 0 | ||
result = x / y | ||
return result | ||
|
||
|
||
a = 10 | ||
b = 20 | ||
if __name__ == "__main__": | ||
import python_ta | ||
|
||
options = {"allow-pylint-comments": False} | ||
python_ta.check_all(config=options) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
def some_function(): | ||
x = 5 # pylint: disable something | ||
y = 0 | ||
result = x / y | ||
return result | ||
|
||
|
||
a = 10 | ||
b = 20 | ||
if __name__ == "__main__": | ||
import python_ta | ||
|
||
options = {"allow-pylint-comments": True} | ||
python_ta.check_all(config=options) |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
""" | ||
import json | ||
import os | ||
from unittest.mock import mock_open, patch | ||
|
||
import pytest | ||
|
||
|
@@ -226,3 +227,23 @@ def test_config_parse_error_has_no_snippet() -> None: | |
snippet = reporter.messages[config][0].snippet | ||
|
||
assert snippet == "" | ||
|
||
|
||
def test_allow_pylint_comments() -> None: | ||
"""Test that checks whether the allow-pylint-comments configuration option works as expected when it is | ||
set to True""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, make sure the ending |
||
|
||
with patch("python_ta.tokenize.open", mock_open(read_data="# pylint: disable")): | ||
result = python_ta._verify_pre_check("", allow_pylint_comments=True) | ||
|
||
assert result is True | ||
|
||
|
||
def test_disallows_pylint_comments() -> None: | ||
"""Test that checks whether the allow-pylint-comments configuration option works as expected when it is | ||
is set to False""" | ||
|
||
with patch("python_ta.tokenize.open", mock_open(read_data="# pylint: disable")): | ||
result = python_ta._verify_pre_check("", allow_pylint_comments=False) | ||
|
||
assert result is False |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the ending
"""
on a new line (this is the style we use when there's a multi-line docstring)