8

Today I found a review audit that apparently had incorrect syntax highlight. To me this seemed like a rare case so I decided to post it here as a possible bug or support question.

This is the review audit. When initially posted -and shown in the audit- the code didn't have a source fence (it was only indented by 4) and the first tag was Python. The first line had a purple highlight color which would strike a Python programmer as unusual or incorrect.

The post has been edited in the meanwhile, but neither the Dart nor the Python syntax highlight correspond to the color I saw. It's also interesting to note that I saw the post having the Python tag during the audit but from the revision history the post has never been tagged with Python...

Can someone offer an explanation?

1 Answer 1

11

That's an interesting combinations of effects...

Review audits can and do change the tags on the question as part of the audit (in addition to changing the score and other details of the post to make it look less obvious) if you are using a tag filter that cannot find a relevant post for an audit. Those changes are only displayed while you are reviewing it. Afterwards, the original state of the post is displayed instead. So it's not out of the question that you saw the post with a Python tag despite it never having had the Python tag on it.

The presence of the Python tag, though, breaks the syntax highlighting on the post. Because Flutter is set to use lang-dart and Python is set to use lang-python, they end up cancelling each other out and the entire post reverts to default highlighting. When I try setting the block of code to lang-default manually, the interpreter tries to highlight it as lang-less and produces the purple-ish color you describe.

I would guess that a good compromise here would be to see if bogus tags added for the purposes of an audit are not considered when choosing which language to highlight the post as (even if, regardless of this error, the particular post mentioned does not need any highlighting). But I am curious if this occurred on a post where the code in the question was actually code, would it have chosen the correct language or would an incorrect guess have even mattered?

1
  • Per your post, it seems that the system makes an attempt to see if there are eligible posts to use as audits within one's tag filters, and only if there are none will it use another eligible post without the tag and fake the tag. However, this earlier post still being used as a duplicate target today states that the audit system never looks at any filters, always faking the tags if necessary. Which one is true? Is that linked post still true today for other filters (close reasons, questions/answers, etc.)? Nov 2, 2021 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .