Coverage UI off-by-one when file starts with a blank line

Description

When viewing a file that starts with a blank line, all reported lines are off-by-one

CI/CD URL

Codecov Output

Please provide the full output of running the uploader on your CI/CD. This will typically have the Codecov logo as ASCII.

      _____          _
     / ____|        | |
    | |     ___   __| | ___  ___ _____   __
    | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |  __/ (_| (_) \ V /
     \_____\___/ \____|\___|\___\___/ \_/
                                    v2.1.12
==> Detecting CI provider
    AppVeyor Detected
==> Preparing upload
    Error running `['git', 'ls-files']`: returncode=128, output=b''
    Error running `['git', 'ls-files']`: returncode=128, output=b''
    Error running `['hg', 'locate']`: returncode=255, output=b''
    Error running `['hg', 'locate']`: returncode=255, output=b''
XX> Skip processing gcov
==> Collecting reports
XX> Searching for reports disabled
    Targeting specific files
    + luacov.report.out bytes=800456
==> Uploading
    .url https://codecov.io
    .query commit=9e22f32dd442d7c95766aca54ceea9833efa4f9d&branch=master&job=hishamhm%2Fluarocks%2F3.0.0.2451-test&service=appveyor&build=p3sxfisygeycxohj&slug=luarocks%2Fluarocks&package=py2.1.12
    Gzipping contents..
    Compressed contents to 158250 bytes
    Pinging Codecov...
    Uploading to S3...
    Uploading to S3 took 0:00:00.276577
    https://codecov.io/github/luarocks/luarocks/commit/9e22f32dd442d7c95766aca54ceea9833efa4f9d

Expected Results

Expected the reported lines to match what I see in the luacov report that is processed by codecov:

==============================================================================
/Users/hisham/projects/luarocks/src/luarocks/fetch/git.lua
==============================================================================

        --- Fetch back-end for retrieving sources from GIT.
      1 local git = {}

      1 local unpack = unpack or table.unpack

      1 local fs = require("luarocks.fs")
      1 local dir = require("luarocks.dir")
      1 local vers = require("luarocks.core.vers")
      1 local util = require("luarocks.util")

        local cached_git_version

(notice the “1” next to every local line that has an assignment.)

Actual Results

Highlighted lines are all off-by-one, notice that the comment line is highlighted instead and the last local is missing:

image

screenshot from Codecov

Additional Information

This doesn’t happen with files that do not start with a blank line, for example: Codecov

@hishamhm the python uploader is being deprecated. Can you move to the new uploader and see if you get the same issue?

Thank you for the reply! I did try to upgrade to the latest uploader but I got the same results.

@hishamhm got it, and just confirming, this doesn’t happen when the file doesn’t start with a blank line?

1 Like

Correct. If the file doesn’t start with a blank line, then all green annotations are in the right places, as we can see in this file, for example.

Hi @hishamhm, sorry for the delay here. This should be resolved now.