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

[Issue #2776] Don't ever initialize a com.adobe.cq.wcm.core.components.models.Component instance to retrieve an ID #2777

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

paulochang
Copy link

Q                       A
Fixed Issues? Fixes #2776
Patch: Bug Fix? 👍
Minor: New Feature? No
Major: Breaking Change? No
Tests Added + Pass? No (Existing tests are enough)
Documentation Provided No (Existing docs are enough)
Any Dependency Changes? No
License Apache License, Version 2.0

I have replaced all the initialization and calls to the general Component model with a call to the specific component model for each model.

Example:

Given the existing Button HTL code

<button data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button"
        data-sly-use.component="com.adobe.cq.wcm.core.components.models.Component"
        ....
        id="${component.id}"

I have done a replacement with the following code instead

<button data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button"
        ...
        id="${button.id}"

The testing property was mistakenly replaced on the text markup.
There was a missing placeholder in the string to be formatted on the selector variable
Copy link

sonarcloud bot commented Jun 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Jul 29, 2024

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.

The Component model is unnecessarily initialized
2 participants