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
120 changes: 60 additions & 60 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/adt-plugin-gcts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ export type {
// Filename utilities
export {
gctsFilename,
gctsSourceExt,
parseGctsFilename,
adtUriToGctsPath,
sourceKey,
splitSourceKey,
LIMU_SUBTYPES,
PACKAGE_FILENAME,
METADATA_EXTENSION,
} from './lib/format/filename';
Expand Down
17 changes: 11 additions & 6 deletions packages/adt-plugin-gcts/src/lib/aff/generic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check notice on line 1 in packages/adt-plugin-gcts/src/lib/aff/generic.ts

View check run for this annotation

CodeScene Access / CodeScene Code Health Review (aff/w3-source)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 4.70 to 4.60, threshold = 4 This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
* Schema-aware generic AFF emit/parse — zero workspace deps.
*
* `genericToMetadata` builds the `{formatVersion, header}` envelope for a
Expand All @@ -11,6 +11,7 @@
*/

import { affBodyProps, latestAffVersion } from './schemas';
import { splitSourceKey } from '../format/filename';

/** Minimal AFF metadata shape shared by all types. */
export interface MinimalAff {
Expand All @@ -30,9 +31,11 @@
abapLanguageVersion?: string;
/** Raw payload fields (deserialized AFF body, ADT response, …). */
data?: Record<string, unknown>;
/** Companion sources keyed by file suffix — `main` → no suffix
* (`{name}.{type}.{ext}`), any other key becomes the middle segment
* (`{name}.{type}.{key}.{ext}`, e.g. csnm's `model_inferred`). */
/** Companion sources keyed by filename — `main` → the suffix-less file
* (`{name}.{type}.{ext}`); other keys are suffixes
* (`{name}.{type}.{key}.{typeExt}`, e.g. csnm's `model_inferred`); a key
* ending in a file extension selects that extension instead
* (`z_func.func.json`, `texts.en.properties`). */
sources?: Record<string, string>;
};

Expand Down Expand Up @@ -118,8 +121,10 @@
/**
* Companion-source emit for source-bearing types (`.abap`, `.acds`,
* `.csn`, …): reads `obj.sources` — `main` emits the suffix-less file,
* other keys emit `{name}.{type}.{suffix}.{ext}`. Falls back to
* `obj.getSource()` as the single `main` source.
* other keys emit `{name}.{type}.{suffix}.{ext}`. A key ending in a file
* extension selects that extension instead of the type default
* (`z_func.func.json` → LIMU metadata, `texts.en.properties` → texts).
* Falls back to `obj.getSource()` as the single `main` source.
*/
export function genericGetSources(obj: GenericAffLike) {
// Read from the same place genericSetSources writes: the payload's
Expand All @@ -136,7 +141,7 @@
return Object.entries(merged)
.filter(([, content]) => !!content)
.map(([key, content]) => ({
suffix: key === 'main' ? undefined : key,
...splitSourceKey(key),
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
content,
}));
}
Expand Down
Loading
Loading