aboutsummaryrefslogtreecommitdiffstats
path: root/docs/style-guide.rst
diff options
context:
space:
mode:
authorLeo Arias <yo@elopio.net>2018-06-30 01:54:44 +0800
committerLeo Arias <yo@elopio.net>2018-07-04 12:29:00 +0800
commit8fdf3f5d456578d911b005cd52b8ee1fe34317b7 (patch)
tree9942f121116bf4083dd7f3313e7ed3dce514ead6 /docs/style-guide.rst
parent533d5d4b1cc4374decc704de8c86ad4cef6214fc (diff)
downloaddexon-solidity-8fdf3f5d456578d911b005cd52b8ee1fe34317b7.tar.gz
dexon-solidity-8fdf3f5d456578d911b005cd52b8ee1fe34317b7.tar.zst
dexon-solidity-8fdf3f5d456578d911b005cd52b8ee1fe34317b7.zip
update the style guide
Diffstat (limited to 'docs/style-guide.rst')
-rw-r--r--docs/style-guide.rst84
1 files changed, 42 insertions, 42 deletions
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 792110e1..8311e925 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -114,15 +114,15 @@ No::
.. _maximum_line_length:
-Maximum Line Length
+Maximum Line Length
===================
-Keeping lines under the `PEP 8 recommendation <https://www.python.org/dev/peps/pep-0008/#maximum-line-length>`_ to a maximum of 79 (or 99)
+Keeping lines under the `PEP 8 recommendation <https://www.python.org/dev/peps/pep-0008/#maximum-line-length>`_ to a maximum of 79 (or 99)
characters helps readers easily parse the code.
Wrapped lines should conform to the following guidelines.
-1. The first argument should not be attached to the opening parenthesis.
+1. The first argument should not be attached to the opening parenthesis.
2. One, and only one, indent should be used.
3. Each argument should fall on its own line.
4. The terminating element, :code:`);`, should be placed on the final line by itself.
@@ -132,38 +132,38 @@ Function Calls
Yes::
thisFunctionCallIsReallyLong(
- longArgument1,
- longArgument2,
+ longArgument1,
+ longArgument2,
longArgument3
);
No::
- thisFunctionCallIsReallyLong(longArgument1,
- longArgument2,
+ thisFunctionCallIsReallyLong(longArgument1,
+ longArgument2,
longArgument3
);
-
- thisFunctionCallIsReallyLong(longArgument1,
- longArgument2,
+
+ thisFunctionCallIsReallyLong(longArgument1,
+ longArgument2,
longArgument3
- );
-
+ );
+
thisFunctionCallIsReallyLong(
longArgument1, longArgument2,
longArgument3
- );
+ );
thisFunctionCallIsReallyLong(
- longArgument1,
- longArgument2,
+ longArgument1,
+ longArgument2,
longArgument3
);
thisFunctionCallIsReallyLong(
- longArgument1,
- longArgument2,
- longArgument3);
+ longArgument1,
+ longArgument2,
+ longArgument3);
Assignment Statements
@@ -215,7 +215,7 @@ No::
recipient,
publicKey,
amount,
- options);
+ options);
Source File Encoding
====================
@@ -274,7 +274,7 @@ Within a grouping, place the ``view`` and ``pure`` functions last.
Yes::
contract A {
- function A() public {
+ constructor() public {
...
}
@@ -318,7 +318,7 @@ No::
// Public functions
// ...
- function A() public {
+ constructor() public {
...
}
@@ -529,7 +529,7 @@ No::
function increment(uint x) public pure returns (uint) {
return x + 1;}
-You should explicitly label the visibility of all functions, including constructors.
+You should explicitly label the visibility of all functions, including constructors.
Yes::
@@ -540,7 +540,7 @@ Yes::
No::
function implicitlyPublic(uint val) {
- doSomething();
+ doSomething();
}
The visibility modifier for a function should come before any custom
@@ -663,19 +663,19 @@ Yes::
address a,
address b,
address c
- )
- public
+ )
+ public
returns (
- address someAddressName,
- uint256 LongArgument,
+ address someAddressName,
+ uint256 LongArgument,
uint256 Argument
)
- {
+ {
doSomething()
-
+
return (
- veryLongReturnArg1,
- veryLongReturnArg2,
+ veryLongReturnArg1,
+ veryLongReturnArg2,
veryLongReturnArg3
);
}
@@ -686,16 +686,16 @@ No::
address a,
address b,
address c
- )
- public
- returns (address someAddressName,
- uint256 LongArgument,
+ )
+ public
+ returns (address someAddressName,
+ uint256 LongArgument,
uint256 Argument)
- {
+ {
doSomething()
-
- return (veryLongReturnArg1,
- veryLongReturnArg1,
+
+ return (veryLongReturnArg1,
+ veryLongReturnArg1,
veryLongReturnArg1);
}
@@ -706,7 +706,7 @@ manner as modifiers if the function declaration is long or hard to read.
Yes::
contract A is B, C, D {
- function A(uint param1, uint param2, uint param3, uint param4, uint param5)
+ constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
B(param1)
C(param2, param3)
D(param4)
@@ -719,7 +719,7 @@ Yes::
No::
contract A is B, C, D {
- function A(uint param1, uint param2, uint param3, uint param4, uint param5)
+ constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
B(param1)
C(param2, param3)
D(param4)
@@ -730,7 +730,7 @@ No::
}
contract A is B, C, D {
- function A(uint param1, uint param2, uint param3, uint param4, uint param5)
+ constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
B(param1)
C(param2, param3)
D(param4)