Problem/Motivation

Twig kint() detection returns a false-positive: It warns about kint() use also if kint() is only written i a comment:

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
kint-example.png48.67 KBanybody

Comments

anybody created an issue. See original summary.

  • trebormc committed 4a0169d8 on 1.x
    Issue #3606540 by anybody: Twig audit: do not flag debug functions...
trebormc’s picture

Fixed in the dev branch. The Twig analyzer was scanning line by line and matching anti-patterns like kint() or dump() even when they only appeared inside a comment, so commented-out debug code such as {# {{ kint(node) }} #} was flagged as a false positive even though it never runs.

I added a stripComments() helper for both Twig comments ({# ... #}, single or multiline) and docblock comment lines (header lines starting with '*') before the detection runs.

trebormc’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

anybody’s picture

Nice @trebormc - FYI just saw you neither credited yourself for the work, nor us for the report. Think you should do that!
(Link down in the issues)

trebormc’s picture

Done

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.