solhint

quotes

Recommended Badge Category Badge Default Severity Badge error

The {“extends”: “solhint:recommended”} property in a configuration file enables this rule.

Description

Enforces the use of double or simple quotes as configured for string literals. Values must be ‘single’ or ‘double’.

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of “error”, “warn”, “off”. error
1 Type of quotes. Must be one of “single”, “double” double

Example Config

{
  "rules": {
    "quotes": ["error","double"]
  }
}

Notes

Examples

👍 Examples of correct code for this rule

Configured with double quotes


      pragma solidity 0.4.4;
        
        
      contract A {
        string private a = "test";
      }
    

Configured with single quotes


      pragma solidity 0.4.4;
        
        
      contract A {
        string private a = 'test';
      }
    

Configured with double quotes

string private constant STR = "You shall 'pass' !";

Configured with single quotes

string private constant STR = 'You shall "pass" !';

👎 Examples of incorrect code for this rule

Configured with single quotes


      pragma solidity 0.4.4;
        
        
      contract A {
        string private a = "test";
      }
    

Configured with double quotes


      pragma solidity 0.4.4;
        
        
      contract A {
        string private a = 'test';
      }
    

Version

This rule was introduced in Solhint 1.4.0

Resources