Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Improve binary rules #379

Merged
merged 10 commits into from
May 18, 2014
Merged

Improve binary rules #379

merged 10 commits into from
May 18, 2014

Conversation

markelog
Copy link
Member

Binary rules now support and has tests for all binary operators. Some of those tests are dynamically generated, but write them explicitly is tedious and needless.

After that we need to update presets, remove doc for *stickedOperators rules and update the docs, then i think we would be ready for 1.5.

Do not return undefined return null instead,
aligned with other token helper methods
This method will be helpful in future commits, meanwhile use it internally
Add optional backward argument and change default direction
@mikesherov
Copy link
Contributor

💯

it('should report assignment operator for "a=b"', function() {
checker.configure({ requireSpaceBeforeBinaryOperators: ['='] });
assert(checker.checkString('a=b').getErrorCount() === 1);
});
it('should not report assignment operator for "a = b" without option', function() {
checker.configure({ requireSpaceBeforeBinaryOperators: [','] });
assert(checker.checkString('a= b').isEmpty());
assert(checker.checkString('a=b').isEmpty());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to match the description

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you!

Add support and tests for all binary operators
Add support and tests for all binary operators
Add support and tests for all binary operators
Add support and tests for all binary operators
Add getPointerEntities method to token helper module, right now
used only inside binary rules
@markelog
Copy link
Member Author

After that we need to update presets, remove doc for *stickedOperators rules and update the docs, then i think we would be ready for 1.5.

@gustavohenke heads up, i think we could do 0.5.0 release, since these updates could generate new errors if users use ~ as version package number for grunt-jscs-checker, i remember about jscs-dev/grunt-jscs#20, but now i having doubts about it, what do you think?

@mikesherov
Copy link
Contributor

Just a thought for this rule and other rules that have "giant arrays as values". Perhaps we should provide the true option which just sets them all, like I did for the conditional expression check? @markelog thoughts?

@markelog
Copy link
Member Author

thoughts?

+1

* Add binaryOperators attribute to utils module

* Add true value as possible value to binary rules

* Add one more test for binary rules to check true value

* Update readme
@markelog
Copy link
Member Author

@mikesherov done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants