juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
904 stars 194 forks source link

Add support for .soliumignore #76

Open aleybovich opened 6 years ago

aleybovich commented 6 years ago

I want to ignore one of the sol files in my project (autogenerated flat file generated by truffle-flattener) and currently, there is no way to do that as adding .soliumignore seems to have no effect. Is there any way you could add support for it?

juanfranblanco commented 6 years ago

What is exactly the use case? As solium ignore will be very specific to solium.

aleybovich commented 6 years ago

Your plugin supports solium and solhint, right? For ignoring files Solium uses .soliumignore and Solhint uses .solhintignore. Can you make sure that if one of those files (depending on what i configure as solidity linter in VS Code) is present in the project, it will be respected?

A use case would be ignoring an autogenerated solidity file generated by truffle-flattener. This file causes lots of lint errors (indentation is 2 spaces in truffle libraries vs 4 spaces in my code, which is default for linters) and I want this file to be ignored when running the linter as a build step.

juanfranblanco commented 6 years ago

Ok, so your use case is only for linting nothing else, correct? That was my question, and I guess you have answered it :)

aleybovich commented 6 years ago

My use case is for both linting in the console (manually running a linter on the project) and error display in VS Code (I don't want to see lint errors in the excluded sol file when I open it).

crisgarner commented 6 years ago

Another use case would be to ignore the solidity tests of truffle. Currently the imports:

import "truffle/DeployedAddresses.sol";
import "truffle/Assert.sol";

Shows the error "Source not found", from what I understand these files are created on runtime, so the compiler shows the error.

Even thought, for this error in particular with truffle, support for Solium Comment Directives to ignore specific pieces of code would be a better approach. An example from the Solium documentation:

contract Foo {
    /* solium-disable-next-line */
    function() {
        bytes32 bar = 'Hello world';    // solium-disable-line quotes

        // solium-disable-next-line security/no-throw, indentation
                        throw;
    }
}
aleybovich commented 6 years ago

@crisgarner - have you actually tried using solium comment directives? I've been using them to hide warnings for things like online assembly and that works well. Haven't tried them for unresolved dependencies though.

crisgarner commented 6 years ago

@aleybovich Yeah. Tried also copy pasting the example code in contract with no success.