-
Notifications
You must be signed in to change notification settings - Fork 581
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
DartLintBear: check settings validity #950
DartLintBear: check settings validity #950
Conversation
Thanks for your contribution! Reviewing pull requests take really a lot of time and we're all volunteers. Please make sure you go through the following check list and complete them all before pinging someone for a review.
As you learn things over your Pull Request please help others on the chat and on PRs to get their stuff right as well! |
apparently this fails because it is not rebased, and does not contain the changes you fixed in the other branch. could you rebase it and i think all will pass :D ? thanks! |
Yeah, will do this tomorrow... My stupid hotel only allows HTTP(S) traffic =( |
|
||
# use_spaces must be True and indent_size must be 2 because | ||
# dartanalyzer only supports these settings | ||
# see https://github.com/dart-lang/dart_style/issues/261 |
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.
Thank you for putting the link here ! Really appreciated :)
section.append(Setting('use_spaces', False)) | ||
bear = DartLintBear(section, Queue()) | ||
|
||
with pytest.raises(AssertionError): |
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.
Why not use unittest's assertRaises ? https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertRaises
It has the same functionality (The reason I mention is because it's nicer to use the builtin unittest as much as possible)
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.
Well, since py.test is used as a test runner, I thought it best to use it directly as much as possible. But if it serves the uniformity of the code base, I'll change it ;)
@@ -30,3 +37,23 @@ | |||
valid_files=(good_file,), | |||
invalid_files=(bad_file,), | |||
tempfile_kwargs={"suffix": ".dart"}) | |||
|
|||
|
|||
@skipIf(which('dartanalyzer') is None, 'dartanalyzer is not installed') |
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.
Don't write your custom check please !
Use the skip generator for the bear ? https://github.com/coala/coala-bears/blob/master/tests/BearTestHelper.py#L4
@AbdealiJK Thanks for the review! I made the requested changes. |
# see https://github.com/dart-lang/dart_style/issues/261 | ||
if (indent_size != 2 or not use_spaces): | ||
raise ValueError( | ||
"dartanazlyer only supports use_space=True and indent_size=2") |
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.
typo: dartanalyzer here :)
# see https://github.com/dart-lang/dart_style/issues/261 | ||
if (indent_size != 2 or not use_spaces): | ||
raise ValueError( | ||
"dartanazlyer only supports use_space=True and indent_size=2") |
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.
also, an user probably doesnt know what dartanalyzer is, as we are wrapping it into a bear, im not 100% percent, but maybe we should say:
DartLintBear only supports.. ? what do you think?
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.
Yes!
bear = DartLintBear(section, Queue()) | ||
|
||
with self.assertRaises(AssertionError): | ||
self.check_validity(bear, [], good_file) |
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.
this tests are actually nice work :)
@NiklasMM Nearly there. Just a few minor things and a rebase |
# see https://github.com/dart-lang/dart_style/issues/261 | ||
if (indent_size != 2 or not use_spaces): | ||
raise ValueError( | ||
"DartLintBear only supports use_space=True and indent_size=2") |
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.
use_space -> use_spaces, I'd also put the "ini extracts" in backticks
As pointed out here dart-lang/dart_style#261, dartanalyzer only supports indentation using 2 spaces. This commit changes DartLintBear to check that ``use_spaces`` is True and ``indent_size`` is 2 and raises a ``ValueError`` if not. Fixes #897
907b477 is ready |
@rultor merge |
Hey, this is your first contribution, right? Congrats and welcome to the coalaians! :) You can help us a lot by filling out http://coala.io/newform! Rultor will now automatically release your changes as a prerelease so users can experience the goodness of your changes right now. See also https://github.com/coala-analyzer/coala/wiki/coala-Steam-Offer btw. We would really appreciate it if you could help us with
We're all volunteers and we're currently struggling to keep this up. Helping all those newcomers is a lot of work and we do need your help so we can continue this for others! |
As pointed out here dart-lang/dart_style#261
dartanalyzer only supports indentation using 2 spaces. This commit
changes DartLintBear to check that use_spaces is True and
indent_size is 2 and raises a ValueError if not.
Fixes #897