Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove recommendation for ABAP Formatter #343

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 10 additions & 30 deletions clean-abap/CleanABAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Some of them might not be covered by automated code formatting tools, such as ABAP Formatter or ABAP Cleaner, so manual effort to reformat statements might be necessary, but we recommend sticking with automated formatting as much as possible for the sake of consistency.


### Be consistent

Expand Down Expand Up @@ -3922,38 +3921,19 @@ DATA:
,e TYPE f.
```

### Use the ABAP Formatter before activating

> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-the-abap-formatter-before-activating)
### Use an Automated Code Formatting Tool

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.
> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-an-automated-code-formatting-tool)

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.
Use an automated code formatting tool with a consistent setting in your team.

> Read more in _Chapter 5: Formatting: Team Rules_ of [Robert C. Martin's _Clean Code_].

### Use your team's ABAP Formatter settings

> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-your-teams-abap-formatter-settings)
### Use the ABAPCleaner

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_.
> [Clean ABAP](#clean-abap) > [Content](#content) > [Formatting](#formatting) > [This section](#use-the-abap-cleaner)

Set _Indent_ and _Convert Uppercase/Lowercase_ > _Uppercase Keyword_
as agreed in your team.

> [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_].
Always use the [ABAPCleaner](https://github.com/SAP/abap-cleaner), ideally with the default configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be the same as before: Always use your team's formatter settings. 😉


### No more than one statement per line

Expand Down
Loading