Skip to content
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 rule: requireHyphenBeforeDescription #52

Merged
merged 2 commits into from
Nov 18, 2014

Conversation

hzoo
Copy link
Member

@hzoo hzoo commented Nov 18, 2014

#50

This might need some more tests?

I'm assuming most people want the space so its like - description not -description

so it works like if (tag.description.substring(0, 2) !== '- ') {

}

if (tag.description.substring(0, 2) !== '- ') {
err('Missing hyphen before description', tag.name.loc.column);
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about the location for the error.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like there are no location for description property ;-( Probably better to left here tag.loc for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't look jscs has any way of testing the position of the error pointer right now? Since all of our tests in jscs and here are checking if error = 0 or 1.

Copy link
Member

Choose a reason for hiding this comment

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

Can you check location? Something tells me that column should be passed as third parameter and easier to pass here .loc property

Copy link
Member

Choose a reason for hiding this comment

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

This test checking location.

@hzoo hzoo force-pushed the require-hyphen-before-@param-description branch from b4ee9f5 to e9346f0 Compare November 18, 2014 01:50
}).to.throws(/accepted value/i);
});

it('with undefined should throws', function() {
Copy link
Member

Choose a reason for hiding this comment

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

test with object named with undefined ;-\

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha I copied it from the other ones - I think we need to change it for a lot of them. Only leading-underscore-access.js says it('with object should throws'.

Maybe reword all to - should throw with an object and should throw with undefined.

Copy link
Member

Choose a reason for hiding this comment

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

@hzoo Agreed. I'm not native english speaker so If you find some mistakes feel free to fix that. This project need a lot of rules to systemize and formalize generic jsdoc stylistic requirements so any ideas are welcome. It needs meat ;-D

Btw. Fix them all here if you can with separated commits, it would be great

I think about configured word in describe. Probably it also should be changed

Copy link
Member

Choose a reason for hiding this comment

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

Maybe change configured to should throws, and in it blocks left cases: with undefined, with object, and so on?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah the test cases in jscs itself probably aren't completely consistent but I see a lot of should report on and the describe usually the value of the option like true

Copy link
Member

Choose a reason for hiding this comment

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

Totally agreed, it would be much better to have describe('should VERB', ... it('VALUE', ... instead of ...configured...with VALUE should VERB

Copy link
Member

Choose a reason for hiding this comment

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

I'll fix later other tests and will put this note to CONTRIBUTION.md

@qfox
Copy link
Member

qfox commented Nov 18, 2014

Nice work. ;-D

@hzoo hzoo force-pushed the require-hyphen-before-@param-description branch from e9346f0 to e317b03 Compare November 18, 2014 02:31
@hzoo
Copy link
Member Author

hzoo commented Nov 18, 2014

Changed the wording for all the tests in rules and also used report instead of throw

@qfox
Copy link
Member

qfox commented Nov 18, 2014

Thanks! Merging?

@hzoo
Copy link
Member Author

hzoo commented Nov 18, 2014

Yea sounds good. I wonder if jscs could let you check style for stuff like parameter names, and test case strings so it has the same format.

@hzoo
Copy link
Member Author

hzoo commented Nov 18, 2014

Oh - I didn't change the readme yet - just remembered..

qfox added a commit that referenced this pull request Nov 18, 2014
…tion

new rule: requireHyphenBeforeDescription
@qfox qfox merged commit 2caffd5 into jscs-dev:master Nov 18, 2014
@qfox
Copy link
Member

qfox commented Nov 18, 2014

Nice catch! I'll wait for README changes before publishing new version.

Btw, jscs has deprecated rule validateJSDoc. The rule that moved to this tiny project ;-)

@hzoo
Copy link
Member Author

hzoo commented Nov 18, 2014

Oh yeah I just meant whether it made sense to make a new rule to check for the correct naming like describe('should VERB', ... it('VALUE', ... in jscs-jsdoc

@qfox
Copy link
Member

qfox commented Nov 18, 2014

@hzoo Oh, probably jscs-jsdoc is not a place for checking these things, it's generally about doc comments. But it's a nice idea at all. I think will be better to make another plugin for that like jscs-tests-spelling or something ;-) It would be great to have autotested formatted tests ;-D

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

Successfully merging this pull request may close these issues.

None yet

2 participants