You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No "wrong ticks" instruction for one or more identical code blocks with the wrong ticks #3547
When a user have sent one or more identical code block with ticks other than backticks with or without any language specifier, the bot says to "add a py after the three backticks", even when the language specifier is py, and don't mention about the wrong ticks.
Reasons
The PR #3517 replaced the _RE_CODE_BLOCK pattern to _REGEX_CODE_BLOCK and set a overlapped flag to True on the line 94. As a result, a new bug (#3522) occurred: when a user had used the quotes that were placed in the formatted code block, the bot anyway considered it as the wrong-formatted code block. The bug was fixed then by the PR #3527 by doing a following check:
If there are code blocks with bad ticks, start to compare it with the other wrong code blocks
Consider the first found code with the wrong ticks block when comparing with other wrong code blocks as a valid one when:
They're not the same
They're have different content
The comparable blocks doesn't contain the content of the block with the wrong ticks
Therefore, when a user have sent one code block with the wrong ticks, the bot sets block to None and the condition leads to the block with getting of the instruction for the missing language.
Examples
Without the language specifier
With the py language specifier
With the c language specifier
When two code blocks are identical
Expected behavior
Possible Solution
The solution I have found is to remove the overlapped flag and PR #3527's check. I'm not sure about the purpose of the overlapped flag, but seems it breaks nothing. The only case that depends of this is the test_should_recognize_contained_codeblock_even_if_that_breaks_formatting unit test created in the PR #3517. When I removed the overlapped flag, all still worked and no issues weren't noticed. After I removed the PR #3527's check, the instruction becomes correct: the bot says about the wrong ticks and the missing language specifier.
changed the title [-]No "wrong ticks" instruction when the language specifier is provided[/-][+]No "wrong ticks" instruction when the language specifier is provided for the code blocks with the wrong ticks[/+]on Aug 8, 2026
changed the title [-]No "wrong ticks" instruction when the language specifier is provided for the code blocks with the wrong ticks[/-][+]No "wrong ticks" instruction for one or more identical code blocks with the wrong ticks[/+]on Aug 8, 2026
Activity
[-]No "wrong ticks" instruction when the language specifier is provided[/-][+]No "wrong ticks" instruction when the language specifier is provided for the code blocks with the wrong ticks[/+][-]No "wrong ticks" instruction when the language specifier is provided for the code blocks with the wrong ticks[/-][+]No "wrong ticks" instruction for one or more identical code blocks with the wrong ticks[/+]