-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix: double import issue #58
base: main
Are you sure you want to change the base?
Conversation
}); | ||
it('should replace path as instructed by remapping with all import syntaxes', function () { | ||
const fileContent = ` | ||
import '../../../interfaces/ITest.sol'; |
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 might be wrong here, but I don't think remappings work this way. If your remapping key is interfaces
, ../../../interfaces
should not be affected, only when it starts with interfaces/
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.
👀 will check
import '../../../interfaces/ITest.sol'; | ||
import './someFile.sol'; | ||
`; | ||
import './Contract.sol'; |
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.
what do you think about adding something that should be automatically modified in between these lines? Just to make sure our code is not skipping all the imports after seeing that the first one does not need any modification
No need to add a new test, we could do it in this one
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.
sure!
now that I think about it (related to your other comment) having multiple imports in a single line will probably break as well (but we could actually make that work without properly parsing the code). Will add a test for that too!
expect(transformedContent).to.include(`contract C {}`); | ||
}); | ||
|
||
it.skip('should not have false positives choosing imports', () => { |
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 is this test being skipped? we are not able to know if we are talking about code or comment?
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.
we are not, since we don't reuse an existing lexer+parser, and only do regular-style modifications to the code. For most cases it is sufficient though, and single-line comments are skipped since we match \s*import
to detect imports
Also, its worth noting that the impact of modifying comments when we shouldn't is very low considering multi-line natspec is required to have a leading *
which would not match the regex above
No description provided.