ZeppelinSolutions / solium-plugin-zeppelin

[DEPRECATED] Solium plugin for Zeppelin audits
MIT License
17 stars 10 forks source link

Fails when analyzing a directory #17

Closed facuspagnuolo closed 6 years ago

facuspagnuolo commented 6 years ago

I tried running solium using this plugin within zeppelin-solidity and I get:

✖ [Fatal error] An error occurred while linting over .../zeppelin-solidity/contracts/Bounty.sol: ENOENT: no such file or directory, open './payment/PullPayment.sol'

Steps to reproduce

  1. git clone git@github.com:OpenZeppelin/zeppelin-solidity.git
  2. git clone git@github.com:elopio/solium-plugin-zeppelin.git
  3. npm install -g solium
  4. cd solium-plugin-zeppelin
  5. npm install --dev
  6. npm link
  7. npm link solium-plugin-zeppelin
  8. cd ../zeppelin-solidity
  9. vim .soliumrc.json (replace file's content with the one bellow)
  10. solium -d contracts

Configuration file

{
  "extends": "solium:all",
  "plugins": ["security","zeppelin"],
  "rules": {
    "quotes": ["error", "double"],
    "indentation": ["error", 2],
    "arg-overflow": ["warning", 3],
    "security/enforce-explicit-visibility": ["error"],
    "security/no-block-members": ["warning"],
    "security/no-inline-assembly": ["warning"],
    "zeppelin/constant-candidates": ["warning"],
    "zeppelin/highlight-comments": ["warning"],
    "zeppelin/missing-natspec-comments": ["warning"],
    "zeppelin/no-arithmetic-operations": ["warning"],
    "zeppelin/no-state-variable-shadowing": ["warning"],
    "zeppelin/no-unchecked-send": ["warning"],
    "zeppelin/no-unused-imports": ["warning"]
  }
}
duaraghav8 commented 6 years ago

The error is originating from https://github.com/elopio/solium-plugin-zeppelin/blob/master/rules/no-unused-imports.js#L35 (no-unused-import rule) @elopio The value of node.from seems to be ./payment/PullPayment.sol - is this what you were expecting?

come-maiz commented 6 years ago

@duaraghav8 we are assuming that the imported path is relative the directory where the solium is being executed. We should use instead a path relative to the directory that contains the file being parsed.