Skip to content

run ATC for any registered object#177

Merged
jfilak merged 7 commits into
jfilak:masterfrom
filak-sap:atc_run_any_object
Jun 18, 2026
Merged

run ATC for any registered object#177
jfilak merged 7 commits into
jfilak:masterfrom
filak-sap:atc_run_any_object

Conversation

@filak-sap

Copy link
Copy Markdown
Contributor

No description provided.

Two parallel implementations mapped human readable names to ADT object
proxies:

  - sap/adt/object_factory.py:human_names_factory
      - 4 kinds (program, program-include, class, package)
      - extensible via ADTObjectFactory.register
      - consumed by sap/cli/atc.py and sap/cli/aunit.py

  - sap/cli/activation.py:KIND_REGISTRY
      - 14 kinds plus 13 ABAP-style 4-char aliases (prog, clas, ...)
      - bare dict, not extensible
      - imports 11 concrete ADT classes directly into the cli layer

Having the richer registry live inside sap/cli/activation.py is a layer
violation: the cli module ends up importing every ADT class it might
ever instantiate, and the catalogue cannot be reused by other cli
modules.

Merge strategy
--------------
sap/adt/object_factory.py is the right home (it is already what atc and
aunit consume), so the merged catalogue is moved there. sap/cli
modules now depend only on sap.adt.object_factory and no longer import
concrete ADT classes for the sole purpose of looking them up by name.

Decisions
---------
* The merged human_names_factory exposes both the canonical, dash
  separated names (program, function-group, ...) and their ABAP-style
  4-char aliases (prog, fugr, ...). Each alias is registered with the
  exact same builder as its canonical counterpart so callers can rely
  on alias-vs-canonical equivalence.

* 'include' and 'program-include' are kept as two distinct keys.
  They have different semantics that pre-date this change:
    - 'include'         -> Include(connection, name) -- raw, no fetch;
                           used by activation to build a reference.
    - 'program-include' -> make_program_include_object -- parses the
                           'MAIN\\INC' notation and may fetch from the
                           server; used by atc/aunit.
  Collapsing them would silently change behaviour for either consumer.

* 'function-module' / 'function-include' (and the 'fm' alias) are
  preserved as registered kinds with their original (broken) builder,
  matching the previous behaviour of KIND_REGISTRY exactly. The
  underlying classes require an extra function_group_name constructor
  argument, so factory.make() still raises TypeError for them just as
  the old KIND_REGISTRY[kind](connection, name) did. Providing proper
  parser-builders for these kinds is a separate feature and out of
  scope for the registry merge.

* sap/cli/activation.py:--list-kinds previously printed
  '<kind> -> <ClassName>'. The class-name column required exposing
  internal builder details through the factory abstraction; it is
  dropped in favour of plain '<kind>' lines. The kinds themselves
  are unchanged.

* _parse_object_spec now takes the supported-kinds list as an
  argument instead of reading a module-level dict, so the helper no
  longer hard-codes a registry.

Tests
-----
* test_sap_adt_object_factory.py: one explicit test per canonical
  kind, one per alias, plus discoverability assertions on
  get_supported_names(). function-module / function-include /
  fm only assert registration, with comments documenting the
  pre-existing limitation.

* test_sap_cli_activation.py:test_alias_resolves_to_same_class:
  rewritten as a behaviour test that drives the CLI end-to-end with
  alias kinds (prog, clas, incl) instead of introspecting the now
  removed KIND_REGISTRY dict.

Closes the task described in .features/update_make_factory.md.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@filak-sap, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56b6ce92-986e-4fe4-aca5-46c8656fa28e

📥 Commits

Reviewing files that changed from the base of the PR and between 877758c and a67f1ed.

📒 Files selected for processing (28)
  • doc/commands/atc.md
  • sap/adt/function.py
  • sap/adt/object_factory.py
  • sap/cli/activation.py
  • sap/cli/atc.py
  • sap/cli/helpers.py
  • test/unit/mock.py
  • test/unit/test_sap_adt_function.py
  • test/unit/test_sap_adt_object_factory.py
  • test/unit/test_sap_adt_package.py
  • test/unit/test_sap_adt_repository.py
  • test/unit/test_sap_cli_abapgit.py
  • test/unit/test_sap_cli_adt.py
  • test/unit/test_sap_cli_atc.py
  • test/unit/test_sap_cli_badi.py
  • test/unit/test_sap_cli_checkin.py
  • test/unit/test_sap_cli_checkout.py
  • test/unit/test_sap_cli_cts.py
  • test/unit/test_sap_cli_featuretoggle.py
  • test/unit/test_sap_cli_gcts.py
  • test/unit/test_sap_cli_gcts_cmd_messages.py
  • test/unit/test_sap_cli_gcts_task.py
  • test/unit/test_sap_cli_include.py
  • test/unit/test_sap_cli_package.py
  • test/unit/test_sap_cli_rap.py
  • test/unit/test_sap_cli_startrfc.py
  • test/unit/test_sap_cli_strust.py
  • test/unit/test_sap_cli_user.py
📝 Walkthrough

Walkthrough

Expands human_names_factory in sap/adt/object_factory.py to map many additional canonical ADT object types and ABAP-style 4-character aliases. Adds factory helper functions for function modules and includes. The atc run CLI and activation objects CLI are updated to use this factory for runtime type validation, replacing static argparse choices and hardcoded KIND_REGISTRY. A comprehensive refactor of PatcherTestCase lifecycle management is applied uniformly across all test files to ensure consistent mock initialization and cleanup.

Changes

Object Factory Expansion, CLI Validation, and Test Infrastructure Refactor

Layer / File(s) Summary
Expand human_names_factory type catalog and aliases
sap/adt/object_factory.py, test/unit/test_sap_adt_object_factory.py
Factory now maintains separate canonical and aliases dicts mapping many ADT object type names (program, class, include, function-group, module, data-element, domain, table, structure, package, behavior-definition, message-class, transaction, cds-view) to builder callables. ABAP-style 4-char aliases (prog, incl, clas, etc.) resolve to the same builder as their canonical counterpart. New TestHumanNamesFactory validates canonical/alias resolution, program-include parsing, and get_supported_names() discoverability.
Add factory helpers for function modules and includes
sap/adt/function.py, test/unit/test_sap_adt_function.py
New make_function_module_object(connection, name) and make_function_include_object(connection, name) parse backslash-separated names, resolve function groups via FunctionModule.resolve_group when needed, and raise SAPCliError for invalid formats. Unit tests validate parsing, remote lookups, and error cases.
Add runtime object type validation helper
sap/cli/helpers.py
New raise_if_object_name_is_not_supported(object_type_name, supported_object_type_names) function validates type membership and raises SAPCliError with sorted supported types when unsupported. Updated import source from sap.rest.gcts.errors to sap.errors.
Wire ATC run command to use factory validation
sap/cli/atc.py, test/unit/test_sap_cli_atc.py, doc/commands/atc.md
Positional type argument removes static argparse choices restriction; factory is created early and args.type is validated at runtime against get_supported_names() via new validation helper, raising SAPCliError on failure. Documentation expanded to list all canonical types and aliases. Test updated to assert SAPCliError instead of argparse SystemExit.
Refactor activation objects command to use factory
sap/cli/activation.py, test/unit/test_sap_cli_activation.py
Removes hardcoded KIND_REGISTRY and direct ADT imports; _parse_object_spec gains supported_kinds parameter for validation; objects_activate uses human_names_factory(None) for --list-kinds and factory.make(kind, name) for object instantiation. Alias test rewritten as end-to-end CLI execution using short aliases.
Refactor PatcherTestCase and ConsoleOutputTestCase lifecycle
test/unit/mock.py
PatcherTestCase gains __init__ to initialize _patchers dict and _console_backup sentinel; patch() method simplified to assume initialization and use patcher.start(); patch_console() guards against double-patching; unpatch_all() uses patcher.stop(). ConsoleOutputTestCase adds setUp() with super() chaining and new tearDown() method.
Apply PatcherTestCase lifecycle pattern to all test classes
test/unit/test_sap_adt_*.py, test/unit/test_sap_cli_*.py
Uniform pattern applied across ~80 test classes: reorder base classes to (ConsoleOutputTestCase, PatcherTestCase) where applicable, add explicit __init__ calling PatcherTestCase.__init__, add tearDown calling PatcherTestCase.unpatch_all() in try/finally. Ensures consistent mock initialization and cleanup across entire test suite.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • jfilak/sapcli#162: Adds BehaviorDefinition implementation and its CLI commands, which depends on this PR's expanded factory support for the behavior-definition object type.
  • jfilak/sapcli#166: Implements sap/adt/messageclass.py and exports the MessageClass ADT object, which is registered in this PR's expanded human_names_factory for the message-class object type.
  • jfilak/sapcli#168: Introduces the original KIND_REGISTRY and _parse_object_spec validation pattern in sap/cli/activation.py that this PR replaces with factory-driven lookup.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, making it difficult to understand the intent and scope beyond what the title suggests. Add a detailed PR description explaining the motivation, changes made, and any breaking changes or migration steps for users.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: expanding ATC run command to support any registered object type, not just a limited set.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 14

🧹 Nitpick comments (3)
test/unit/test_sap_adt_object_factory.py (1)

137-147: ⚡ Quick win

Align these tests with user-facing behavior, not just registration presence.

These checks currently validate only that function-module/fm appear in supported names. Given CLI flows call factory.make(kind, name), this can preserve a broken contract unnoticed. Please assert the real behavior (constructible with CLI input, or intentionally unsupported).

Also applies to: 211-214

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_object_factory.py` around lines 137 - 147, The tests
test_function_module_is_registered and test_function_include_is_registered
currently only verify that the object types exist in the factory's supported
names registry. These should be enhanced to validate actual user-facing behavior
by either attempting to construct instances using factory.make() with valid CLI
input to confirm they work, or explicitly asserting that they're intentionally
unsupported in the factory. This ensures the contract between the factory and
CLI flows is preserved correctly rather than just checking registration
presence.
test/unit/test_sap_cli_activation.py (1)

374-375: ⚡ Quick win

Keep test assertions sequential (avoid loop/comprehension style).

Please replace the list-comprehension assertion with explicit ordered assertions.

♻️ Suggested change
-        names = [ref.name for ref in sent_refs.references]
-        self.assertEqual(names, ['ZMYREP', 'CL_FOO', 'ZMYREP_C01'])
+        self.assertEqual(len(sent_refs.references), 3)
+        self.assertEqual(sent_refs.references[0].name, 'ZMYREP')
+        self.assertEqual(sent_refs.references[1].name, 'CL_FOO')
+        self.assertEqual(sent_refs.references[2].name, 'ZMYREP_C01')

As per coding guidelines, "Write tests sequentially without loops."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_activation.py` around lines 374 - 375, The test at
lines 374-375 uses a list comprehension to extract names from
sent_refs.references and then compares them with a single assertEqual call.
Replace this with explicit sequential assertions for each reference name in
order. Instead of creating the names list through comprehension, assert each
reference name individually in sequence, checking that
sent_refs.references[0].name equals 'ZMYREP', then sent_refs.references[1].name
equals 'CL_FOO', and finally sent_refs.references[2].name equals 'ZMYREP_C01'.
This follows the coding guideline of writing tests sequentially without loops or
comprehensions.

Source: Coding guidelines

test/unit/mock.py (1)

447-449: ⚡ Quick win

Fix __ini_t__ typo (dead method).

ConsoleOutputTestCase.__ini_t__ is never called by Python object initialization. Rename it to __init__ (or remove it) to avoid misleading dead code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/mock.py` around lines 447 - 449, The ConsoleOutputTestCase class
has a method named __ini_t__ which is a typo and acts as dead code since
Python's object initialization looks for __init__, not __ini_t__. Rename the
__ini_t__ method to __init__ in the ConsoleOutputTestCase class to ensure it is
properly called during object initialization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@doc/commands/atc.md`:
- Line 29: In the atc command synopsis on line 29 of doc/commands/atc.md, fix
the typo in the CLI option name by changing MAX_VERDICITS to MAX_VERDICTS. This
ensures the documentation accurately reflects the correct option name and
maintains consistency with the actual semantics of what the option represents.

In `@sap/adt/object_factory.py`:
- Around line 68-70: Remove the mapping for 'function-module' from the object
factory's supported kinds (the line containing 'function-module':
sap.adt.FunctionModule in the diff and the corresponding entry at line 90
mentioned in "Also applies to"). Since FunctionModule requires additional
constructor arguments beyond just connection and name, it cannot be instantiated
by downstream callers in sap/cli/atc.py and sap/cli/activation.py that use
factory.make with only two arguments. Removing this mapping prevents the
TypeError and ensures only properly constructible kinds are advertised as
supported by the factory.

In `@test/unit/mock.py`:
- Around line 425-443: The patch method retrieves the old console value from
set_console(console) and stores it in the local variable old_console, but never
saves it to self._console_backup. This causes unpatch_all() to fail restoring
the console state since self._console_backup remains unset. After the double
patch check in the patch method, assign old_console to self._console_backup so
that the backup is available when unpatch_all() attempts to restore the original
console state.

In `@test/unit/test_sap_cli_abapgit.py`:
- Around line 29-30: The tearDown() method at line 29-30 is not chaining to the
parent class's tearDown method, which can cause test state leakage. Modify the
tearDown() method to call super().tearDown() in addition to the existing
PatcherTestCase.unpatch_all(self) call, ensuring proper cleanup sequencing with
the base class. Apply the same fix to the other tearDown() method mentioned at
lines 108-109.

In `@test/unit/test_sap_cli_adt.py`:
- Around line 20-21: The tearDown method in the test class is not calling the
parent class's tearDown method from ConsoleOutputTestCase, which breaks the
cooperative teardown chain and leaves shared test state uncleared. Modify the
tearDown method to call the parent class's tearDown method (using super() or
explicit parent call) before or after calling PatcherTestCase.unpatch_all(self),
ensuring that the complete teardown lifecycle is preserved for all base classes
in the inheritance hierarchy.

In `@test/unit/test_sap_cli_badi.py`:
- Around line 46-47: The tearDown method in the test class only calls
PatcherTestCase.unpatch_all(self) but does not invoke the parent class's
tearDown logic, which causes per-test state to leak. Add a call to
super().tearDown() after the unpatch_all call in the tearDown method to ensure
all parent cleanup logic is executed.

In `@test/unit/test_sap_cli_checkin.py`:
- Around line 280-281: The tearDown() method overrides are skipping the
superclass teardown logic, which prevents required cleanup from
ConsoleOutputTestCase.tearDown() from executing. Fix the tearDown() method at
line 280-281 and all other occurrences (at lines 458-459, 513-514, 623-624,
779-780, 868-869, 1029-1030) by ensuring each override calls the superclass
tearDown method in addition to calling PatcherTestCase.unpatch_all(self). Add a
call to super().tearDown() or explicitly call the parent class tearDown method
to preserve the complete cleanup chain and ensure tests are not order-dependent.

In `@test/unit/test_sap_cli_checkout.py`:
- Around line 538-539: The tearDown method in this test class is calling
PatcherTestCase.unpatch_all(self) but not invoking super().tearDown(), which
skips cleanup from parent classes like ConsoleOutputTestCase. Add a call to
super().tearDown() within the tearDown method to ensure the parent class cleanup
logic is executed and the teardown chaining remains intact.

In `@test/unit/test_sap_cli_cts.py`:
- Around line 150-151: The tearDown() method overrides the superclass method but
does not chain to super().tearDown(), causing the base class cleanup logic to be
skipped. Add a call to super().tearDown() in the tearDown() method to ensure
proper lifecycle handling and preserve base teardown behavior. This same issue
applies to the additional tearDown method overrides at lines 210-211 and 262-263
in this file.

In `@test/unit/test_sap_cli_featuretoggle.py`:
- Around line 30-31: The tearDown method only calls
PatcherTestCase.unpatch_all(self) without invoking the parent class's teardown
logic, which suppresses the base class cleanup and can leak test state. Add a
call to super().tearDown() after the unpatch_all call in the tearDown method to
ensure the parent class cleanup behavior is properly chained and executed.

In `@test/unit/test_sap_cli_gcts_cmd_messages.py`:
- Around line 34-35: The tearDown method in the test class is not calling the
parent class's tearDown method, which means cleanup from ConsoleOutputTestCase
is being skipped. Add a call to super().tearDown() in the tearDown method to
ensure that the parent class cleanup runs after
PatcherTestCase.unpatch_all(self) completes.

In `@test/unit/test_sap_cli_gcts.py`:
- Around line 187-188: The tearDown method overrides the parent class method but
does not call super().tearDown(), which breaks the unittest framework's
lifecycle chaining and skips parent class cleanup. For all tearDown methods in
this file that follow this pattern (only calling
PatcherTestCase.unpatch_all(self)), add a super().tearDown() call to ensure the
parent class teardown is properly invoked. This maintains proper unittest
lifecycle regardless of the inheritance hierarchy and ensures all base class
cleanup happens.

In `@test/unit/test_sap_cli_package.py`:
- Around line 171-172: The tearDown method in the test classes only calls
PatcherTestCase.unpatch_all(self) but does not chain to the parent class's
tearDown method, which breaks the unittest cleanup lifecycle. Modify the
tearDown methods (found at lines 171-172, 267-268, and 311-312) to call
super().tearDown() after calling PatcherTestCase.unpatch_all(self) to ensure
proper cleanup chaining and preserve base teardown behavior in all test class
hierarchies.

In `@test/unit/test_sap_cli_strust.py`:
- Around line 380-381: The tearDown method overrides in this file only call
PatcherTestCase.unpatch_all(self) but do not invoke the parent class's teardown
lifecycle. Update all tearDown method implementations in the file to call
super().tearDown() after calling PatcherTestCase.unpatch_all(self) to ensure
proper base class cleanup and maintain unittest framework lifecycle chaining.

---

Nitpick comments:
In `@test/unit/mock.py`:
- Around line 447-449: The ConsoleOutputTestCase class has a method named
__ini_t__ which is a typo and acts as dead code since Python's object
initialization looks for __init__, not __ini_t__. Rename the __ini_t__ method to
__init__ in the ConsoleOutputTestCase class to ensure it is properly called
during object initialization.

In `@test/unit/test_sap_adt_object_factory.py`:
- Around line 137-147: The tests test_function_module_is_registered and
test_function_include_is_registered currently only verify that the object types
exist in the factory's supported names registry. These should be enhanced to
validate actual user-facing behavior by either attempting to construct instances
using factory.make() with valid CLI input to confirm they work, or explicitly
asserting that they're intentionally unsupported in the factory. This ensures
the contract between the factory and CLI flows is preserved correctly rather
than just checking registration presence.

In `@test/unit/test_sap_cli_activation.py`:
- Around line 374-375: The test at lines 374-375 uses a list comprehension to
extract names from sent_refs.references and then compares them with a single
assertEqual call. Replace this with explicit sequential assertions for each
reference name in order. Instead of creating the names list through
comprehension, assert each reference name individually in sequence, checking
that sent_refs.references[0].name equals 'ZMYREP', then
sent_refs.references[1].name equals 'CL_FOO', and finally
sent_refs.references[2].name equals 'ZMYREP_C01'. This follows the coding
guideline of writing tests sequentially without loops or comprehensions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07d6a10a-c013-48f6-8fcb-28cb08fe2841

📥 Commits

Reviewing files that changed from the base of the PR and between 555226a and ae33a87.

📒 Files selected for processing (26)
  • doc/commands/atc.md
  • sap/adt/object_factory.py
  • sap/cli/activation.py
  • sap/cli/atc.py
  • test/unit/mock.py
  • test/unit/test_sap_adt_object_factory.py
  • test/unit/test_sap_adt_package.py
  • test/unit/test_sap_adt_repository.py
  • test/unit/test_sap_cli_abapgit.py
  • test/unit/test_sap_cli_activation.py
  • test/unit/test_sap_cli_adt.py
  • test/unit/test_sap_cli_atc.py
  • test/unit/test_sap_cli_badi.py
  • test/unit/test_sap_cli_checkin.py
  • test/unit/test_sap_cli_checkout.py
  • test/unit/test_sap_cli_cts.py
  • test/unit/test_sap_cli_featuretoggle.py
  • test/unit/test_sap_cli_gcts.py
  • test/unit/test_sap_cli_gcts_cmd_messages.py
  • test/unit/test_sap_cli_gcts_task.py
  • test/unit/test_sap_cli_include.py
  • test/unit/test_sap_cli_package.py
  • test/unit/test_sap_cli_rap.py
  • test/unit/test_sap_cli_startrfc.py
  • test/unit/test_sap_cli_strust.py
  • test/unit/test_sap_cli_user.py

Comment thread doc/commands/atc.md
```

* _OBJECT\_NAME_ package, class or program name
sapcli atc run OBJECT_TYPE OBJECT_NAME [OBJECT_NAME ...] [-r VARIANT] [-e ERROR_LEVEL] [-m MAX_VERDICITS] [-o {human,html,checkstyle}] [-s SEVERITY_MAPPING] [-f PRIORITY_FILTER]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in CLI synopsis option name.

MAX_VERDICITS should be MAX_VERDICTS to match the actual option semantics and avoid copy/paste confusion.

✏️ Suggested fix
-sapcli atc run OBJECT_TYPE OBJECT_NAME [OBJECT_NAME ...] [-r VARIANT] [-e ERROR_LEVEL] [-m MAX_VERDICITS] [-o {human,html,checkstyle}] [-s SEVERITY_MAPPING] [-f PRIORITY_FILTER]
+sapcli atc run OBJECT_TYPE OBJECT_NAME [OBJECT_NAME ...] [-r VARIANT] [-e ERROR_LEVEL] [-m MAX_VERDICTS] [-o {human,html,checkstyle}] [-s SEVERITY_MAPPING] [-f PRIORITY_FILTER]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sapcli atc run OBJECT_TYPE OBJECT_NAME [OBJECT_NAME ...] [-r VARIANT] [-e ERROR_LEVEL] [-m MAX_VERDICITS] [-o {human,html,checkstyle}] [-s SEVERITY_MAPPING] [-f PRIORITY_FILTER]
sapcli atc run OBJECT_TYPE OBJECT_NAME [OBJECT_NAME ...] [-r VARIANT] [-e ERROR_LEVEL] [-m MAX_VERDICTS] [-o {human,html,checkstyle}] [-s SEVERITY_MAPPING] [-f PRIORITY_FILTER]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/commands/atc.md` at line 29, In the atc command synopsis on line 29 of
doc/commands/atc.md, fix the typo in the CLI option name by changing
MAX_VERDICITS to MAX_VERDICTS. This ensures the documentation accurately
reflects the correct option name and maintains consistency with the actual
semantics of what the option represents.

Comment thread sap/adt/object_factory.py Outdated
Comment thread test/unit/mock.py Outdated
Comment thread test/unit/test_sap_cli_abapgit.py Outdated
Comment thread test/unit/test_sap_cli_adt.py Outdated
Comment thread test/unit/test_sap_cli_featuretoggle.py Outdated
Comment thread test/unit/test_sap_cli_gcts_cmd_messages.py Outdated
Comment thread test/unit/test_sap_cli_gcts.py Outdated
Comment thread test/unit/test_sap_cli_package.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/unit/test_sap_adt_function.py (1)

254-293: ⚡ Quick win

Consider adding edge-case tests for empty name parts.

The current test suite covers valid 2-part input ("GROUP\\NAME"), 1-part input (triggering remote lookup), and 3-part error case. Adding tests for malformed 2-part inputs with empty segments (e.g., "GROUP\\", "\\NAME", or "\\") would verify that the factory raises SAPCliError with a clear message rather than constructing invalid FunctionModule objects.

This aligns with the validation pattern used in make_function_include_object and would catch the missing validation flagged in the production code review.

📋 Example test for empty parts
def test_make_with_empty_group_raises(self):
    connection = Connection()

    with self.assertRaises(SAPCliError) as caught:
        sap.adt.function.make_function_module_object(connection, '\\Z_FN_HELLO_WORLD')

    self.assertEqual(
        str(caught.exception),
        'Function module name can be: FUNCTION_NAME or FUNCTION_GROUP\\FUNCTION_NAME'
    )

def test_make_with_empty_name_raises(self):
    connection = Connection()

    with self.assertRaises(SAPCliError) as caught:
        sap.adt.function.make_function_module_object(connection, 'ZFG_HELLO_WORLD\\')

    self.assertEqual(
        str(caught.exception),
        'Function module name can be: FUNCTION_NAME or FUNCTION_GROUP\\FUNCTION_NAME'
    )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_function.py` around lines 254 - 293, The
TestMakeFunctionModuleObject test class needs additional edge-case tests to
validate that malformed two-part inputs with empty segments are properly
rejected. Add test methods test_make_with_empty_group_raises and
test_make_with_empty_name_raises to the TestMakeFunctionModuleObject class. Each
test should verify that calling make_function_module_object with inputs like
\Z_FN_HELLO_WORLD (empty group) or ZFG_HELLO_WORLD\ (empty name) raises a
SAPCliError with the message "Function module name can be: FUNCTION_NAME or
FUNCTION_GROUP\FUNCTION_NAME". This ensures the validation in
make_function_module_object properly handles malformed input formats rather than
constructing invalid FunctionModule objects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sap/adt/function.py`:
- Around line 498-514: The condition in the make_function_module_object function
at the check for len(name_parts) == 2 does not verify that both parts of the
split name are non-empty strings. This allows invalid inputs like "GROUP\\" or
"\\NAME" to pass validation and create invalid FunctionModule objects. Update
the condition to also check that name_parts[0] and name_parts[1] are both truthy
(non-empty), matching the pattern already used correctly in the sibling function
make_function_include_object. This ensures that empty group names or empty
function names are rejected early with a clear error message.

---

Nitpick comments:
In `@test/unit/test_sap_adt_function.py`:
- Around line 254-293: The TestMakeFunctionModuleObject test class needs
additional edge-case tests to validate that malformed two-part inputs with empty
segments are properly rejected. Add test methods
test_make_with_empty_group_raises and test_make_with_empty_name_raises to the
TestMakeFunctionModuleObject class. Each test should verify that calling
make_function_module_object with inputs like \Z_FN_HELLO_WORLD (empty group) or
ZFG_HELLO_WORLD\ (empty name) raises a SAPCliError with the message "Function
module name can be: FUNCTION_NAME or FUNCTION_GROUP\FUNCTION_NAME". This ensures
the validation in make_function_module_object properly handles malformed input
formats rather than constructing invalid FunctionModule objects.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7c8ad0c-1cce-490d-af8c-b5cca0a516be

📥 Commits

Reviewing files that changed from the base of the PR and between 9aacef6 and ebac4e1.

📒 Files selected for processing (4)
  • sap/adt/function.py
  • sap/adt/object_factory.py
  • test/unit/test_sap_adt_function.py
  • test/unit/test_sap_adt_object_factory.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • sap/adt/object_factory.py
  • test/unit/test_sap_adt_object_factory.py

Comment thread sap/adt/function.py
@filak-sap filak-sap force-pushed the atc_run_any_object branch from ebac4e1 to 877758c Compare June 18, 2026 20:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 20

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

♻️ Duplicate comments (6)
test/unit/test_sap_cli_badi.py (1)

46-51: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally block.

Line 50 uses 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() call should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_badi.py` around lines 46 - 51, In the tearDown method,
the super().tearDown() call inside the finally block has incorrect indentation
with only 3 spaces instead of 4. Fix the indentation of the super().tearDown()
line to use 8 spaces total (2 levels of indentation: 4 spaces for the method
body plus 4 spaces for the finally block) to comply with PEP 8 standards.
test/unit/test_sap_cli_adt.py (1)

20-25: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally block.

Line 24 uses 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() call should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_adt.py` around lines 20 - 25, In the `tearDown`
method, the `super().tearDown()` call within the `finally` block has incorrect
indentation with only 3 spaces instead of 4 spaces. Fix the indentation by
adding one more space so that the `super().tearDown()` statement is indented
with 8 spaces total (two levels of 4 spaces each), conforming to PEP 8 style
standards.
test/unit/test_sap_cli_checkout.py (1)

538-543: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally block.

Line 542 uses 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() call should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_checkout.py` around lines 538 - 543, In the tearDown
method, the super().tearDown() call in the finally block has incorrect
indentation with only 3 spaces instead of the required 4 spaces. Fix the
indentation of the super().tearDown() line to use 8 spaces total (2 levels of
indentation, 4 spaces per level) to comply with PEP 8 standards and match the
indentation level expected for code inside the finally block.
test/unit/test_sap_cli_cts.py (1)

150-155: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally blocks across all test classes.

Lines 154, 217, and 272 use 3 spaces of indentation instead of 4, violating PEP 8. All super().tearDown() calls in finally blocks should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()

Apply this fix to all three test classes: TestCTSRelease, TestCTSDelete, and TestCTSReassign.

Also applies to: 213-218, 268-273

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_cts.py` around lines 150 - 155, The
`super().tearDown()` call in the `finally` blocks of the tearDown() methods
across three test classes (TestCTSRelease, TestCTSDelete, and TestCTSReassign)
has incorrect indentation. Fix the indentation on line 154 in the tearDown
method shown in the diff, and also on lines 217 and 272 in the other test
classes, changing from 3 spaces to 4 spaces of indentation. This ensures each
super().tearDown() call is properly indented with 8 spaces total (2 levels of 4
spaces each) to comply with PEP 8 standards.
test/unit/test_sap_cli_checkin.py (1)

280-285: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally blocks across all test classes.

Lines 284, 465, 523, 636, 795, 887, and 1051 use 3 spaces of indentation instead of 4, violating PEP 8. All super().tearDown() calls in finally blocks should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()

Apply this fix to all seven test classes: TestCheckIn, TestActivate, TestCheckInPackage, TestCheckInClass, TestCheckInInterface, TestCheckInProgram, and TestCheckInFunctionGroup.

Also applies to: 461-466, 519-524, 632-637, 791-796, 883-888, 1047-1052

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_checkin.py` around lines 280 - 285, The
`super().tearDown()` call in the `finally` blocks of the `tearDown` method
across multiple test classes has incorrect indentation of 3 spaces instead of 4,
violating PEP 8 standards. Locate all seven occurrences in the test classes
TestCheckIn, TestActivate, TestCheckInPackage, TestCheckInClass,
TestCheckInInterface, TestCheckInProgram, and TestCheckInFunctionGroup where
`super().tearDown()` appears in the `finally` block, and correct each to use 4
spaces of indentation (8 spaces total from the line start, representing 2 levels
of indentation).
test/unit/test_sap_cli_abapgit.py (1)

29-34: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally blocks.

Lines 33 and 115 use 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() calls should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()

Apply this fix to both TestAbapgitLink.tearDown() (line 33) and TestAbapgitPull.tearDown() (line 115).

Also applies to: 111-116

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_abapgit.py` around lines 29 - 34, The tearDown methods
in both TestAbapgitLink and TestAbapgitPull classes have incorrect indentation
in their finally blocks. The super().tearDown() statement on line 33
(TestAbapgitLink) and line 115 (TestAbapgitPull) use only 3 spaces of
indentation instead of 4, violating PEP 8. Fix both occurrences by adding one
additional space to each super().tearDown() call so that it aligns with proper
Python indentation standards (8 spaces total: 4 for method body plus 4 for
finally block).
🟡 Minor comments (3)
test/unit/test_sap_adt_package.py-134-139 (1)

134-139: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally block.

Line 138 uses 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() call should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_package.py` around lines 134 - 139, The
`super().tearDown()` call in the finally block of the tearDown method has
incorrect indentation with only 3 spaces instead of 4. Fix the indentation by
ensuring the line has 8 spaces total (two levels of 4-space indentation) to
comply with PEP 8 standards. The super().tearDown() statement should be at the
same indentation level as the PatcherTestCase.unpatch_all(self) call above it.
test/unit/test_sap_adt_repository.py-21-26 (1)

21-26: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation in finally block.

Line 25 uses 3 spaces of indentation instead of 4, violating PEP 8. The super().tearDown() call should be indented with 8 spaces total (2 levels of 4 spaces each).

🔧 Proposed fix
     def tearDown(self):
         try:
             PatcherTestCase.unpatch_all(self)
         finally:
-           super().tearDown()
+            super().tearDown()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_repository.py` around lines 21 - 26, The
`super().tearDown()` call in the `finally` block of the `tearDown` method uses
incorrect indentation of 3 spaces instead of 4 spaces, violating PEP 8
standards. Fix the indentation of the `super().tearDown()` line by adding one
additional space so it has 4 spaces of indentation relative to the `finally`
keyword, bringing it to 12 spaces total (3 levels of 4-space indentation).
test/unit/test_sap_cli_user.py-34-34 (1)

34-34: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix finally-block indentation to satisfy lint gates.

Line 34, Line 75, and Line 119 are indented with a non-4-space multiple (E111). Align super().tearDown() to the block indentation used elsewhere.

Also applies to: 75-75, 119-119

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_cli_user.py` at line 34, Fix indentation issues on lines
34, 75, and 119 where `super().tearDown()` calls are indented with non-4-space
multiples causing E111 lint errors. Re-indent each occurrence of
`super().tearDown()` to use proper 4-space indentation that aligns with the
surrounding block indentation pattern used in the rest of the test file.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/unit/mock.py`:
- Around line 447-448: The method in the ConsoleOutputTestCase class is
incorrectly named `__ini_t__` instead of `__init__`, which prevents Python from
recognizing it as the constructor. Fix this by renaming the method from
`__ini_t__` to `__init__` so that the super().__init__(*args, **kwargs) call is
properly invoked during object initialization.

In `@test/unit/test_sap_cli_featuretoggle.py`:
- Around line 30-34: The super().tearDown() call in the finally block of the
tearDown method has incorrect indentation (appears to be 3 spaces instead of 4).
Locate the tearDown method and fix the indentation of the super().tearDown()
line to use 4 spaces to match the proper Python indentation level required by
PEP 8 for the statement within the finally block.

In `@test/unit/test_sap_cli_gcts_cmd_messages.py`:
- Around line 34-38: The `finally` block in the `tearDown` method has
inconsistent indentation on the line containing `super().tearDown()`. Fix this
by ensuring that the `super().tearDown()` statement is indented with 8 spaces
(two levels of indentation) to align properly with the statement in the try
block above it, following PEP 8 standards.

In `@test/unit/test_sap_cli_gcts_task.py`:
- Around line 23-27: The super().tearDown() call in the finally block of the
tearDown method has incorrect indentation with 3 spaces instead of 4 spaces. Fix
this by ensuring the super().tearDown() line is indented with exactly 4 spaces
from the finally block, making it consistent with the rest of the codebase and
compliant with PEP 8 style guidelines.

In `@test/unit/test_sap_cli_include.py`:
- Around line 117-121: The finally block in the tearDown method has incorrect
indentation on the line containing super().tearDown(). The indentation is not a
multiple of 4 spaces as required by PEP 8. Fix the indentation of the
super().tearDown() call in the finally block to align it consistently with the
indentation level of the try block content above it, ensuring all indentation
uses multiples of 4 spaces.

In `@test/unit/test_sap_cli_package.py`:
- Around line 317-321: The finally block in the tearDown method has incorrect
indentation on the line containing super().tearDown(). The indentation uses
inconsistent spacing (appears to be 3 spaces) instead of the standard 4 spaces
required by PEP 8. Fix the indentation of the super().tearDown() line to align
properly with the expected indentation level, using 4 spaces to match Python's
standard indentation convention.
- Around line 270-274: The `super().tearDown()` line inside the `finally` block
of the `tearDown` method has incorrect indentation (appears to use 3 spaces
instead of 4). Fix the indentation by ensuring that the `super().tearDown()`
statement is properly indented with exactly 4 spaces from the start of the line,
matching the standard Python indentation level for code within the `finally`
block that contains the `PatcherTestCase.unpatch_all(self)` call.
- Around line 171-175: The indentation on the line containing super().tearDown()
in the finally block of the tearDown method is incorrect and does not align with
PEP 8 standards. Fix the indentation of the super().tearDown() statement to use
exactly 12 spaces (3 levels of 4-space indentation) so it properly aligns with
the code in the try block above it and maintains consistency with the method's
indentation structure.

In `@test/unit/test_sap_cli_rap.py`:
- Around line 32-36: The tearDown method has an indentation error on the line
containing super().tearDown() within the finally block. The indentation is not a
multiple of 4 spaces and does not align with the try block statement above it.
Correct the indentation of the super().tearDown() line in the finally block to
use proper Python indentation (8 spaces total - matching the indentation level
of PatcherTestCase.unpatch_all(self) in the try block above it) to comply with
PEP 8 standards.
- Around line 233-237: Fix the indentation in the tearDown method's finally
block. The super().tearDown() statement under the finally clause should be
indented with a multiple of 4 spaces to align properly with PEP 8 standards.
Ensure the finally block content is indented 8 spaces from the method definition
to maintain consistency with the try block structure above it.

In `@test/unit/test_sap_cli_startrfc.py`:
- Around line 36-40: The finally block in the tearDown method has incorrect
indentation on the super().tearDown() line. Fix the indentation of the
super().tearDown() call to use exactly 4 spaces from the start of the finally
block, ensuring it aligns properly with Python's PEP 8 standards of consistent
4-space indentation per level. The line should be indented to the same level as
the try and finally statements' content.

In `@test/unit/test_sap_cli_strust.py`:
- Around line 730-734: The `super().tearDown()` line in the tearDown method has
incorrect indentation (appears to be 3 spaces instead of a multiple of 4). Fix
this by ensuring that the line inside the finally block is properly indented
with 8 spaces to match the standard PEP 8 indentation and align with the try
block content above it.
- Around line 1077-1081: The finally block in the tearDown method has
inconsistent indentation. The super().tearDown() statement on the line following
the finally clause is indented with 3 spaces instead of 4 spaces. Fix the
indentation by adding one more space to align the super().tearDown() statement
with the PatcherTestCase.unpatch_all(self) line in the try block above it,
ensuring both blocks use consistent 4-space indentation per PEP 8 standards.
- Around line 1024-1028: The finally block within the tearDown method has
inconsistent indentation (3 spaces instead of 4). Fix the indentation of the
super().tearDown() line inside the finally block to use 4 spaces, matching the
indentation level of the try block content. Ensure all indentation is a multiple
of 4 spaces as required by PEP 8 and Python syntax rules.
- Around line 648-652: The finally block in the tearDown method has incorrect
indentation. The super().tearDown() call inside the finally block is indented
with only 3 spaces instead of the proper 8 spaces required by PEP 8 (4 spaces
for the method body level plus 4 additional spaces for being inside the finally
block). Fix this by correcting the indentation of the super().tearDown() line to
align properly with the code block structure, ensuring it uses multiples of 4
spaces as required by Python style guidelines.
- Around line 503-507: The tearDown method has incorrect indentation in the
finally block where super().tearDown() is called. The line has non-standard
spacing (not a multiple of 4 spaces). Fix this by ensuring the
super().tearDown() call is properly indented with exactly 4 spaces to align with
the standard Python PEP 8 indentation rules, matching the indentation level of
the code inside the try block above it.
- Around line 918-922: The `super().tearDown()` statement inside the `finally`
block of the `tearDown` method has incorrect indentation with only 3 spaces
instead of the required 4 spaces. Fix the indentation by adding one more space
before `super().tearDown()` to ensure it is properly indented as a statement
within the `finally` block, making it align with Python's PEP 8 standard of
4-space indentation.
- Around line 1137-1141: The indentation of the super().tearDown() statement
inside the finally block of the tearDown method is incorrect and does not follow
Python's PEP 8 standard of using multiples of 4 spaces. Fix this by adjusting
the indentation of the super().tearDown() line to be properly indented at 4
spaces relative to the finally statement, ensuring consistent indentation
throughout the method.
- Around line 812-816: The finally block in the tearDown method has incorrect
indentation on the line containing super().tearDown(). The line currently has 3
spaces of indentation but should have 8 spaces (matching the indentation level
of the try block content above it) to comply with PEP 8 standard 4-space
indentation. Fix the indentation of the super().tearDown() call to align
properly with the try block.
- Around line 380-384: The indentation of the super().tearDown() statement in
the finally block of the tearDown method is incorrect. Fix the indentation by
ensuring super().tearDown() has consistent spacing (8 spaces total, matching the
indentation level of PatcherTestCase.unpatch_all(self) in the try block above
it) to comply with Python's PEP 8 standard that requires indentation to be a
multiple of 4 spaces.

---

Minor comments:
In `@test/unit/test_sap_adt_package.py`:
- Around line 134-139: The `super().tearDown()` call in the finally block of the
tearDown method has incorrect indentation with only 3 spaces instead of 4. Fix
the indentation by ensuring the line has 8 spaces total (two levels of 4-space
indentation) to comply with PEP 8 standards. The super().tearDown() statement
should be at the same indentation level as the PatcherTestCase.unpatch_all(self)
call above it.

In `@test/unit/test_sap_adt_repository.py`:
- Around line 21-26: The `super().tearDown()` call in the `finally` block of the
`tearDown` method uses incorrect indentation of 3 spaces instead of 4 spaces,
violating PEP 8 standards. Fix the indentation of the `super().tearDown()` line
by adding one additional space so it has 4 spaces of indentation relative to the
`finally` keyword, bringing it to 12 spaces total (3 levels of 4-space
indentation).

In `@test/unit/test_sap_cli_user.py`:
- Line 34: Fix indentation issues on lines 34, 75, and 119 where
`super().tearDown()` calls are indented with non-4-space multiples causing E111
lint errors. Re-indent each occurrence of `super().tearDown()` to use proper
4-space indentation that aligns with the surrounding block indentation pattern
used in the rest of the test file.

---

Duplicate comments:
In `@test/unit/test_sap_cli_abapgit.py`:
- Around line 29-34: The tearDown methods in both TestAbapgitLink and
TestAbapgitPull classes have incorrect indentation in their finally blocks. The
super().tearDown() statement on line 33 (TestAbapgitLink) and line 115
(TestAbapgitPull) use only 3 spaces of indentation instead of 4, violating PEP
8. Fix both occurrences by adding one additional space to each
super().tearDown() call so that it aligns with proper Python indentation
standards (8 spaces total: 4 for method body plus 4 for finally block).

In `@test/unit/test_sap_cli_adt.py`:
- Around line 20-25: In the `tearDown` method, the `super().tearDown()` call
within the `finally` block has incorrect indentation with only 3 spaces instead
of 4 spaces. Fix the indentation by adding one more space so that the
`super().tearDown()` statement is indented with 8 spaces total (two levels of 4
spaces each), conforming to PEP 8 style standards.

In `@test/unit/test_sap_cli_badi.py`:
- Around line 46-51: In the tearDown method, the super().tearDown() call inside
the finally block has incorrect indentation with only 3 spaces instead of 4. Fix
the indentation of the super().tearDown() line to use 8 spaces total (2 levels
of indentation: 4 spaces for the method body plus 4 spaces for the finally
block) to comply with PEP 8 standards.

In `@test/unit/test_sap_cli_checkin.py`:
- Around line 280-285: The `super().tearDown()` call in the `finally` blocks of
the `tearDown` method across multiple test classes has incorrect indentation of
3 spaces instead of 4, violating PEP 8 standards. Locate all seven occurrences
in the test classes TestCheckIn, TestActivate, TestCheckInPackage,
TestCheckInClass, TestCheckInInterface, TestCheckInProgram, and
TestCheckInFunctionGroup where `super().tearDown()` appears in the `finally`
block, and correct each to use 4 spaces of indentation (8 spaces total from the
line start, representing 2 levels of indentation).

In `@test/unit/test_sap_cli_checkout.py`:
- Around line 538-543: In the tearDown method, the super().tearDown() call in
the finally block has incorrect indentation with only 3 spaces instead of the
required 4 spaces. Fix the indentation of the super().tearDown() line to use 8
spaces total (2 levels of indentation, 4 spaces per level) to comply with PEP 8
standards and match the indentation level expected for code inside the finally
block.

In `@test/unit/test_sap_cli_cts.py`:
- Around line 150-155: The `super().tearDown()` call in the `finally` blocks of
the tearDown() methods across three test classes (TestCTSRelease, TestCTSDelete,
and TestCTSReassign) has incorrect indentation. Fix the indentation on line 154
in the tearDown method shown in the diff, and also on lines 217 and 272 in the
other test classes, changing from 3 spaces to 4 spaces of indentation. This
ensures each super().tearDown() call is properly indented with 8 spaces total (2
levels of 4 spaces each) to comply with PEP 8 standards.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b2f2206-e246-4447-bd45-000a0cd6842c

📥 Commits

Reviewing files that changed from the base of the PR and between ebac4e1 and 877758c.

📒 Files selected for processing (28)
  • doc/commands/atc.md
  • sap/adt/function.py
  • sap/adt/object_factory.py
  • sap/cli/activation.py
  • sap/cli/atc.py
  • sap/cli/helpers.py
  • test/unit/mock.py
  • test/unit/test_sap_adt_function.py
  • test/unit/test_sap_adt_object_factory.py
  • test/unit/test_sap_adt_package.py
  • test/unit/test_sap_adt_repository.py
  • test/unit/test_sap_cli_abapgit.py
  • test/unit/test_sap_cli_adt.py
  • test/unit/test_sap_cli_atc.py
  • test/unit/test_sap_cli_badi.py
  • test/unit/test_sap_cli_checkin.py
  • test/unit/test_sap_cli_checkout.py
  • test/unit/test_sap_cli_cts.py
  • test/unit/test_sap_cli_featuretoggle.py
  • test/unit/test_sap_cli_gcts.py
  • test/unit/test_sap_cli_gcts_cmd_messages.py
  • test/unit/test_sap_cli_gcts_task.py
  • test/unit/test_sap_cli_include.py
  • test/unit/test_sap_cli_package.py
  • test/unit/test_sap_cli_rap.py
  • test/unit/test_sap_cli_startrfc.py
  • test/unit/test_sap_cli_strust.py
  • test/unit/test_sap_cli_user.py
✅ Files skipped from review due to trivial changes (1)
  • doc/commands/atc.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • sap/cli/helpers.py
  • test/unit/test_sap_adt_function.py
  • test/unit/test_sap_cli_atc.py
  • sap/cli/atc.py
  • test/unit/test_sap_adt_object_factory.py
  • sap/adt/function.py
  • sap/cli/activation.py
  • test/unit/test_sap_cli_gcts.py

Comment thread test/unit/mock.py Outdated
Comment thread test/unit/test_sap_cli_featuretoggle.py Outdated
Comment thread test/unit/test_sap_cli_gcts_cmd_messages.py Outdated
Comment thread test/unit/test_sap_cli_gcts_task.py Outdated
Comment thread test/unit/test_sap_cli_include.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated
Comment thread test/unit/test_sap_cli_strust.py Outdated
I naively added multiple inheritance and I thought that the method
TearDown will be called from both parents but it does no work if both
parents do not inherit from the same type.

However there was no need to touch that mess until Python 3.14 which
somehow caused that some patched Python code was not unpatched
(specifically os.path.isfile).

This patch does not drop the multiple inheritance because many classes
already rely on "self.pathc(...)" and the delta would be insanely large.

However, this patch drops the PatcherTestCase's tearDown wich is not
called anyways and updates the children classes to call explicitly
__init__ and unpatch_all methods.
I should find a way how to register all objects automatically.

This patch enables CDS Views (Data Definition or DDLS) to be created by
the human names and thus used in CLI features.
I thought that ATC can be executed for a very limited set of objects
but it looks like that it can be executed for any object.

Hence dropping the choice flag and replacing with any value
that matches registered and supported object type.
This patch fixes pylint warning for a too complex function
and this time I decided to refactor the code instead of muting
the warning because the solution was simple - put the logic
detecting unsupported object type name into a common helper function.
The 'function-module' kind in the human_names_factory pointed to
sap.adt.FunctionModule, but the constructor requires a function
group name as the 4th positional argument while
ADTObjectFactory.make passes only (connection, name). Calling
factory.make('function-module', ...) therefore raised TypeError.

Introduce make_function_module_object mirroring
make_program_include_object: it accepts either 'GROUP\\NAME' or
just 'NAME'. When only the function name is provided, the
function group is discovered through FunctionModule.resolve_group.
Wire the new builder into human_names_factory so both the
canonical 'function-module' and the 'fm' alias work out of the
box.
The 'function-include' kind in the human_names_factory pointed to
sap.adt.FunctionInclude, but the constructor requires a function
group name as the 4th positional argument while
ADTObjectFactory.make passes only (connection, name). Calling
factory.make('function-include', ...) therefore raised TypeError.

Introduce make_function_include_object mirroring
make_function_module_object, but enforcing the
'GROUP\\INCLUDE' form: function include names are not unique
across function groups and cannot be discovered through search.
Wire the new builder into human_names_factory.
@filak-sap filak-sap force-pushed the atc_run_any_object branch from 877758c to a67f1ed Compare June 18, 2026 20:29
@jfilak jfilak merged commit 083e60e into jfilak:master Jun 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants