defi-wonderland / natspec-smells

👃Automatically identify missing or incomplete natspec
MIT License
91 stars 7 forks source link

Couldn't find @openzeppelin/contracts/... #24

Closed magnetto90 closed 5 months ago

magnetto90 commented 5 months ago

When executing the tool I am getting the following error msg.

❯ yarn natspec-smells
yarn run v1.22.19
$ /home/whitehat/project/node_modules/.bin/natspec-smells
CompileInferenceError: Couldn't find @openzeppelin/contracts/utils/math/SignedMath.sol
    at findAllFiles (/home/whitehat/project/node_modules/solc-typed-ast/dist/compile/inference/imports.js:113:23)
    at async compileSol (/home/whitehat/project/node_modules/solc-typed-ast/dist/compile/utils.js:160:9)
    at async getProjectCompiledSources (/home/whitehat/project/node_modules/@defi-wonderland/natspec-smells/lib/utils.js:29:27)
    at async /home/whitehat/project/node_modules/@defi-wonderland/natspec-smells/lib/main.js:16:25

I am also especifing the remappings inside foundry.toml

remappings = [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@chainlink/=lib/chainlink/",
    "v3-core/=lib/v3-core/contracts/"
]
gas1cent commented 5 months ago

@magnetto90 any chance we can see the code and try to reproduce the issue?

magnetto90 commented 5 months ago

@magnetto90 any chance we can see the code and try to reproduce the issue?

@gas1cent sure, I am working in this project/tree

gas1cent commented 5 months ago

@magnetto90 thanks! Try to put this into a remappings.txt file and let me know if it helps:

@openzeppelin/=lib/openzeppelin-contracts/
@chainlink/=lib/chainlink/
v3-core/=lib/v3-core/contracts/

The issue is essentially due to the tool looking for remappings in the wrong place. We will fix that asap.

magnetto90 commented 5 months ago

@gas1cent Works! Some feedback...

  1. Consider that latest version of foundry doesn´t need remappings.txt or even any config for common libraries such as OZ or Solady.
  2. In my case the extension of the result of running the tool, since we weren't using natspec, is too long, maybe is a good idea to add an output file option in the config file.
gas1cent commented 5 months ago

Appreciate the feedback 👍🏻 I'm closing this issue since it's resolved, but feel free to open a new one if you find something else.