Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 14 additions & 2 deletions .claude/skills/view-chain-layout/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tree a line sits, so it has to be true.
after a survey found the two sample corpora following opposite conventions for
the same builder.

## The six rules
## The seven rules

1. **One call per line.** Every `ele( )`, `tag( )`, `a( )` and `end( )` opens
its own line with `)->`. A control never shares its line with its own
Expand All @@ -32,6 +32,18 @@ the same builder.
attribute block.
6. **`stringify( )` is a standalone final statement** —
`client->view_display( view->stringify( ) ).`, never nested in the chain.
7. **A wrapped `t_arg` list hangs under its FIRST element.** When a
`_event( )` / `follow_up_action( )` argument table runs over several lines,
every continuation line starts in the column of the first `( … )` — not
under the `#` of `VALUE #(`, which is three columns to its left and the
drift this rule exists to stop:

```abap
)->a( n = `close` v = client->follow_up_action( val = client->cs_event-control_by_id
t_arg = VALUE #( ( `notificationList` )
( `removeItem` )
( `$event.oSource.getId()` ) ) )
```

```abap
METHOD view_display.
Expand Down Expand Up @@ -115,7 +127,7 @@ and carries fixes, so `--fix` reformats a drifted chain. The rewrite only ever
touches whitespace *between* chain segments and the indent of a continuation
line that is not itself content, and it verifies that collapsing every run of
code-whitespace leaves the source identical — **a layout fix can never change
what the view builds.** Rules 5-6 and the blank lines stay reviewer-enforced.
what the view builds.** Rules 5-7 and the blank lines stay reviewer-enforced.

It is the linter's one **opt-in** rule (`OPT_IN` in its `findings.mjs`): it is
not emitted at all until a config asks for it, because it encodes one house
Expand Down
47 changes: 15 additions & 32 deletions src/00/00/z2ui5_cl_smps_context.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
text = `The operation failed, no further details available`.
ENDIF.

client->message_box_display(
text = text
type = cs_ui5_msg_type-e ).
client->message_box_display( text = text type = cs_ui5_msg_type-e ).

ENDMETHOD.

Expand Down Expand Up @@ -344,8 +342,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.

DATA(lt_param) = url_param_get_tab( search ).
DELETE lt_param WHERE n = `app_start`.
INSERT VALUE #( n = `app_start`
v = to_lower( classname ) ) INTO TABLE lt_param.
INSERT VALUE #( n = `app_start` v = to_lower( classname ) ) INTO TABLE lt_param.

" keep only the launchpad shell part of the hash: the app-owned part
" (leading `/` standalone, or everything after `&/` inside the FLP)
Expand All @@ -356,16 +353,14 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
IF lv_hash IS NOT INITIAL.
DATA(lv_content) = lv_hash.
IF lv_content(1) = `#`.
lv_content = substring( val = lv_content
off = 1 ).
lv_content = substring( val = lv_content off = 1 ).
ENDIF.
IF lv_content IS INITIAL OR lv_content(1) = `/`.
" pure app hash (route or app-state) - drop it entirely
lv_hash = ``.
ELSE.
" inside the FLP keep the shell part, cut the app part after `&/`
DATA(lv_off) = find( val = lv_content
sub = `&/` ).
DATA(lv_off) = find( val = lv_content sub = `&/` ).
IF lv_off = 0.
lv_hash = ``.
ELSEIF lv_off > 0.
Expand All @@ -383,10 +378,8 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
METHOD c_trim.

result = shift_left( shift_right( CONV string( val ) ) ).
result = shift_right( val = result
sub = cv_char_util_horizontal_tab ).
result = shift_left( val = result
sub = cv_char_util_horizontal_tab ).
result = shift_right( val = result sub = cv_char_util_horizontal_tab ).
result = shift_left( val = result sub = cv_char_util_horizontal_tab ).
result = shift_left( shift_right( result ) ).

ENDMETHOD.
Expand Down Expand Up @@ -442,8 +435,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
DATA(lx) = CAST cx_root( val ).
DATA(ls_result) = VALUE ty_s_msg( type = `E` text = lx->get_text( ) ).
DATA(lt_attri_o) = rtti_get_t_attri_by_oref( val ).
LOOP AT lt_attri_o REFERENCE INTO DATA(ls_attri_o)
WHERE visibility = `U`.
LOOP AT lt_attri_o REFERENCE INTO DATA(ls_attri_o) WHERE visibility = `U`.
DATA(lv_name) = ls_attri_o->name.
ASSIGN val->(lv_name) TO <comp>.
IF sy-subrc <> 0.
Expand Down Expand Up @@ -600,8 +592,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
ENDTRY.
ENDIF.
ELSE.
INSERT LINES OF msg_get_rap( val = <row>
entity_name = ls_attri->name ) INTO TABLE result.
INSERT LINES OF msg_get_rap( val = <row> entity_name = ls_attri->name ) INTO TABLE result.
ENDIF.
ENDLOOP.
ENDLOOP.
Expand Down Expand Up @@ -788,9 +779,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
IF entity_name IS NOT INITIAL.
lv_text = |{ entity_name }: { lv_text }|.
ENDIF.
INSERT VALUE #( type = `E`
text = lv_text
t_meta = lt_meta ) INTO TABLE messages.
INSERT VALUE #( type = `E` text = lv_text t_meta = lt_meta ) INTO TABLE messages.
ENDIF.
ENDIF.

Expand Down Expand Up @@ -893,8 +882,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
" descriptor instances are singletons per type, so the identity check
" guards against absolute names reused by other (local/anonymous) types
DATA(lv_absolute_name) = CONV string( lo_struct->absolute_name ).
READ TABLE mt_attri_cache REFERENCE INTO DATA(lr_cache)
WITH TABLE KEY absolute_name = lv_absolute_name.
READ TABLE mt_attri_cache REFERENCE INTO DATA(lr_cache) WITH TABLE KEY absolute_name = lv_absolute_name.
IF sy-subrc = 0 AND lr_cache->o_struct = lo_struct.
result = lr_cache->t_attri.
RETURN.
Expand Down Expand Up @@ -982,8 +970,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
LOOP AT t_params INTO DATA(ls_param).
result = |{ result }{ ls_param-n }={ ls_param-v }&|.
ENDLOOP.
result = shift_right( val = result
sub = `&` ).
result = shift_right( val = result sub = `&` ).

ENDMETHOD.

Expand All @@ -1006,17 +993,14 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
with = `&`
occ = 0 ).

lv_search = shift_left( val = lv_search
sub = `?` ).
lv_search = shift_left( val = lv_search sub = `?` ).

" prepend & before searching so sap-startup-params is also unwrapped
" when it is the first/only query parameter (typical FLP target mapping)
DATA(lv_search2) = substring_after( val = |&{ lv_search }|
sub = `&sap-startup-params=` ).
DATA(lv_search2) = substring_after( val = |&{ lv_search }| sub = `&sap-startup-params=` ).
lv_search = COND #( WHEN lv_search2 IS NOT INITIAL THEN lv_search2 ELSE lv_search ).

lv_search2 = substring_after( val = lv_search
sub = `?` ).
lv_search2 = substring_after( val = lv_search sub = `?` ).
IF lv_search2 IS NOT INITIAL.
lv_search = lv_search2.
ENDIF.
Expand All @@ -1034,8 +1018,7 @@ CLASS z2ui5_cl_smps_context IMPLEMENTATION.
" normalize the name so lookups are case-insensitive on every input
" shape (with or without a leading path/question mark) - the value
" keeps its original case
INSERT VALUE #( n = c_trim_lower( lv_name )
v = lv_value ) INTO TABLE rt_params.
INSERT VALUE #( n = c_trim_lower( lv_name ) v = lv_value ) INTO TABLE rt_params.
ENDLOOP.

ENDMETHOD.
Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_313.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ CLASS z2ui5_cl_smps_app_313 IMPLEMENTATION.
)->a( n = `enableExport` b = abap_false
)->a( n = `enableAutoBinding` b = abap_false ).

client->view_display( val = view->stringify( )
switch_default_model_path = `/sap/opu/odata/sap/UI_PRODUCTLIST/` ).
client->view_display( val = view->stringify( ) switch_default_model_path = `/sap/opu/odata/sap/UI_PRODUCTLIST/` ).

ENDIF.

Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_314.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ CLASS z2ui5_cl_smps_app_314 IMPLEMENTATION.
* )->tag( `Text` )->a( n = `text` v = `{Price}`
* )->tag( `Text` )->a( n = `text` v = `{CurrencyCode}` ).

client->view_display( val = view->stringify( )
switch_default_model_path = `/sap/opu/odata/iwbep/gwsample_basic/` ).
client->view_display( val = view->stringify( ) switch_default_model_path = `/sap/opu/odata/iwbep/gwsample_basic/` ).
* switch_default_model_path = `/sap/opu/odata/DMO/API_TRAVEL_U_V2/` ).

ENDMETHOD.
Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_475.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ CLASS z2ui5_cl_smps_app_475 IMPLEMENTATION.
)->a( n = `value` v = `{Price}`
)->a( n = `id` v = `idPrice` ).

client->view_display( val = view->stringify( )
switch_default_model_path = c_odata_service ).
client->view_display( val = view->stringify( ) switch_default_model_path = c_odata_service ).

ENDIF.

Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_476.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ CLASS z2ui5_cl_smps_app_476 IMPLEMENTATION.
)->ele( n = `SmartField` ns = `smartField`
)->a( n = `value` v = `{SupplierName}` ).

client->view_display( val = view->stringify( )
switch_default_model_path = c_odata_service ).
client->view_display( val = view->stringify( ) switch_default_model_path = c_odata_service ).

ENDIF.

Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_477.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ CLASS z2ui5_cl_smps_app_477 IMPLEMENTATION.
)->a( n = `enableExport` v = `false`
)->a( n = `enableAutoBinding` v = `true` ).

client->view_display( val = view->stringify( )
switch_default_model_path = c_odata_service ).
client->view_display( val = view->stringify( ) switch_default_model_path = c_odata_service ).

ENDIF.

Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_478.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ CLASS z2ui5_cl_smps_app_478 IMPLEMENTATION.
)->a( n = `persistencyKey` v = `SmartTablePKey`
)->a( n = `smartVariant` v = `pageVariantId` ).

client->view_display( val = view->stringify( )
switch_default_model_path = c_odata_service ).
client->view_display( val = view->stringify( ) switch_default_model_path = c_odata_service ).

" The handshake a controller would do: without initialise( ) the page variant
" never gets a personalizable control, so saving a view dies in sap.ui.fl and
Expand Down
3 changes: 1 addition & 2 deletions src/02/z2ui5_cl_smps_app_479.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ CLASS z2ui5_cl_smps_app_479 IMPLEMENTATION.
)->a( n = `navigate` v = client->_event( val = `NAVIGATE`
t_arg = VALUE #( ( `${$parameters>/text}` ) ) ) ).

client->view_display( val = view->stringify( )
switch_default_model_path = c_odata_service ).
client->view_display( val = view->stringify( ) switch_default_model_path = c_odata_service ).

ELSEIF client->check_on_event( `NAV_TARGETS_OBTAINED` ).
" The tutorial answers this event by composing the navigation popover
Expand Down
10 changes: 3 additions & 7 deletions src/03/z2ui5_cl_smps_app_001.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ CLASS z2ui5_cl_smps_app_001 IMPLEMENTATION.
" table, and after a few creates and deletes the lowest key is a
" different one.
SELECT SINGLE FROM z2ui5_r_smps_trv
FIELDS MIN( TravelId )
INTO @DATA(first_id).
FIELDS MIN( TravelId ) INTO @DATA(first_id).

travel_id = COND #( WHEN first_id IS NOT INITIAL
THEN |{ first_id ALPHA = OUT }| ).
travel_id = COND #( WHEN first_id IS NOT INITIAL THEN |{ first_id ALPHA = OUT }| ).

ENDMETHOD.

Expand All @@ -86,9 +84,7 @@ CLASS z2ui5_cl_smps_app_001 IMPLEMENTATION.
IF s_failed-travel IS NOT INITIAL.

s_travel = VALUE #( ).
client->message_box_display(
text = |Travel { travel_id } does not exist|
type = `error` ).
client->message_box_display( text = |Travel { travel_id } does not exist| type = `error` ).

ELSE.

Expand Down
3 changes: 1 addition & 2 deletions src/03/z2ui5_cl_smps_app_003.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ CLASS z2ui5_cl_smps_app_003 IMPLEMENTATION.
CustomerId,
Description
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

t_travels = VALUE #( FOR s_result IN t_result
( travel_id = |{ s_result-travelid ALPHA = OUT }|
Expand Down
3 changes: 1 addition & 2 deletions src/03/z2ui5_cl_smps_app_004.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ CLASS z2ui5_cl_smps_app_004 IMPLEMENTATION.
CustomerId,
Description
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

t_travels = VALUE #( FOR s_result IN t_result
( travel_id = |{ s_result-travelid ALPHA = OUT }|
Expand Down
3 changes: 1 addition & 2 deletions src/03/z2ui5_cl_smps_app_005.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ CLASS z2ui5_cl_smps_app_005 IMPLEMENTATION.
OverallStatus,
Description
ORDER BY TravelId DESCENDING
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

t_travels = VALUE #( FOR s_result IN t_result
( travel_id = |{ s_result-travelid ALPHA = OUT }|
Expand Down
3 changes: 1 addition & 2 deletions src/04/z2ui5_cl_smps_app_006.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ CLASS z2ui5_cl_smps_app_006 IMPLEMENTATION.
Description,
OverallStatus
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

" A draft shares the key of its active instance - only %is_draft tells
" the two apart. So reading the keys with %is_draft = on answers the
Expand Down
3 changes: 1 addition & 2 deletions src/04/z2ui5_cl_smps_app_007.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ CLASS z2ui5_cl_smps_app_007 IMPLEMENTATION.
TravelId,
Description
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

" see z2ui5_cl_smps_app_006 for what this read does - the description is
" read along so the table can show the draft next to the active instance
Expand Down
3 changes: 1 addition & 2 deletions src/04/z2ui5_cl_smps_app_008.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ CLASS z2ui5_cl_smps_app_008 IMPLEMENTATION.
SELECT FROM z2ui5_r_smps_trd
FIELDS TravelUuid
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

" read the DRAFT instances, not the active ones - so the form below
" shows what is currently in the draft, which is what gets changed
Expand Down
3 changes: 1 addition & 2 deletions src/04/z2ui5_cl_smps_app_009.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ CLASS z2ui5_cl_smps_app_009 IMPLEMENTATION.
SELECT FROM z2ui5_r_smps_trd
FIELDS TravelUuid
ORDER BY TravelId
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

READ ENTITIES OF z2ui5_r_smps_trd
ENTITY travel
Expand Down
3 changes: 1 addition & 2 deletions src/04/z2ui5_cl_smps_app_010.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ CLASS z2ui5_cl_smps_app_010 IMPLEMENTATION.
overallstatus,
description
ORDER BY travelid DESCENDING
INTO TABLE @DATA(t_result)
UP TO 20 ROWS.
INTO TABLE @DATA(t_result) UP TO 20 ROWS.

" a draft instance shares the key of its active instance - reading
" the keys with %is_draft = on reveals which travels have a draft
Expand Down
12 changes: 4 additions & 8 deletions src/06/z2ui5_cl_smps_app_485.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ CLASS z2ui5_cl_smps_app_485 IMPLEMENTATION.

METHOD initialize_view.

set_session_stateful( client = client
stateful = abap_true ).
set_session_stateful( client = client stateful = abap_true ).

DATA(view) = z2ui5_cl_ui5_view_builder=>factory(
)->ele( n = `View` ns = `mvc`
Expand Down Expand Up @@ -111,18 +110,15 @@ CLASS z2ui5_cl_smps_app_485 IMPLEMENTATION.

CASE client->get_event( ).
WHEN `BACK`.
set_session_stateful( client = client
stateful = abap_false ).
set_session_stateful( client = client stateful = abap_false ).
client->nav_app_leave( ).
WHEN `LOCK`.
lcl_locking=>acquire_lock( ).
client->message_toast_display( `Lock acquired. Press 'Refresh lock counter'` ).
WHEN `END_SESSION`.
set_session_stateful( client = client
stateful = abap_false ).
set_session_stateful( client = client stateful = abap_false ).
WHEN `START_SESSION`.
set_session_stateful( client = client
stateful = abap_true ).
set_session_stateful( client = client stateful = abap_true ).
WHEN `REFRESH`.
update_lock_counter( ).
WHEN `ROLLBACK`.
Expand Down
Loading