Warning about unused imports
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
Currently, the compiler issues a warning for an unused function parameter. I think it would be a good idea to do the same for unused imports in order to improve the quality and cleanliness of the code.
### Example
```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
/// @dev This import is unused. The compiler should issue a warning.
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract MockContract {
function hashFunction() external pure returns (bytes32) {
return keccak256("Hello World");
}
}
```
Contributor guide
Research direction
Start by tracing the compiler path that emits warnings for unused function parameters, then inspect how imports are represented and checked. Use the Solidity example in the issue as the initial case and add or update compiler tests for an unused import. Done means the example produces an unused-import warning without warning for a used import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100