Skip to content

Conversation

@mgol
Copy link
Member

@mgol mgol commented Dec 4, 2016

Summary

The code replacing @code in wrapper.js was written so that it expected
both the code and the next line to start in the first column. This commit
adjusts the regex so to get rid of that assumption and to work properly
regardless of number of lines with comments after this block.

While this is technically not necessary for our code, contributors sometimes
re-format the wrapper file in their pull requests and the error
messages they get don't tell them what's the real problem with their code.

Checklist

Mark an [x] for completed items, if you're not sure leave them unchecked and we can assist.

Thanks! Bots and humans will be around shortly to check it out.

@mention-bot
Copy link

@mgol, thanks for your PR! By analyzing the history of the files in this pull request, we identified @timmywil, @markelog and @gibson042 to be potential reviewers.

return grunt.file.read( srcFolder + fileName );
},
wrapper = read( "wrapper.js" ).split( /\/\/ \@CODE\n\/\/[^\n]+/ ),
wrapper = read( "wrapper.js" ).split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ ),
Copy link
Member

Choose a reason for hiding this comment

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

I like the generalization, but this now looks sufficiently complex to warrant a comment.

The code replacing @code in wrapper.js was written so that it expected
both the code and the next line to start in the first column. This commit
adjusts the regex so to get rid of that assumption and to work properly
regardless of number of lines with comments after this block.

While this is technically not necessary for our code, contributors sometimes
re-format the wrapper file in their pull requests and the error
messages they get don't tell them what's the real problem with their code.
wrapper = read( "wrapper.js" ).split( /\/\/ \@CODE\n\/\/[^\n]+/ ),

// Catch `// @CODE` and subsequent comment lines event if they don't start
// in the first 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.

@gibson042 Is that enough or would you like sth more?

@gibson042
Copy link
Member

LGTM.

@mgol mgol closed this in 4e50967 Dec 5, 2016
@mgol mgol deleted the wrapper-relax branch December 5, 2016 17:53
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants