-
Notifications
You must be signed in to change notification settings - Fork 73
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
Contract Definition comments #172
Conversation
Codecov Report
@@ Coverage Diff @@
## master #172 +/- ##
==========================================
+ Coverage 99.68% 99.70% +0.02%
==========================================
Files 79 84 +5
Lines 628 677 +49
Branches 104 115 +11
==========================================
+ Hits 626 675 +49
Misses 2 2
Continue to review full report at Codecov.
|
.gitignore
Outdated
@@ -62,6 +62,4 @@ typings/ | |||
|
|||
.DS_Store | |||
|
|||
package-lock.json |
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.
not sure if I like this idea, we may want to instruct travis to use the proper eslint version perhaps
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.
There's no rush for this PR so I'll see if after a rebase there is some improvement.
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.
I rebased the branch to the latest release with the updated dependencies and the travis uses the right eslint
without needing package-lock.json
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.
@mattiaerre I'm curious, why don't you like this idea? AFAIK versioning the package-lock.json
or yarn.lock
is a pretty standard practice.
@@ -1,6 +1,6 @@ | |||
// eslint-disable-next-line no-unused-vars | |||
function clean(ast, newObj, parent) { | |||
['code', 'codeStart', 'loc', 'range'].forEach(name => { | |||
['code', 'codeStart', 'loc', 'range', 'raw'].forEach(name => { |
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.
even here, not sure if this is how we should be dealing w/ this
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.
in my opinion, comments shouldn't even be in AST comparison.
Prettier throws an exception already if we failed to print a comment.
const { handleComments } = require('./prettier-comments'); | ||
// const { handleComments } = require('./prettier-comments'); | ||
// const printComment = require('./comments/printer'); | ||
const { handleComments, printComment } = require('./comments'); |
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.
uhm interesting
* @dev Tells the address of the implementation where every call will be delegated. | ||
* @return address of the implementation to which it will be delegated | ||
*/ | ||
* @dev Tells the address of the implementation where every call will be delegated. |
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.
I like this 👍
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.
me too. maybe I could split this PR into
- fixing comment indentation.
- Contract Definition edge cases
549bdaa
to
f910da2
Compare
@Janther What is this PR missing? Can I help somehow? |
@fvictorio sorry for the wait, actually I'm happy with the PR but I'm open to improvements/suggestions to be made to it. As stated in #181 the parser will begin including natspec comments from version |
can you resolve the conflicts here too @Janther ? thanks |
Looking forward to this PR being merged! This is really important to my project :) & thanks for your work! |
f910da2
to
707659e
Compare
I'd be inclined to merge this PR; shall we add more tests around it so that the code coverage will not drop too much? |
…fferent leading whitespace.
707659e
to
fb9d154
Compare
Conflicts resolved, not sure why codecov is still angry, basically the only 2 lines that are not covered are the exception when there's no printer for this node (the parser had an update) or there's no printer for this comment (extract comments had an update). please have a look @mattiaerre @fvictorio |
the problem here is that we've removed actually I am not entirely sure about this ^^ 🤔 let me spend some more time on this |
I'm OK with merging this. |
Hey everyone, Jerrod from @codecov here. Love the high coverage / testing approach you've taken. Quick note: The check that is failing is If there is a specific test that isn't covering that you think should be, have you checked the underlying coverage report to see if the line is covered out of your CI? |
Hi @jerrode, thanks for the help! @Janther @mattiaerre Apparently the uncovered bit is in |
thanks so much for pointing that out @jerrode that's awesome. so you are suggesting @fvictorio that we can just merge this as is? I'm fine w/ that |
It's up to @Janther, but yes, I'm ok with merging this. |
I’m happy to merge, I know what’s not being covered, I just don’t know why codecov is that angry hehe |
Can’t merge from my phone though |
fixes #162
in this PR there are 2 new features.
BlockComment
s is now aligned with the indentation of the subject of that comment.input
output won't even print currently.
after this PR
Scenarios, where we were depending on prettier to guess where the comment should go, are now addressed.
input:
Output:
After this PR:
To address the Contract Definition edge cases I created the following functions
solidityHandleOwnLineComment
,solidityHandleEndOfLineComment
, andsolidityHandleRemainingComment
, these functions try to match the comments with Solidity's cases first and if no match was found, they call the javascript comment handler respectively.My idea is to bring add Solidity's edge cases in this folder. and even redoing the javascript handlers in a way that makes sense with Solidity's AST.
With time we will rely less on the javascript
handlers
while fully using theutils
.Finally I had to add the
package-lock.json
because Travis kept installing the wrong eslint and failing to run the linting.