From 101ca7297ad74acc7bb43ad71afeef30b8bdb26e Mon Sep 17 00:00:00 2001 From: JHenneberg Date: Tue, 31 Mar 2020 10:04:46 +0200 Subject: [PATCH 1/5] specified order of attributes --- STYLE_GUIDE.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 612257e97..af4b5a188 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -42,6 +42,15 @@ focus on the semantics of the proposed changes rather than style and formatting. * Where conventional and appropriate shortening of a word is used then the underscore may be omitted, for example `linspace` is preferred over `lin_space` +## Order of attributes + +Similiar to the guidlines for indentation and whitespace, specifiying the order of appearance of attributes can help reviewing code and git-diffs. + +1. ```dimension``` +2. ```allocatable``` +3. ```intent(intent-spec)``` +4. ```optional``` + ## End block closing statements Fortran allows certain block constructs or scopes to include the name of the program unit in the end statement. From 7a305c13e93fe387b9f2fedfa33e5c17f9aa96c5 Mon Sep 17 00:00:00 2001 From: JHenneberg Date: Mon, 6 Apr 2020 16:05:47 +0200 Subject: [PATCH 2/5] updated according to #167 --- STYLE_GUIDE.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index af4b5a188..650c08dc4 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -42,14 +42,25 @@ focus on the semantics of the proposed changes rather than style and formatting. * Where conventional and appropriate shortening of a word is used then the underscore may be omitted, for example `linspace` is preferred over `lin_space` -## Order of attributes +## Attributes -Similiar to the guidlines for indentation and whitespace, specifiying the order of appearance of attributes can help reviewing code and git-diffs. +* Always specify ```intent``` for dummy arguments +* Don't use ```dimension``` attribute to declare arrays because it is less verbose. + Use this: -1. ```dimension``` -2. ```allocatable``` -3. ```intent(intent-spec)``` -4. ```optional``` + ``` + real, allocatable :: a(:), b(:,:) + ``` + + instead of: + + ``` + real, dimension(:), allocatable :: a + real, dimension(:,:), allocatable :: b + ``` + + When defining a lot of arrays of the same dimension ```dimension``` can be used as an exception. +* If ```optional``` attribute is used to declare a dummy argument, it should follow the intent attribute ## End block closing statements From 0ee19c2b41a5c96ebd7f5c4ce9a7aedf54b9514b Mon Sep 17 00:00:00 2001 From: "J. Henneberg" <6606609+JHenneberg@users.noreply.github.com> Date: Tue, 7 Apr 2020 09:47:44 +0200 Subject: [PATCH 3/5] Update STYLE_GUIDE.md Co-Authored-By: Milan Curcic --- STYLE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 650c08dc4..86f53971d 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -44,7 +44,7 @@ focus on the semantics of the proposed changes rather than style and formatting. ## Attributes -* Always specify ```intent``` for dummy arguments +* Always specify ```intent``` for dummy arguments. * Don't use ```dimension``` attribute to declare arrays because it is less verbose. Use this: From 1d00588318bdc7dd8a343e8fa70c4bc590aebe06 Mon Sep 17 00:00:00 2001 From: "J. Henneberg" <6606609+JHenneberg@users.noreply.github.com> Date: Tue, 7 Apr 2020 09:48:07 +0200 Subject: [PATCH 4/5] Update STYLE_GUIDE.md Co-Authored-By: Milan Curcic --- STYLE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 86f53971d..baddba73c 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -59,7 +59,7 @@ focus on the semantics of the proposed changes rather than style and formatting. real, dimension(:,:), allocatable :: b ``` - When defining a lot of arrays of the same dimension ```dimension``` can be used as an exception. +When defining many arrays of the same dimension, ```dimension``` can be used as an exception if it makes the code less verbose. * If ```optional``` attribute is used to declare a dummy argument, it should follow the intent attribute ## End block closing statements From 499a455854ab934b24ecaa5daaa3febc7959d33e Mon Sep 17 00:00:00 2001 From: "J. Henneberg" <6606609+JHenneberg@users.noreply.github.com> Date: Tue, 7 Apr 2020 11:15:50 +0200 Subject: [PATCH 5/5] Apply suggestions from code review --- STYLE_GUIDE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index baddba73c..35b3930a6 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -44,8 +44,8 @@ focus on the semantics of the proposed changes rather than style and formatting. ## Attributes -* Always specify ```intent``` for dummy arguments. -* Don't use ```dimension``` attribute to declare arrays because it is less verbose. +* Always specify `intent` for dummy arguments. +* Don't use `dimension` attribute to declare arrays because it is less verbose. Use this: ``` @@ -59,8 +59,8 @@ focus on the semantics of the proposed changes rather than style and formatting. real, dimension(:,:), allocatable :: b ``` -When defining many arrays of the same dimension, ```dimension``` can be used as an exception if it makes the code less verbose. -* If ```optional``` attribute is used to declare a dummy argument, it should follow the intent attribute + When defining many arrays of the same dimension, `dimension` can be used as an exception if it makes the code less verbose. +* If the `optional` attribute is used to declare a dummy argument, it should follow the `intent` attribute. ## End block closing statements