prettier-plugin-solidity 1.0.0-beta.20 → 1.0.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -13
- package/package.json +12 -12
- package/prettier-plugin-solidity-1.0.0-beta.19.tgz +0 -0
- package/src/binary-operator-printers/index.js +1 -1
- package/src/nodes/Continue.js +5 -0
- package/src/nodes/FunctionCall.js +17 -14
- package/src/nodes/InlineAssemblyStatement.js +17 -1
- package/src/nodes/ModifierDefinition.js +5 -3
- package/src/nodes/UsingForDeclaration.js +19 -3
- package/src/nodes/index.js +2 -2
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -23
- package/.github/workflows/CI.yml +0 -83
- package/Foo.sol +0 -404
- package/assets/telegram-badge.svg +0 -29
- package/scripts/generateIndexes.js +0 -16
- package/scripts/makeData.js +0 -23
- package/src/nodes/TypeNameExpression.js +0 -5
- package/tests/config/.prettierrc +0 -5
- package/tests/config/format-test.js +0 -458
- package/tests/config/require-prettier.js +0 -5
- package/tests/config/require-standalone.js +0 -25
- package/tests/config/setup.js +0 -7
- package/tests/config/utils/check-parsers.js +0 -207
- package/tests/config/utils/compile-contract.js +0 -36
- package/tests/config/utils/consistent-end-of-line.js +0 -13
- package/tests/config/utils/create-snapshot.js +0 -98
- package/tests/config/utils/stringify-options-for-title.js +0 -15
- package/tests/config/utils/visualize-end-of-line.js +0 -18
- package/tests/config/utils/visualize-range.js +0 -40
- package/tests/format/AddressPayable/AddressPayable.sol +0 -10
- package/tests/format/AddressPayable/__snapshots__/jsfmt.spec.js.snap +0 -37
- package/tests/format/AddressPayable/jsfmt.spec.js +0 -1
- package/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol +0 -533
- package/tests/format/AllSolidityFeatures/__snapshots__/jsfmt.spec.js.snap +0 -1146
- package/tests/format/AllSolidityFeatures/jsfmt.spec.js +0 -1
- package/tests/format/Arrays/Arrays.sol +0 -17
- package/tests/format/Arrays/__snapshots__/jsfmt.spec.js.snap +0 -63
- package/tests/format/Arrays/jsfmt.spec.js +0 -1
- package/tests/format/Assembly/Assembly.sol +0 -180
- package/tests/format/Assembly/__snapshots__/jsfmt.spec.js.snap +0 -406
- package/tests/format/Assembly/jsfmt.spec.js +0 -1
- package/tests/format/BasicIterator/BasicIterator.sol +0 -44
- package/tests/format/BasicIterator/__snapshots__/jsfmt.spec.js.snap +0 -102
- package/tests/format/BasicIterator/jsfmt.spec.js +0 -1
- package/tests/format/BinaryOperators/BinaryOperators.sol +0 -186
- package/tests/format/BinaryOperators/Parentheses.sol +0 -132
- package/tests/format/BinaryOperators/__snapshots__/jsfmt.spec.js.snap +0 -952
- package/tests/format/BinaryOperators/jsfmt.spec.js +0 -1
- package/tests/format/BreakingChangesV0.7.4/BreakingChangesV0.7.4.sol +0 -9
- package/tests/format/BreakingChangesV0.7.4/__snapshots__/jsfmt.spec.js.snap +0 -198
- package/tests/format/BreakingChangesV0.7.4/jsfmt.spec.js +0 -14
- package/tests/format/BreakingChangesV0.8.0/BreakingChangesV0.8.0.sol +0 -43
- package/tests/format/BreakingChangesV0.8.0/__snapshots__/jsfmt.spec.js.snap +0 -815
- package/tests/format/BreakingChangesV0.8.0/jsfmt.spec.js +0 -26
- package/tests/format/Comments/Comments.sol +0 -104
- package/tests/format/Comments/__snapshots__/jsfmt.spec.js.snap +0 -244
- package/tests/format/Comments/jsfmt.spec.js +0 -1
- package/tests/format/Conditional/Conditional.sol +0 -26
- package/tests/format/Conditional/__snapshots__/jsfmt.spec.js.snap +0 -80
- package/tests/format/Conditional/jsfmt.spec.js +0 -1
- package/tests/format/Constructors/Constructors.sol +0 -8
- package/tests/format/Constructors/__snapshots__/jsfmt.spec.js.snap +0 -54
- package/tests/format/Constructors/jsfmt.spec.js +0 -1
- package/tests/format/ContractDefinitions/ContractDefinitions.sol +0 -2
- package/tests/format/ContractDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -22
- package/tests/format/ContractDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/CustomErrors/CustomErrors.sol +0 -20
- package/tests/format/CustomErrors/__snapshots__/jsfmt.spec.js.snap +0 -50
- package/tests/format/CustomErrors/jsfmt.spec.js +0 -1
- package/tests/format/EnumDefinitions/EnumDefinitions.sol +0 -4
- package/tests/format/EnumDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -72
- package/tests/format/EnumDefinitions/jsfmt.spec.js +0 -2
- package/tests/format/Etc/Etc.sol +0 -48
- package/tests/format/Etc/__snapshots__/jsfmt.spec.js.snap +0 -134
- package/tests/format/Etc/jsfmt.spec.js +0 -1
- package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +0 -36
- package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +0 -258
- package/tests/format/ExplicitVariableTypes/jsfmt.spec.js +0 -9
- package/tests/format/ForStatements/ForStatements.sol +0 -43
- package/tests/format/ForStatements/__snapshots__/jsfmt.spec.js.snap +0 -108
- package/tests/format/ForStatements/jsfmt.spec.js +0 -1
- package/tests/format/FunctionCalls/FunctionCalls.sol +0 -40
- package/tests/format/FunctionCalls/__snapshots__/jsfmt.spec.js.snap +0 -310
- package/tests/format/FunctionCalls/jsfmt.spec.js +0 -2
- package/tests/format/FunctionDefinitions/FunctionDefinitions.sol +0 -169
- package/tests/format/FunctionDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -875
- package/tests/format/FunctionDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/HexLiteral/HexLiteral.sol +0 -7
- package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +0 -57
- package/tests/format/HexLiteral/jsfmt.spec.js +0 -8
- package/tests/format/IfStatements/IfStatements.sol +0 -112
- package/tests/format/IfStatements/__snapshots__/jsfmt.spec.js.snap +0 -534
- package/tests/format/IfStatements/jsfmt.spec.js +0 -1
- package/tests/format/Immutable/Immutable.sol +0 -20
- package/tests/format/Immutable/__snapshots__/jsfmt.spec.js.snap +0 -53
- package/tests/format/Immutable/jsfmt.spec.js +0 -1
- package/tests/format/ImportDirective/ImportDirectives.sol +0 -5
- package/tests/format/ImportDirective/__snapshots__/jsfmt.spec.js.snap +0 -46
- package/tests/format/ImportDirective/jsfmt.spec.js +0 -2
- package/tests/format/Inbox/Inbox.sol +0 -33
- package/tests/format/Inbox/__snapshots__/jsfmt.spec.js.snap +0 -79
- package/tests/format/Inbox/jsfmt.spec.js +0 -1
- package/tests/format/IndexOf/IndexOf.sol +0 -67
- package/tests/format/IndexOf/__snapshots__/jsfmt.spec.js.snap +0 -144
- package/tests/format/IndexOf/jsfmt.spec.js +0 -1
- package/tests/format/IndexRangeAccess/IndexRangeAccess.sol +0 -9
- package/tests/format/IndexRangeAccess/__snapshots__/jsfmt.spec.js.snap +0 -31
- package/tests/format/IndexRangeAccess/jsfmt.spec.js +0 -1
- package/tests/format/InheritanceSpecifier/InheritanceSpecifier.sol +0 -2
- package/tests/format/InheritanceSpecifier/__snapshots__/jsfmt.spec.js.snap +0 -24
- package/tests/format/InheritanceSpecifier/jsfmt.spec.js +0 -1
- package/tests/format/Issues/Issue205.sol +0 -12
- package/tests/format/Issues/Issue289.sol +0 -6
- package/tests/format/Issues/Issue355.sol +0 -12
- package/tests/format/Issues/Issue385.sol +0 -13
- package/tests/format/Issues/Issue564.sol +0 -9
- package/tests/format/Issues/__snapshots__/jsfmt.spec.js.snap +0 -174
- package/tests/format/Issues/jsfmt.spec.js +0 -1
- package/tests/format/MemberAccess/MemberAccess.sol +0 -102
- package/tests/format/MemberAccess/__snapshots__/jsfmt.spec.js.snap +0 -243
- package/tests/format/MemberAccess/jsfmt.spec.js +0 -1
- package/tests/format/ModifierDefinitions/ModifierDefinitions.sol +0 -6
- package/tests/format/ModifierDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -29
- package/tests/format/ModifierDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/ModifierInvocations/ModifierInvocations.sol +0 -17
- package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +0 -51
- package/tests/format/ModifierInvocations/jsfmt.spec.js +0 -1
- package/tests/format/MultipartStrings/MultipartStrings.sol +0 -10
- package/tests/format/MultipartStrings/__snapshots__/jsfmt.spec.js.snap +0 -39
- package/tests/format/MultipartStrings/jsfmt.spec.js +0 -1
- package/tests/format/NameValueExpression/NameValueExpression.sol +0 -6
- package/tests/format/NameValueExpression/__snapshots__/jsfmt.spec.js.snap +0 -68
- package/tests/format/NameValueExpression/jsfmt.spec.js +0 -2
- package/tests/format/Ownable/Ownable.sol +0 -75
- package/tests/format/Ownable/__snapshots__/jsfmt.spec.js.snap +0 -163
- package/tests/format/Ownable/jsfmt.spec.js +0 -1
- package/tests/format/Parentheses/AddNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitAndNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitOrNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitXorNoParentheses.sol +0 -92
- package/tests/format/Parentheses/DivNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ExpNoParentheses.sol +0 -92
- package/tests/format/Parentheses/LogicNoParentheses.sol +0 -20
- package/tests/format/Parentheses/ModNoParentheses.sol +0 -92
- package/tests/format/Parentheses/MulNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftLNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftRNoParentheses.sol +0 -92
- package/tests/format/Parentheses/SubNoParentheses.sol +0 -92
- package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +0 -2237
- package/tests/format/Parentheses/jsfmt.spec.js +0 -1
- package/tests/format/Pragma/Pragma.sol +0 -8
- package/tests/format/Pragma/__snapshots__/jsfmt.spec.js.snap +0 -29
- package/tests/format/Pragma/jsfmt.spec.js +0 -1
- package/tests/format/PrettierIgnore/PrettierIgnore.sol +0 -39
- package/tests/format/PrettierIgnore/__snapshots__/jsfmt.spec.js.snap +0 -87
- package/tests/format/PrettierIgnore/jsfmt.spec.js +0 -1
- package/tests/format/Proxy/Proxy.sol +0 -52
- package/tests/format/Proxy/__snapshots__/jsfmt.spec.js.snap +0 -127
- package/tests/format/Proxy/jsfmt.spec.js +0 -1
- package/tests/format/RespectDefaultOptions/__snapshots__/jsfmt.spec.js.snap +0 -19
- package/tests/format/RespectDefaultOptions/jsfmt.spec.js +0 -5
- package/tests/format/RespectDefaultOptions/respect-default-options.js +0 -3
- package/tests/format/SampleCrowdsale/SampleCrowdsale.sol +0 -48
- package/tests/format/SampleCrowdsale/__snapshots__/jsfmt.spec.js.snap +0 -113
- package/tests/format/SampleCrowdsale/jsfmt.spec.js +0 -1
- package/tests/format/SimpleAuction/SimpleAuction.sol +0 -123
- package/tests/format/SimpleAuction/__snapshots__/jsfmt.spec.js.snap +0 -250
- package/tests/format/SimpleAuction/jsfmt.spec.js +0 -1
- package/tests/format/SimpleStorage/SimpleStorage.sol +0 -14
- package/tests/format/SimpleStorage/__snapshots__/jsfmt.spec.js.snap +0 -41
- package/tests/format/SimpleStorage/jsfmt.spec.js +0 -1
- package/tests/format/SplittableCommodity/SplittableCommodity.sol +0 -57
- package/tests/format/SplittableCommodity/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/SplittableCommodity/jsfmt.spec.js +0 -1
- package/tests/format/StateVariableDeclarations/StateVariableDeclarations.sol +0 -3
- package/tests/format/StateVariableDeclarations/__snapshots__/jsfmt.spec.js.snap +0 -20
- package/tests/format/StateVariableDeclarations/jsfmt.spec.js +0 -1
- package/tests/format/StringLiteral/StringLiteral.sol +0 -11
- package/tests/format/StringLiteral/__snapshots__/jsfmt.spec.js.snap +0 -36
- package/tests/format/StringLiteral/jsfmt.spec.js +0 -1
- package/tests/format/StyleGuide/BlankLines.sol +0 -19
- package/tests/format/StyleGuide/ControlStructures.sol +0 -57
- package/tests/format/StyleGuide/FunctionDeclaration.sol +0 -135
- package/tests/format/StyleGuide/Mappings.sol +0 -9
- package/tests/format/StyleGuide/MaximumLineLength.sol +0 -67
- package/tests/format/StyleGuide/OtherRecommendations.sol +0 -29
- package/tests/format/StyleGuide/VariableDeclarations.sol +0 -6
- package/tests/format/StyleGuide/WhitespaceInExpressions.sol +0 -13
- package/tests/format/StyleGuide/__snapshots__/jsfmt.spec.js.snap +0 -772
- package/tests/format/StyleGuide/jsfmt.spec.js +0 -1
- package/tests/format/TryCatch/TryCatch.sol +0 -103
- package/tests/format/TryCatch/__snapshots__/jsfmt.spec.js.snap +0 -241
- package/tests/format/TryCatch/jsfmt.spec.js +0 -1
- package/tests/format/Tupples/Tupples.sol +0 -25
- package/tests/format/Tupples/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/Tupples/jsfmt.spec.js +0 -1
- package/tests/format/TypeDefinition/TypeDefinition.sol +0 -12
- package/tests/format/TypeDefinition/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/TypeDefinition/jsfmt.spec.js +0 -1
- package/tests/format/WhileStatements/WhileStatements.sol +0 -37
- package/tests/format/WhileStatements/__snapshots__/jsfmt.spec.js.snap +0 -110
- package/tests/format/WhileStatements/jsfmt.spec.js +0 -1
- package/tests/format/WrongCompiler/WrongCompiler.sol +0 -3
- package/tests/format/WrongCompiler/__snapshots__/jsfmt.spec.js.snap +0 -55
- package/tests/format/WrongCompiler/jsfmt.spec.js +0 -10
- package/tests/format/quotes/Quotes.sol +0 -24
- package/tests/format/quotes/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/quotes/jsfmt.spec.js +0 -2
- package/tests/format/strings/__snapshots__/jsfmt.spec.js.snap +0 -1579
- package/tests/format/strings/jsfmt.spec.js +0 -1
- package/tests/format/strings/strings.sol +0 -717
- package/tests/unit/binary-operator-printers/__snapshots__/index.test.js.snap +0 -13
- package/tests/unit/binary-operator-printers/index.test.js +0 -5
- package/tests/unit/comments/printer.test.js +0 -9
- package/tests/unit/prettier-version.test.js +0 -26
- package/tests/unit/printer.test.js +0 -9
|
@@ -1,772 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`BlankLines.sol format 1`] = `
|
|
4
|
-
====================================options=====================================
|
|
5
|
-
parsers: ["solidity-parse"]
|
|
6
|
-
printWidth: 80
|
|
7
|
-
| printWidth
|
|
8
|
-
=====================================input======================================
|
|
9
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
contract A {
|
|
13
|
-
}
|
|
14
|
-
contract B {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
contract C {
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
contract A {
|
|
21
|
-
function spam() public pure {
|
|
22
|
-
// ...
|
|
23
|
-
}
|
|
24
|
-
function ham() public pure {
|
|
25
|
-
// ...
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
=====================================output=====================================
|
|
30
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
31
|
-
|
|
32
|
-
contract A {}
|
|
33
|
-
|
|
34
|
-
contract B {}
|
|
35
|
-
|
|
36
|
-
contract C {}
|
|
37
|
-
|
|
38
|
-
contract A {
|
|
39
|
-
function spam() public pure {
|
|
40
|
-
// ...
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function ham() public pure {
|
|
44
|
-
// ...
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
================================================================================
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`ControlStructures.sol format 1`] = `
|
|
52
|
-
====================================options=====================================
|
|
53
|
-
parsers: ["solidity-parse"]
|
|
54
|
-
printWidth: 80
|
|
55
|
-
| printWidth
|
|
56
|
-
=====================================input======================================
|
|
57
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
contract ControlStructures
|
|
61
|
-
{
|
|
62
|
-
struct Bank
|
|
63
|
-
{
|
|
64
|
-
address owner;
|
|
65
|
-
uint balance;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function () {
|
|
69
|
-
if (true)
|
|
70
|
-
{
|
|
71
|
-
doSomething();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
while(true){
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (uint a; a < 10; a++) {
|
|
79
|
-
doSomethingElse();}
|
|
80
|
-
|
|
81
|
-
/* TODO: singleline trueBody should be printed and indented in a new
|
|
82
|
-
line
|
|
83
|
-
if (x < 10)
|
|
84
|
-
x += 1;
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/* TODO: force braquets if statement is too complex
|
|
88
|
-
if (x < 10)
|
|
89
|
-
someArray.push(Coin({
|
|
90
|
-
name: 'spam',
|
|
91
|
-
value: 42
|
|
92
|
-
}));
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
if (x < 3) {
|
|
96
|
-
x += 1;
|
|
97
|
-
} else
|
|
98
|
-
if (x > 7) {
|
|
99
|
-
x -= 1;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
x = 5;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* TODO: singleline trueBody and falseBody should be printed and
|
|
106
|
-
indented in a new line
|
|
107
|
-
if (x < 3)
|
|
108
|
-
x += 1;
|
|
109
|
-
else
|
|
110
|
-
x -= 1;
|
|
111
|
-
*/
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
=====================================output=====================================
|
|
116
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
117
|
-
|
|
118
|
-
contract ControlStructures {
|
|
119
|
-
struct Bank {
|
|
120
|
-
address owner;
|
|
121
|
-
uint256 balance;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function() {
|
|
125
|
-
if (true) {
|
|
126
|
-
doSomething();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
while (true) {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
for (uint256 a; a < 10; a++) {
|
|
134
|
-
doSomethingElse();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/* TODO: singleline trueBody should be printed and indented in a new
|
|
138
|
-
line
|
|
139
|
-
if (x < 10)
|
|
140
|
-
x += 1;
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
/* TODO: force braquets if statement is too complex
|
|
144
|
-
if (x < 10)
|
|
145
|
-
someArray.push(Coin({
|
|
146
|
-
name: 'spam',
|
|
147
|
-
value: 42
|
|
148
|
-
}));
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
if (x < 3) {
|
|
152
|
-
x += 1;
|
|
153
|
-
} else if (x > 7) {
|
|
154
|
-
x -= 1;
|
|
155
|
-
} else {
|
|
156
|
-
x = 5;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* TODO: singleline trueBody and falseBody should be printed and
|
|
160
|
-
indented in a new line
|
|
161
|
-
if (x < 3)
|
|
162
|
-
x += 1;
|
|
163
|
-
else
|
|
164
|
-
x -= 1;
|
|
165
|
-
*/
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
================================================================================
|
|
170
|
-
`;
|
|
171
|
-
|
|
172
|
-
exports[`FunctionDeclaration.sol format 1`] = `
|
|
173
|
-
====================================options=====================================
|
|
174
|
-
parsers: ["solidity-parse"]
|
|
175
|
-
printWidth: 80
|
|
176
|
-
| printWidth
|
|
177
|
-
=====================================input======================================
|
|
178
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
contract FunctionDeclaration {
|
|
182
|
-
function increment(uint x) public pure returns (uint)
|
|
183
|
-
{
|
|
184
|
-
return x + 1;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function increment(uint x) public pure returns (uint){
|
|
188
|
-
return x + 1;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function increment(uint x) public pure returns (uint) {
|
|
192
|
-
return x + 1;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function increment(uint x) public pure returns (uint) {
|
|
196
|
-
return x + 1;}
|
|
197
|
-
|
|
198
|
-
function kill() onlyowner public {
|
|
199
|
-
selfdestruct(owner);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/* TODO: modifiers should always split if arguments split */
|
|
203
|
-
function thisFunctionHasLotsOfArguments(address a, address b, address c,
|
|
204
|
-
address d, address e, address f) public {
|
|
205
|
-
doSomething();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function thisFunctionHasLotsOfArguments(address a,
|
|
209
|
-
address b,
|
|
210
|
-
address c,
|
|
211
|
-
address d,
|
|
212
|
-
address e,
|
|
213
|
-
address f) public {
|
|
214
|
-
doSomething();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function thisFunctionHasLotsOfArguments(
|
|
218
|
-
address a,
|
|
219
|
-
address b,
|
|
220
|
-
address c,
|
|
221
|
-
address d,
|
|
222
|
-
address e,
|
|
223
|
-
address f) public {
|
|
224
|
-
doSomething();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function thisFunctionNameIsReallyLong(address x, address y, address z)
|
|
228
|
-
public
|
|
229
|
-
onlyowner
|
|
230
|
-
priced
|
|
231
|
-
returns (address) {
|
|
232
|
-
doSomething();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function thisFunctionNameIsReallyLong(address x, address y, address z)
|
|
236
|
-
public onlyowner priced returns (address)
|
|
237
|
-
{
|
|
238
|
-
doSomething();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function thisFunctionNameIsReallyLong(address x, address y, address z)
|
|
242
|
-
public
|
|
243
|
-
onlyowner
|
|
244
|
-
priced
|
|
245
|
-
returns (address) {
|
|
246
|
-
doSomething();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function thisFunctionNameIsReallyLong(
|
|
250
|
-
address a,
|
|
251
|
-
address b,
|
|
252
|
-
address c
|
|
253
|
-
)
|
|
254
|
-
public
|
|
255
|
-
returns (address someAddressName,
|
|
256
|
-
uint256 LongArgument,
|
|
257
|
-
uint256 Argument)
|
|
258
|
-
{
|
|
259
|
-
doSomething();
|
|
260
|
-
|
|
261
|
-
return (veryVeryLongReturnArg1,
|
|
262
|
-
veryVeryLongReturnArg1,
|
|
263
|
-
veryVeryLongReturnArg1);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// Base contracts just to make this compile
|
|
269
|
-
contract B {
|
|
270
|
-
constructor(uint) public {
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
contract C {
|
|
276
|
-
constructor(uint, uint) public {
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
contract D {
|
|
282
|
-
constructor(uint) public {
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
/* TODO: constructors calls have priority over visibility */
|
|
288
|
-
contract A is B, C, D {
|
|
289
|
-
uint x;
|
|
290
|
-
|
|
291
|
-
constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
|
|
292
|
-
B(param1)
|
|
293
|
-
C(param2, param3)
|
|
294
|
-
D(param4)
|
|
295
|
-
public
|
|
296
|
-
{
|
|
297
|
-
x = param5;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
contract X is B, C, D {
|
|
303
|
-
uint x;
|
|
304
|
-
|
|
305
|
-
constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
|
|
306
|
-
public
|
|
307
|
-
B(param1)
|
|
308
|
-
C(param2, param3)
|
|
309
|
-
D(param4) {
|
|
310
|
-
x = param5;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
=====================================output=====================================
|
|
315
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
316
|
-
|
|
317
|
-
contract FunctionDeclaration {
|
|
318
|
-
function increment(uint256 x) public pure returns (uint256) {
|
|
319
|
-
return x + 1;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function increment(uint256 x) public pure returns (uint256) {
|
|
323
|
-
return x + 1;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function increment(uint256 x) public pure returns (uint256) {
|
|
327
|
-
return x + 1;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function increment(uint256 x) public pure returns (uint256) {
|
|
331
|
-
return x + 1;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function kill() public onlyowner {
|
|
335
|
-
selfdestruct(owner);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/* TODO: modifiers should always split if arguments split */
|
|
339
|
-
function thisFunctionHasLotsOfArguments(
|
|
340
|
-
address a,
|
|
341
|
-
address b,
|
|
342
|
-
address c,
|
|
343
|
-
address d,
|
|
344
|
-
address e,
|
|
345
|
-
address f
|
|
346
|
-
) public {
|
|
347
|
-
doSomething();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function thisFunctionHasLotsOfArguments(
|
|
351
|
-
address a,
|
|
352
|
-
address b,
|
|
353
|
-
address c,
|
|
354
|
-
address d,
|
|
355
|
-
address e,
|
|
356
|
-
address f
|
|
357
|
-
) public {
|
|
358
|
-
doSomething();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function thisFunctionHasLotsOfArguments(
|
|
362
|
-
address a,
|
|
363
|
-
address b,
|
|
364
|
-
address c,
|
|
365
|
-
address d,
|
|
366
|
-
address e,
|
|
367
|
-
address f
|
|
368
|
-
) public {
|
|
369
|
-
doSomething();
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function thisFunctionNameIsReallyLong(
|
|
373
|
-
address x,
|
|
374
|
-
address y,
|
|
375
|
-
address z
|
|
376
|
-
) public onlyowner priced returns (address) {
|
|
377
|
-
doSomething();
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
function thisFunctionNameIsReallyLong(
|
|
381
|
-
address x,
|
|
382
|
-
address y,
|
|
383
|
-
address z
|
|
384
|
-
) public onlyowner priced returns (address) {
|
|
385
|
-
doSomething();
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function thisFunctionNameIsReallyLong(
|
|
389
|
-
address x,
|
|
390
|
-
address y,
|
|
391
|
-
address z
|
|
392
|
-
) public onlyowner priced returns (address) {
|
|
393
|
-
doSomething();
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
function thisFunctionNameIsReallyLong(
|
|
397
|
-
address a,
|
|
398
|
-
address b,
|
|
399
|
-
address c
|
|
400
|
-
)
|
|
401
|
-
public
|
|
402
|
-
returns (
|
|
403
|
-
address someAddressName,
|
|
404
|
-
uint256 LongArgument,
|
|
405
|
-
uint256 Argument
|
|
406
|
-
)
|
|
407
|
-
{
|
|
408
|
-
doSomething();
|
|
409
|
-
|
|
410
|
-
return (
|
|
411
|
-
veryVeryLongReturnArg1,
|
|
412
|
-
veryVeryLongReturnArg1,
|
|
413
|
-
veryVeryLongReturnArg1
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// Base contracts just to make this compile
|
|
419
|
-
contract B {
|
|
420
|
-
constructor(uint256) public {}
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
contract C {
|
|
424
|
-
constructor(uint256, uint256) public {}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
contract D {
|
|
428
|
-
constructor(uint256) public {}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/* TODO: constructors calls have priority over visibility */
|
|
432
|
-
contract A is B, C, D {
|
|
433
|
-
uint256 x;
|
|
434
|
-
|
|
435
|
-
constructor(
|
|
436
|
-
uint256 param1,
|
|
437
|
-
uint256 param2,
|
|
438
|
-
uint256 param3,
|
|
439
|
-
uint256 param4,
|
|
440
|
-
uint256 param5
|
|
441
|
-
) public B(param1) C(param2, param3) D(param4) {
|
|
442
|
-
x = param5;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
contract X is B, C, D {
|
|
447
|
-
uint256 x;
|
|
448
|
-
|
|
449
|
-
constructor(
|
|
450
|
-
uint256 param1,
|
|
451
|
-
uint256 param2,
|
|
452
|
-
uint256 param3,
|
|
453
|
-
uint256 param4,
|
|
454
|
-
uint256 param5
|
|
455
|
-
) public B(param1) C(param2, param3) D(param4) {
|
|
456
|
-
x = param5;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
================================================================================
|
|
461
|
-
`;
|
|
462
|
-
|
|
463
|
-
exports[`Mappings.sol format 1`] = `
|
|
464
|
-
====================================options=====================================
|
|
465
|
-
parsers: ["solidity-parse"]
|
|
466
|
-
printWidth: 80
|
|
467
|
-
| printWidth
|
|
468
|
-
=====================================input======================================
|
|
469
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
contract Mappings {
|
|
473
|
-
mapping (uint => uint) map;
|
|
474
|
-
mapping( address => bool ) registeredAddresses;
|
|
475
|
-
mapping (uint => mapping (bool => Data[])) public data;
|
|
476
|
-
mapping(uint => mapping (uint => s)) data;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
=====================================output=====================================
|
|
480
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
481
|
-
|
|
482
|
-
contract Mappings {
|
|
483
|
-
mapping(uint256 => uint256) map;
|
|
484
|
-
mapping(address => bool) registeredAddresses;
|
|
485
|
-
mapping(uint256 => mapping(bool => Data[])) public data;
|
|
486
|
-
mapping(uint256 => mapping(uint256 => s)) data;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
================================================================================
|
|
490
|
-
`;
|
|
491
|
-
|
|
492
|
-
exports[`MaximumLineLength.sol format 1`] = `
|
|
493
|
-
====================================options=====================================
|
|
494
|
-
parsers: ["solidity-parse"]
|
|
495
|
-
printWidth: 80
|
|
496
|
-
| printWidth
|
|
497
|
-
=====================================input======================================
|
|
498
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
contract FunctionCalls {
|
|
502
|
-
function() {
|
|
503
|
-
thisFunctionCallIsReallyLong(longArgument1,
|
|
504
|
-
longArgument2,
|
|
505
|
-
longArgument3
|
|
506
|
-
);
|
|
507
|
-
|
|
508
|
-
thisFunctionCallIsReallyLong(longArgument1,
|
|
509
|
-
longArgument2,
|
|
510
|
-
longArgument3
|
|
511
|
-
);
|
|
512
|
-
|
|
513
|
-
thisFunctionCallIsReallyLong(
|
|
514
|
-
longArgument1, longArgument2,
|
|
515
|
-
longArgument3
|
|
516
|
-
);
|
|
517
|
-
|
|
518
|
-
thisFunctionCallIsReallyLong(
|
|
519
|
-
longArgument1,
|
|
520
|
-
longArgument2,
|
|
521
|
-
longArgument3
|
|
522
|
-
);
|
|
523
|
-
|
|
524
|
-
thisFunctionCallIsReallyLong(
|
|
525
|
-
longArgument1,
|
|
526
|
-
longArgument2,
|
|
527
|
-
longArgument3);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
contract AssignmentStatements {
|
|
533
|
-
function() {
|
|
534
|
-
thisIsALongNestedMapping[being][set][to_some_value] = someFunction(argument1,
|
|
535
|
-
argument2,
|
|
536
|
-
argument3,
|
|
537
|
-
argument4);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
contract EventDefinitionsAndEventEmitters {
|
|
543
|
-
event LongAndLotsOfArgs(address sender,
|
|
544
|
-
address recipient,
|
|
545
|
-
uint256 publicKey,
|
|
546
|
-
uint256 amount,
|
|
547
|
-
bytes32[] options,
|
|
548
|
-
bytes32 longAttribute);
|
|
549
|
-
|
|
550
|
-
function() {
|
|
551
|
-
LongAndLotsOfArgs(sender,
|
|
552
|
-
recipient,
|
|
553
|
-
publicKey,
|
|
554
|
-
amount,
|
|
555
|
-
options,
|
|
556
|
-
longAttribute);
|
|
557
|
-
emit LongAndLotsOfArgs(sender,
|
|
558
|
-
recipient,
|
|
559
|
-
publicKey,
|
|
560
|
-
amount,
|
|
561
|
-
options,
|
|
562
|
-
longAttribute);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
=====================================output=====================================
|
|
567
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
568
|
-
|
|
569
|
-
contract FunctionCalls {
|
|
570
|
-
function() {
|
|
571
|
-
thisFunctionCallIsReallyLong(
|
|
572
|
-
longArgument1,
|
|
573
|
-
longArgument2,
|
|
574
|
-
longArgument3
|
|
575
|
-
);
|
|
576
|
-
|
|
577
|
-
thisFunctionCallIsReallyLong(
|
|
578
|
-
longArgument1,
|
|
579
|
-
longArgument2,
|
|
580
|
-
longArgument3
|
|
581
|
-
);
|
|
582
|
-
|
|
583
|
-
thisFunctionCallIsReallyLong(
|
|
584
|
-
longArgument1,
|
|
585
|
-
longArgument2,
|
|
586
|
-
longArgument3
|
|
587
|
-
);
|
|
588
|
-
|
|
589
|
-
thisFunctionCallIsReallyLong(
|
|
590
|
-
longArgument1,
|
|
591
|
-
longArgument2,
|
|
592
|
-
longArgument3
|
|
593
|
-
);
|
|
594
|
-
|
|
595
|
-
thisFunctionCallIsReallyLong(
|
|
596
|
-
longArgument1,
|
|
597
|
-
longArgument2,
|
|
598
|
-
longArgument3
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
contract AssignmentStatements {
|
|
604
|
-
function() {
|
|
605
|
-
thisIsALongNestedMapping[being][set][to_some_value] = someFunction(
|
|
606
|
-
argument1,
|
|
607
|
-
argument2,
|
|
608
|
-
argument3,
|
|
609
|
-
argument4
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
contract EventDefinitionsAndEventEmitters {
|
|
615
|
-
event LongAndLotsOfArgs(
|
|
616
|
-
address sender,
|
|
617
|
-
address recipient,
|
|
618
|
-
uint256 publicKey,
|
|
619
|
-
uint256 amount,
|
|
620
|
-
bytes32[] options,
|
|
621
|
-
bytes32 longAttribute
|
|
622
|
-
);
|
|
623
|
-
|
|
624
|
-
function() {
|
|
625
|
-
LongAndLotsOfArgs(
|
|
626
|
-
sender,
|
|
627
|
-
recipient,
|
|
628
|
-
publicKey,
|
|
629
|
-
amount,
|
|
630
|
-
options,
|
|
631
|
-
longAttribute
|
|
632
|
-
);
|
|
633
|
-
emit LongAndLotsOfArgs(
|
|
634
|
-
sender,
|
|
635
|
-
recipient,
|
|
636
|
-
publicKey,
|
|
637
|
-
amount,
|
|
638
|
-
options,
|
|
639
|
-
longAttribute
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
================================================================================
|
|
645
|
-
`;
|
|
646
|
-
|
|
647
|
-
exports[`OtherRecommendations.sol format 1`] = `
|
|
648
|
-
====================================options=====================================
|
|
649
|
-
parsers: ["solidity-parse"]
|
|
650
|
-
printWidth: 80
|
|
651
|
-
| printWidth
|
|
652
|
-
=====================================input======================================
|
|
653
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
contract OtherRecommendations {
|
|
657
|
-
function () {
|
|
658
|
-
str = 'bar';
|
|
659
|
-
/* TODO: escape quotes in Strings when enforcing a new quote
|
|
660
|
-
str = '"Be yourself; everyone else is already taken." -Oscar Wilde';
|
|
661
|
-
*/
|
|
662
|
-
|
|
663
|
-
x=3;
|
|
664
|
-
x = 100/10;
|
|
665
|
-
x += 3+4;
|
|
666
|
-
x |= y&&z;
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
/* TODO: whitespace around and operator can be different than 1 space if
|
|
670
|
-
it is the same length before and after
|
|
671
|
-
x = 2**3 + 5;
|
|
672
|
-
x = 2*y + 3*z;
|
|
673
|
-
x = (a+b) * (a-b);
|
|
674
|
-
*/
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
x = 2** 3 + 5;
|
|
678
|
-
x = y+z;
|
|
679
|
-
x +=1;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
=====================================output=====================================
|
|
684
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
685
|
-
|
|
686
|
-
contract OtherRecommendations {
|
|
687
|
-
function() {
|
|
688
|
-
str = "bar";
|
|
689
|
-
/* TODO: escape quotes in Strings when enforcing a new quote
|
|
690
|
-
str = '"Be yourself; everyone else is already taken." -Oscar Wilde';
|
|
691
|
-
*/
|
|
692
|
-
|
|
693
|
-
x = 3;
|
|
694
|
-
x = 100 / 10;
|
|
695
|
-
x += 3 + 4;
|
|
696
|
-
x |= y && z;
|
|
697
|
-
|
|
698
|
-
/* TODO: whitespace around and operator can be different than 1 space if
|
|
699
|
-
it is the same length before and after
|
|
700
|
-
x = 2**3 + 5;
|
|
701
|
-
x = 2*y + 3*z;
|
|
702
|
-
x = (a+b) * (a-b);
|
|
703
|
-
*/
|
|
704
|
-
|
|
705
|
-
x = 2**3 + 5;
|
|
706
|
-
x = y + z;
|
|
707
|
-
x += 1;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
================================================================================
|
|
712
|
-
`;
|
|
713
|
-
|
|
714
|
-
exports[`VariableDeclarations.sol format 1`] = `
|
|
715
|
-
====================================options=====================================
|
|
716
|
-
parsers: ["solidity-parse"]
|
|
717
|
-
printWidth: 80
|
|
718
|
-
| printWidth
|
|
719
|
-
=====================================input======================================
|
|
720
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
contract VariableDeclarations {
|
|
724
|
-
uint [] x;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
=====================================output=====================================
|
|
728
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
729
|
-
|
|
730
|
-
contract VariableDeclarations {
|
|
731
|
-
uint256[] x;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
================================================================================
|
|
735
|
-
`;
|
|
736
|
-
|
|
737
|
-
exports[`WhitespaceInExpressions.sol format 1`] = `
|
|
738
|
-
====================================options=====================================
|
|
739
|
-
parsers: ["solidity-parse"]
|
|
740
|
-
printWidth: 80
|
|
741
|
-
| printWidth
|
|
742
|
-
=====================================input======================================
|
|
743
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
contract WhitespaceInExpressions {
|
|
747
|
-
function () {
|
|
748
|
-
spam( ham[ 1 ], Coin( { name: "ham" } ) );
|
|
749
|
-
x = 1;
|
|
750
|
-
y = 2;
|
|
751
|
-
long_variable = 3;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
function spam(uint i , Coin coin) public ;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
=====================================output=====================================
|
|
758
|
-
pragma solidity >=0.4.0 <0.7.0;
|
|
759
|
-
|
|
760
|
-
contract WhitespaceInExpressions {
|
|
761
|
-
function() {
|
|
762
|
-
spam(ham[1], Coin({name: "ham"}));
|
|
763
|
-
x = 1;
|
|
764
|
-
y = 2;
|
|
765
|
-
long_variable = 3;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
function spam(uint256 i, Coin coin) public;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
================================================================================
|
|
772
|
-
`;
|