Skip to content

fix(yfmlint): keep error level after double normalization #5243#2071

Open
kadymov wants to merge 1 commit into
masterfrom
fix-lint-loglevel-degradation
Open

fix(yfmlint): keep error level after double normalization #5243#2071
kadymov wants to merge 1 commit into
masterfrom
fix-lint-loglevel-degradation

Conversation

@kadymov

@kadymov kadymov commented Jul 14, 2026

Copy link
Copy Markdown

Description

The basic logic and fixes are here: diplodoc-platform/yfmlint#73

Problem

fixes #5243

Standard markdownlint rules (MD010, MD018, etc.) configured as error in .yfmlint were silently downgraded to warn. As a result, the build kept passing when it should have failed — the violations were only written to the log at WARN level.

Root cause

The lint config is normalized twice by two independent layers:

  1. CLI — the Lint feature expands the log-levels section, merges it with the config, and calls normalizeConfig (needed to support log-levels and to append MD033).
  2. yfmlint package — being a self-contained library, it calls normalizeConfig again when merging with its default config.

normalizeConfig was not idempotent: when processing the object form of a rule, the level was read only from the .level field. An already-normalized object {loglevel: 'error'} has no .level, so the fallback to the default warn kicked in and the original error was lost.

Fix

Added a fallback to the already-present loglevel field in the object-normalization branch:

loglevel: objectConfig.level || objectConfig.loglevel || DEFAULT_LOG_LEVEL

Re-running normalization on an already-normalized config now yields the same result, and the error level is preserved. Neither of the two normalizeConfig calls had to be removed — both are required for the respective layers to work correctly.

Related issue: #5243

@kadymov
kadymov force-pushed the fix-lint-loglevel-degradation branch from e957fab to 5bc1f54 Compare July 14, 2026 15:27
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants