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

deprecate: correct typo on DataColorMode enum value #5

Merged
merged 2 commits into from
Oct 28, 2024
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>markdown-editor-addon</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<name>Markdown Editor Add-on</name>
<description>Markdown Editor for Vaadin Flow</description>
<url>https://www.flowingcode.com/en/open-source/</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ public class BaseMarkdownComponent extends ReactAdapterComponent implements HasS
*
* <ul>
* <li>{@link #DARK}: Dark color scheme.
* <li>{@link #LIGTH}: Light color scheme.
* <li>{@link #LIGHT}: Light color scheme.
* <li>{@link #AUTO}: Automatically detects the color scheme based on the user's system settings.
* </ul>
*/
public enum DataColorMode {DARK,LIGTH,AUTO};
public enum DataColorMode {
DARK,
LIGHT,
/**
* @deprecated Use LIGHT instead
*/
@Deprecated
LIGTH,
AUTO};

/**
* Base constructor that receives the content of the markdown component.
Expand Down Expand Up @@ -85,6 +93,7 @@ public void setDataColorMode(DataColorMode mode) {
getElement().setAttribute("data-color-mode", "dark");
break;
case LIGTH:
case LIGHT:
getElement().setAttribute("data-color-mode", "light");
break;
case AUTO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public MarkdownEditorDemo() {
mde.setDataColorMode(DataColorMode.DARK);
break;
case "Light":
mde.setDataColorMode(DataColorMode.LIGTH);
mde.setDataColorMode(DataColorMode.LIGHT);
Copy link

@coderabbitai coderabbitai bot Oct 18, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Remaining occurrences of the typo 'LIGTH' found:

  • src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownViewerDemo.java: mdv.setDataColorMode(DataColorMode.LIGTH);
  • src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownEditorDemo.java: mde.setDataColorMode(DataColorMode.LIGTH);
  • src/main/java/com/flowingcode/vaadin/addons/markdown/BaseMarkdownComponent.java: LIGTH,
  • src/main/java/com/flowingcode/vaadin/addons/markdown/BaseMarkdownComponent.java: case LIGTH:
🔗 Analysis chain

Typo correction approved. Verify other occurrences.

The change from DataColorMode.LIGTH to DataColorMode.LIGHT correctly fixes the typo in the enum value. This aligns with the PR objective of correcting the typo in the DataColorMode enum.

To ensure consistency across the codebase, please run the following script to check for any remaining occurrences of the typo:

If the script returns any results, those occurrences should also be updated to maintain consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining occurrences of 'LIGTH' in Java files

# Test: Search for 'LIGTH' in Java files. Expect: No results if all occurrences have been updated.
rg --type java 'LIGTH'

Length of output: 459

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't want to introduce a breaking change, so I decided to deprecate the enum value with the typo (and introduce the one with correct spelling), so that is why the typo still exist, I'm planning to eliminate it in a new major version in the future.

Copy link

Choose a reason for hiding this comment

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

@mlopezFC, understood! Thank you for clarifying your approach. Deprecating DataColorMode.LIGTH to avoid a breaking change is a thoughtful solution, and planning to remove it in a future major version makes sense.

(•‿•)

✏️ Learnings added
Learnt from: mlopezFC
PR: FlowingCode/MarkdownEditor#5
File: src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownEditorDemo.java:52-52
Timestamp: 2024-10-22T20:44:17.129Z
Learning: In the FlowingCode/MarkdownEditor project, when correcting typos in public APIs such as enum values, we deprecate the old value and introduce the corrected one to avoid breaking changes, planning to remove the deprecated value in a future major version.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

break;
case "Automatic":
mde.setDataColorMode(DataColorMode.AUTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public MarkdownViewerDemo() {
mdv.setDataColorMode(DataColorMode.DARK);
break;
case "Light":
mdv.setDataColorMode(DataColorMode.LIGTH);
mdv.setDataColorMode(DataColorMode.LIGHT);
Copy link

@coderabbitai coderabbitai bot Oct 18, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

Typo Still Present in Multiple Files

Several instances of the misspelled enum value LIGTH are still present in the following files:

  • src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownViewerDemo.java
  • src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownEditorDemo.java
  • src/main/java/com/flowingcode/vaadin/addons/markdown/BaseMarkdownComponent.java

Please correct these occurrences to ensure consistency and prevent potential issues.

🔗 Analysis chain

Typo correction approved. Verify consistency across the project.

The change from DataColorMode.LIGTH to DataColorMode.LIGHT correctly fixes the typo in the enum value. This aligns with the "Light" option in the ComboBox and improves code clarity.

To ensure consistency across the project, please run the following script to check for any remaining instances of the misspelled enum value:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining instances of 'LIGTH' in Java files

# Test: Search for 'LIGTH' in Java files. Expect: No results if all instances have been corrected.
rg --type java 'LIGTH'

# Test: Verify correct usage of 'LIGHT' in Java files. Expect: Consistent usage across the project.
rg --type java 'DataColorMode\.LIGHT'

Length of output: 759

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't want to introduce a breaking change, so I decided to deprecate the enum value with the typo (and introduce the one with correct spelling), so that is why the typo still exist, I'm planning to eliminate it in a new major version in the future.

Copy link

Choose a reason for hiding this comment

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

@mlopezFC, understood. Thank you for the clarification. It's a sensible approach to deprecate the misspelled enum value LIGTH to avoid breaking changes, and plan to remove it in a future major version.

(_/)
(•_•)
/︶\✏️


✏️ Learnings added
Learnt from: mlopezFC
PR: FlowingCode/MarkdownEditor#5
File: src/test/java/com/flowingcode/vaadin/addons/markdown/MarkdownViewerDemo.java:215-215
Timestamp: 2024-10-22T20:44:29.506Z
Learning: The `DataColorMode.LIGTH` enum value in `BaseMarkdownComponent` is intentionally kept deprecated to avoid breaking changes and will be removed in a future major version.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

break;
case "Automatic":
mdv.setDataColorMode(DataColorMode.AUTO);
Expand Down
Loading