Skip to content

feat(autofix): Fix additional deprecated Core APIs#639

Merged
d3xter666 merged 39 commits into
mainfrom
autofix-deprecated-core-apis
Jun 5, 2025
Merged

feat(autofix): Fix additional deprecated Core APIs#639
d3xter666 merged 39 commits into
mainfrom
autofix-deprecated-core-apis

Conversation

@maxreichmann

@maxreichmann maxreichmann commented Apr 24, 2025

Copy link
Copy Markdown
Member

JIRA: CPOUI5FOUNDATION-991

Enhances #671 by enabling more complex autofixes where migration depends on the provided arguments.

Resolves partially: #619

Follow up PRs:
#675

@maxreichmann
maxreichmann force-pushed the autofix-deprecated-core-apis branch 4 times, most recently from 7c8c5bc to bb20759 Compare April 29, 2025 09:34
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.js Outdated
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.fixed.js Outdated
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.fixed.js Outdated
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.fixed.js Outdated
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.js Outdated
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch 2 times, most recently from fc44eab to 5fa49bb Compare May 15, 2025 08:06
Comment thread src/linter/ui5Types/fixHints/CoreFixHintsGenerator.ts
Comment thread src/autofix/solutions/codeReplacer.ts Fixed
Comment thread src/linter/ui5Types/fixHints/CoreFixHintsGenerator.ts Outdated
Comment thread src/linter/ui5Types/fixHints/CoreFixHintsGenerator.ts Outdated
Comment thread src/linter/ui5Types/fixHints/CoreFixHintsGenerator.ts Outdated
@d3xter666
d3xter666 marked this pull request as ready for review May 27, 2025 08:48
@d3xter666
d3xter666 requested a review from a team May 27, 2025 08:48
Comment thread src/linter/ui5Types/TypeLinter.ts
Comment thread test/fixtures/autofix/coreApi/DeprecatedCoreApi.fixed.js Outdated
sap.ui.define(["./library", "sap/ui/core/Control", "./ExampleRenderer", "sap/ui/core/Lib"], function (library, Control, ExampleRenderer, Lib) {
"use strict";

sap.ui.getCore().getLibraryResourceBundle("library.with.custom.paths", "en_US");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is currently not fixed, but it should be, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will be resolved with: #675

Comment thread test/fixtures/linter/projects/library.with.custom.paths/src/main/js/Example.js Outdated
Comment thread test/lib/autofix/snapshots/autofix.fixtures.ts.md Outdated
Comment thread test/lib/autofix/snapshots/autofix.fixtures.ts.md Outdated
Comment thread test/lib/autofix/snapshots/autofix.fixtures.ts.md Outdated
Comment thread src/autofix/solutions/codeReplacer.ts Outdated
return fixHints;
}

function extractKeyValuePairs(jsonLikeStr: string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We already have the relevant information accessible via AST nodes, so I don't think we should parse the argument ourselves here. The input is based on node.getText(). We even have already code that can analyze object structures, which is used for certain checks in SourceFileLinter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will be resolved in #675

Comment thread src/autofix/solutions/codeReplacer.ts Outdated
name: fixHints.exportCodeToBeUsed.args[0].value.replace(/^['"]+|['"]+$/g, ""),
url: libOptionsExpression.url,
};
fixHints.exportCodeToBeUsed.args[0].value = JSON.stringify(newArg);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here the comments in the code get lost. Also, the used quotes in the code will be always replaced by double-quotes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will be resolved in #675

Comment thread src/autofix/solutions/codeReplacer.ts Outdated
extractKeyValuePairs(fixHints.exportCodeToBeUsed.args[1].value) as {async: boolean; url?: string};
if (libOptionsExpression.async === true) {
const newArg = {
name: fixHints.exportCodeToBeUsed.args[0].value.replace(/^['"]+|['"]+$/g, ""),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using back-ticks as first arg (library name) results into quoted backticks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will be resolved in #675

@d3xter666
d3xter666 changed the base branch from main to autofix-deprecated-core-base May 27, 2025 12:57
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch from 43442c9 to 756264a Compare May 27, 2025 13:07
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-base branch from d0120ff to b272a5a Compare May 27, 2025 14:12
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch from 756264a to cbc6e6a Compare May 27, 2025 14:23
@d3xter666
d3xter666 marked this pull request as draft May 28, 2025 07:00
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch 2 times, most recently from 0c07e32 to cb85a25 Compare May 28, 2025 07:46
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-base branch from 8372914 to 79ea741 Compare May 28, 2025 11:07
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch 3 times, most recently from f033503 to 0b46e18 Compare May 29, 2025 07:12
@d3xter666
d3xter666 marked this pull request as ready for review May 29, 2025 08:25
@d3xter666
d3xter666 requested a review from a team May 30, 2025 06:34
@d3xter666
d3xter666 force-pushed the autofix-deprecated-core-apis branch from c815258 to 1eafe45 Compare June 2, 2025 11:22
@d3xter666 d3xter666 changed the title feat: Offer autofix for deprecated Core APIs feat(autofix): Fix deprecated Core APIs Jun 2, 2025
@d3xter666
d3xter666 requested review from RandomByte and matz3 June 2, 2025 13:27

@matz3 matz3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@d3xter666
d3xter666 dismissed RandomByte’s stale review June 4, 2025 06:51

Issues were addressed

@RandomByte RandomByte changed the title feat(autofix): Fix deprecated Core APIs feat(autofix): Fix additional deprecated Core APIs Jun 5, 2025

@RandomByte RandomByte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@d3xter666
d3xter666 merged commit af2cb9b into main Jun 5, 2025
@d3xter666
d3xter666 deleted the autofix-deprecated-core-apis branch June 5, 2025 12:08
@openui5bot openui5bot mentioned this pull request Jun 5, 2025
@flovogt flovogt mentioned this pull request Jul 8, 2025
10 tasks
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.

5 participants