Problem/Motivation

Some meta:enum have identical keys and values:

'meta:enum':
  primary: primary
  secondary: secondary
  tertiary: tertiary
  black: black
  white: white

Sometimes, it is because of bad conversion #3475962: [2.0.0-beta4] Cleaner meta:enum conversion, sometimes it is because of component author negligence.

Proposed resolution

It is not a big deal, it works very well, but it is useless and it is a second list to keep synchronized.

So, let's print a warning when ALL the items of a meta:enum have similar data in keys and enums.

So, this is OK (because it looks deliberate):

'meta:enum':
  sm: Small
  md: md
  lg: lg
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

smovs’s picture

Assigned: Unassigned » smovs

smovs’s picture

Assigned: smovs » Unassigned
Status: Active » Needs review

I am not certain I caught the main idea of this feature and moved in the right direction with this meta:enum checking.

I added this checking into the checkEnumDefault() function and updated the related error component.

Please review MR !235

smovs’s picture

Hi @mogtofu33

Thank you for your feedback.

I refactored the code according to your suggestions. Could you please review it?

mogtofu33’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the work, looks great to me.

  • pdureau committed e2066636 on 2.0.x authored by smovs
    Issue #3478648 by smovs, mogtofu33:Component Validator: useless meta:...
pdureau’s picture

Status: Reviewed & tested by the community » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)