question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"no-unused-vars" rule false positive in inherited contracts

See original GitHub issue

I get an [ERROR] At line: x, column: y -> Variable 'someAddress' is declared but never used. in the scenario below, in which the variable is used in contracts inheriting from the base but not in the base contract itself.

contract IMyContract {

  address public someAddress;

  function myFunction(address someVariable);
}

import 'IMyContract.sol';
contract MyContract is IMyContract {
  function someOtherFunction(address X)
  {
    someAddress = X;
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
duaraghav8commented, Nov 5, 2017

this issue no longer persists since solium does not check state variables for usage any more. feel free to re-open in case you face this (or something similar).

1reaction
duaraghav8commented, Aug 24, 2016

Ahh! When I test the whole code in a single file, it doesn’t pose any errors.

You must’ve declared IMyContract in 1 file, and MyContract in another. At a time, Solium lints only a single file, so it is not informed whether you are using the variable in some other file or not.

This needs fixing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript-eslint/no-unused-vars false positive in type ...
Question: What's wrong with this rule and why it triggers in this case. Why eslint recognizes type declaration for functions in types/interfaces ...
Read more >
arXiv:1802.06038v2 [cs.CR] 14 Mar 2018
is determined as true or false positive, but the contract state on main blockchain is not affected since no changes.
Read more >
Code Issues - Embold Help Center
DoNotHideInheritedMembers, On hiding an inherited member, the derived version of the ... If that is the case, the reported instance is a false...
Read more >
Diff - 402e1b6e55e9041dfd1a93580e45e5c5dba1db55^!
Unless required by applicable law or + agreed to in writing, ... 2016 + +* 27700cf Fix: `no-unused-vars` false positive around callback ...
Read more >
Why and How JavaScript Developers Use Linters
3.4 False Positives in Static Analysis Tools . ... mentioned the importance of the rule no-unused-vars (identifies variables that have been.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found