Mozlint publisher ignores lineoffset, so multi-line warnings aren't posted inline

Open Beginner friendly
#3,399 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
tooling

Research direction

Start in bot/code_review_bot/tasks/lint.py at the hardcoded nb_lines=1 and trace how the mozlint JSON artifact is parsed. Check the referenced mozlint result.py definition and compare-locales lineoffset usage. Done when multiline warnings are anchored across their affected lines and publish inline when the relevant lines are in the diff.

Written by the indexing model from the issue text.

Description

I have updated compare-locales to provide a lineoffset on top of lineno when finding an error in a multiline string. Turns out that doesn't do anything.

The mozlint parser in hardcodes nb_lines=1 and never reads the lineoffset field from the mozlint JSON artifact (guessing it should use lineoffset + 1).

As a result, warnings that apply to a multi-line entity are anchored to a single line and dropped from publishing when that line isn't part of the diff.

Example revision: https://phabricator.services.mozilla.com/D304024 — 4 changed strings, only a general comment, no inline comments.

P.S. compare-locales still has an issue, because I set lineoffset as a value, not as a tuple. I honestly don't understand why that's the case, since lineno is already defined.

Dominant language
Python
Stars
67
Forks
52
Avg merge
3d 23h
Merged PRs (30d)
54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/code-review

All issues in mozilla/code-review

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.