From a437a70bd5aeef1f03e591a9145783f475d8408e Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Tue, 31 Oct 2023 15:19:49 +0100 Subject: [PATCH 1/4] Remove ABAP Formatter Recommendation --- clean-abap/CleanABAP.md | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/clean-abap/CleanABAP.md b/clean-abap/CleanABAP.md index a513b9d2..cf31309c 100644 --- a/clean-abap/CleanABAP.md +++ b/clean-abap/CleanABAP.md @@ -187,8 +187,8 @@ The [Cheat Sheet](cheat-sheet/CheatSheet.md) is a print-optimized version. - [Formatting](#formatting) - [Be consistent](#be-consistent) - [Optimize for reading, not for writing](#optimize-for-reading-not-for-writing) - - [Use the ABAP Formatter before activating](#use-the-abap-formatter-before-activating) - - [Use your team's ABAP Formatter settings](#use-your-teams-abap-formatter-settings) + - [Use an Automated Code Formatting Tool](#use-an-automated-code-formatting-tool) + - [Use the ABAPCleaner](#use-the-abap-cleaner) - [No more than one statement per line](#no-more-than-one-statement-per-line) - [Stick to a reasonable line length](#stick-to-a-reasonable-line-length) - [Condense your code](#condense-your-code) @@ -3876,9 +3876,8 @@ have replaced them. > [Clean ABAP](#clean-abap) > [Content](#content) > [This section](#formatting) The suggestions below are [optimized for reading, not for writing](#optimize-for-reading-not-for-writing). -As the ABAP Formatter doesn't cover them, some of them produce additional manual work to reformat statements -when name lengths etc. change; if you want to avoid this, consider dropping rules like -[Align assignments to the same object, but not to different ones](#align-assignments-to-the-same-object-but-not-to-different-ones). + +Some of them might not be covered by automated code formatting tools, such as ABAP Formatter or ABAPCleaner, so manual effort to reformat statements might be necessary, but we recommend sticking with automated formatting as dar a s possible for the sake of consistency. ### Be consistent @@ -3922,33 +3921,22 @@ DATA: ,e TYPE f. ``` -### Use the ABAP Formatter before activating +### Use an Automated Code Formatting Tool + +> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-an-automated-code-formatting-tool) -> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-the-abap-formatter-before-activating) +Use an automated code formatting tool with a consistent setting in your team. -Apply the ABAP Formatter - Shift+F1 in SE80, SE24, and ADT - before activating an object. -Note: ABAP Formatter is known as Pretty Printer in SAP GUI. +If you modify a larger unformatted legacy code base, you may want to apply an automated formatting tool only to selected lines to avoid huge change lists and transport dependencies. Consider formatting the complete development object in a separate Transport Request or Note. -If you modify a larger unformatted legacy code base, -you may want to apply the ABAP Formatter only to selected lines -to avoid huge change lists and transport dependencies. -Consider formatting the complete development object -in a separate Transport Request or Note. > Read more in _Chapter 5: Formatting: Team Rules_ of [Robert C. Martin's _Clean Code_]. -### Use your team's ABAP Formatter settings +### Use the ABAPCleaner > [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-your-teams-abap-formatter-settings) -Always use your team's ABAP Formatter settings. -Specify them under -* Eclipse: Right-click on the project in the Project Explorer > _Properties_ > _ABAP Development_ > _Editors_ > _Source Code Editors_ > _ABAP Formatter_ -* Eclipse (alternative navigation): _Menu_ > _Window_ > _Preferences_ > _ABAP Development_ > _Editors_ > _Source Code Editors_ > Click on the _ABAP Formatter_ link on the right-hand side > Select project in pop-up -* SAP GUI: _Menu_ > _Utilities_ > _Settings ..._ > _ABAP Editor_ > _Pretty Printer_. - -Set _Indent_ and _Convert Uppercase/Lowercase_ > _Uppercase Keyword_ -as agreed in your team. +Always use the [ABAPCleaner](https://github.com/SAP/abap-cleaner), ideally with the default configuration. > [Upper vs. Lower Case](sub-sections/UpperVsLowerCase.md) explains > why we do not give clear guidance for the type case of keywords. From 720fe21cb21cf343bd5750c293672e213e81ff3d Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Tue, 31 Oct 2023 15:21:03 +0100 Subject: [PATCH 2/4] Update CleanABAP.md --- clean-abap/CleanABAP.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/clean-abap/CleanABAP.md b/clean-abap/CleanABAP.md index cf31309c..b3d64d4c 100644 --- a/clean-abap/CleanABAP.md +++ b/clean-abap/CleanABAP.md @@ -3927,9 +3927,6 @@ DATA: Use an automated code formatting tool with a consistent setting in your team. -If you modify a larger unformatted legacy code base, you may want to apply an automated formatting tool only to selected lines to avoid huge change lists and transport dependencies. Consider formatting the complete development object in a separate Transport Request or Note. - - > Read more in _Chapter 5: Formatting: Team Rules_ of [Robert C. Martin's _Clean Code_]. ### Use the ABAPCleaner From ab947f65d61752b8aa8b425a8efa451bb58c0cfb Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Tue, 31 Oct 2023 15:28:24 +0100 Subject: [PATCH 3/4] Update CleanABAP.md --- clean-abap/CleanABAP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clean-abap/CleanABAP.md b/clean-abap/CleanABAP.md index b3d64d4c..6ea02192 100644 --- a/clean-abap/CleanABAP.md +++ b/clean-abap/CleanABAP.md @@ -3931,7 +3931,7 @@ Use an automated code formatting tool with a consistent setting in your team. ### Use the ABAPCleaner -> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-your-teams-abap-formatter-settings) +> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-the-abap-cleaner) Always use the [ABAPCleaner](https://github.com/SAP/abap-cleaner), ideally with the default configuration. From 94ba2354f66861ec986e016064a1444bb8189494 Mon Sep 17 00:00:00 2001 From: Michael Sauter Date: Thu, 2 Nov 2023 08:11:49 +0100 Subject: [PATCH 4/4] Update CleanABAP.md --- clean-abap/CleanABAP.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/clean-abap/CleanABAP.md b/clean-abap/CleanABAP.md index 6ea02192..9213ea91 100644 --- a/clean-abap/CleanABAP.md +++ b/clean-abap/CleanABAP.md @@ -3935,11 +3935,6 @@ Use an automated code formatting tool with a consistent setting in your team. Always use the [ABAPCleaner](https://github.com/SAP/abap-cleaner), ideally with the default configuration. -> [Upper vs. Lower Case](sub-sections/UpperVsLowerCase.md) explains -> why we do not give clear guidance for the type case of keywords. -> -> Read more in _Chapter 5: Formatting: Team Rules_ of [Robert C. Martin's _Clean Code_]. - ### No more than one statement per line > [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#no-more-than-one-statement-per-line)