diff options
author | chriseth <chris@ethereum.org> | 2018-03-01 19:07:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-01 19:07:09 +0800 |
commit | cf6720eab5381a150c632eb484024a1a40a6a10f (patch) | |
tree | e134ae64ab2b51a87ac724e02b5ba10fdbbf3ed7 | |
parent | 9e3da89a7a0753e869b4668f9587385c9b37ba8d (diff) | |
parent | e34d367593ccc1d5b7456dfc171473997a645eb6 (diff) | |
download | dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar.gz dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar.bz2 dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar.lz dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar.xz dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.tar.zst dexon-solidity-cf6720eab5381a150c632eb484024a1a40a6a10f.zip |
Merge pull request #3587 from OTTTO/develop
Multiline output parameters and return statements
-rw-r--r-- | docs/style-guide.rst | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/docs/style-guide.rst b/docs/style-guide.rst index ade37d0b..2261746f 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -112,7 +112,9 @@ 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>`_ of 79 (or 99) @@ -650,6 +652,50 @@ No:: doSomething(); } +Multiline output parameters and return statements should follow the same style recommended for wrapping long lines found in the :ref:`Maximum Line Length <maximum_line_length>` section. + +Yes:: + + function thisFunctionNameIsReallyLong( + address a, + address b, + address c + ) + public + returns ( + address someAddressName, + uint256 LongArgument, + uint256 Argument + ) + { + doSomething() + + return ( + veryLongReturnArg1, + veryLongReturnArg2, + veryLongReturnArg3 + ); + } + +No:: + + function thisFunctionNameIsReallyLong( + address a, + address b, + address c + ) + public + returns (address someAddressName, + uint256 LongArgument, + uint256 Argument) + { + doSomething() + + return (veryLongReturnArg1, + veryLongReturnArg1, + veryLongReturnArg1); + } + For constructor functions on inherited contracts whose bases require arguments, it is recommended to drop the base constructors onto new lines in the same manner as modifiers if the function declaration is long or hard to read. |