Views module stores the format_plural_string setting as binary base64 string producing cspell errors in CI

Created on 13 June 2025, 5 months ago

Problem/Motivation

In a contrib module https://www.drupal.org/project/extended_logger/ I store the Views configuration inside the module.

And when the CI/CD runs, it always shows me that the cspell job has failed with an error:

modules/extended_logger_db/config/install/views.view.extended_logger_logs.yml:71:42     - Unknown word (MQNAY)      -- plural_string: !!binary MQNAY291bnQ=
	 Suggestions: [MANY, MEANY, Meany, mana, MANA]

This is because Views "numeric" field display plugin stores the "Format plural" configuration as base64 encoded binary blob, instead of a plain text or any other non-binary format.

Steps to reproduce

1. Create a View with a numeric plugin id in the field display options.
2. Export the View to yaml file and place into the module config/install directory, or anywhere else.
3. Run the GitLab pipeline and see that cspell job has filed.

Proposed resolution

Seems the proper solution is to not store this setting as binary, but store it as plain text.

But until this is fixed properly, seems we have to use workarounds:

1. Create the .cspell-project-words.txt file and put this base64 string to the project words.
But this is not stable, because every change of the "Format plural" settings will produce a new word with random characters.

2. Configure cspell to ignore the whole YAML file with this Views configuration.
I can't yet find a way how to do it in the files, but seems we can do this in the .gitlab-ci.yml file like this:

variables:
  _CSPELL_IGNORE_PATHS: '"config/install/views.view.my_view.yml"'

But ignoring the whole file just because of a single string is not good too.

So, the proper solution is very welcome!

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

views.module

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @murz
  • 🇦🇲Armenia murz Yerevan, Armenia
  • 🇳🇱Netherlands Lendude Amsterdam

    Core cspell ignores binary stuff it looks like (see .cspell.json in core):

    "ignoreRegExpList": [
          "^msgstr .*",
          "!!binary .*",
          "%[0-9][0-9A-F]",
          "\\Wi18n",
          "\\x{[0-9A-F]{4,5}}"
        ],
    

    Wouldn't that work?

    I think changing this to a normal sting is hard, see the comment in views.field.schema.yml, we need to allow the control character:

        format_plural_string:
          type: plural_label
          label: 'Plural variants'
          constraints:
            Regex:
              # Normally, labels cannot contain invisible control characters. In this particular
              # case, an invisible character (ASCII 3, 0x03) is used to encode translation
              # information, so carve out an exception for that only.
              # @see \Drupal\views\Plugin\views\field\NumericField
              pattern: '/([^\PC\x03])/u'
              match: false
              message: 'Labels are not allowed to span multiple lines or contain control characters.'
    
Production build 0.71.5 2024