Skip to content

Latest commit

 

History

History
113 lines (73 loc) · 2.54 KB

quotes.md

File metadata and controls

113 lines (73 loc) · 2.54 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
quotes | 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

  • This rule allows to put a double quote inside single quote string and viceversa

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