bashcov icon indicating copy to clipboard operation
bashcov copied to clipboard

[BUG] Coverage fails with "excepted integer for LINENO"

Open dalisoft opened this issue 1 year ago • 5 comments

Actual Result

BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753407168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168_start_color
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753337168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168is_terminal
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753517168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168'[' -t 1 ']'
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753337168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168echo -en ''
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753417168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168'[' 0 -gt 0 ']'
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753457168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168/bin/cat
Overall result: SUCCESS+BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753227168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168true
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753247168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168echo -en ' \u2713 '
 \u2713 +BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753477168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168_stop_color
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753367168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168is_terminal
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753517168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168'[' -t 1 ']'
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753367168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168echo -en ''
BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366753967168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168echo

BASHCOV>7168c1ca-8bcd-41bf-bdbc-2e7eac8366755737168c1ca-8bcd-41bf-bdbc-2e7eac836675./bash_unit7168exit 0
+ bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got "uname -m\n51W"). This can occur if your script or its path contains the sequence "7168c1ca-8bcd-41bf-bdbc-2e7eac836675", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
Run completed using bashcov 3.1.2 with Bash 3.2, Ruby 3.3.2, and SimpleCov 0.22.0
Coverage report generated for /bin/bash ./bash_unit tests/cli/core.test.sh tests/cli/no-git.test.sh tests/gpg-sign/git-gpg-sign.test.sh tests/plugins/changelog.test.sh tests/plugins/docker.test.sh tests/plugins/git.test.sh tests/plugins/github-release.test.sh tests/plugins/npm-post.test.sh tests/plugins/npm.test.sh tests/plugins/template.test.sh tests/presets/conventional-commits.test.sh tests/presets/workspace.cargo-undefined.test.sh tests/presets/workspace.cargo.test.sh tests/presets/workspace.nodejs-undefined.test.sh tests/presets/workspace.nodejs.test.sh tests/presets/workspace.python-undefined.test.sh tests/presets/workspace.python.test.sh tests/presets/workspace.undefined.test.sh to /Users/dalisoft/Desktop/open_source/bash/release-me/coverage. 307 / 548 LOC (56.02%) covered.
release-me on  docker-bashcov-fix [$?] via 🐳 orbstack is 📦 v0.8.7 via ⬢ v22.2.0 via 💎 v3.3.2 took 36s 
❯ 

Excepted result

Getting proper coverage as all tests are passing

Information

  • Repository: https://github.com/dalisoft/release-me/
  • OS: macOS Sonoma 14.5
  • Ruby: ruby 3.3.2
  • Bashcov: v3.1.2

Additional information

I found reference to error

https://github.com/infertux/bashcov/blob/120eef3e6246c2de321c99224ff4552f4af69cee/lib/bashcov/xtrace.rb#L127

Similar issues

  • https://github.com/infertux/bashcov/issues/31
  • https://github.com/infertux/bashcov/issues/43

dalisoft avatar Jun 02 '24 02:06 dalisoft

Hey @infertux I got there debugging values and repo at there

BASHCOV>fa26f0a5-fe3f-465c-96ee-a0600be01651573fa26f0a5-fe3f-465c-96ee-a0600be01651./bash_unitfa26exit 0
+ bashcov: warning: encountered an error parsing Bash's output (error was: expected integer for LINENO, got "uname -m\n_source/bash/release-me/release.sh"). This can occur if your script or its path contains the sequence "fa26f0a5-fe3f-465c-96ee-a0600be01651", or if your script unsets LINENO. Aborting early; coverage report will be incomplete.
Run completed using bashcov 3.1.2 with Bash 3.2, Ruby 3.3.1, and SimpleCov 0.22.0
Coverage report generated for /bin/bash ./bash_unit tests/cli/core.test.sh tests/cli/no-git.test.sh tests/gpg-sign/git-gpg-sign.test.sh tests/plugins/changelog.test.sh tests/plugins/docker.test.sh tests/plugins/git.test.sh tests/plugins/github-release.test.sh tests/plugins/npm-post.test.sh tests/plugins/npm.test.sh tests/plugins/template.test.sh tests/presets/conventional-commits.test.sh tests/presets/workspace.cargo-undefined.test.sh tests/presets/workspace.cargo.test.sh tests/presets/workspace.nodejs-undefined.test.sh tests/presets/workspace.nodejs.test.sh tests/presets/workspace.python-undefined.test.sh tests/presets/workspace.python.test.sh tests/presets/workspace.undefined.test.sh to /Users/dalisoft/Desktop/open_source/bash/release-me/coverage. 307 / 548 LOC (56.02%) covered.

Repo lives at here and i'm running command via env (cat .env.test) bundle exec bashcov ./bash_unit tests/**.test.sh locally

Originally posted by @dalisoft in https://github.com/infertux/bashcov/issues/82#issuecomment-2094962517

dalisoft avatar Jun 02 '24 03:06 dalisoft

I found what's caused this, variables should be quotes as it's contains numbers. I hope ShellCheck will cover this bug-case in future

dalisoft avatar Jun 05 '24 08:06 dalisoft

After few iterations, get issue back again

dalisoft avatar Jun 05 '24 09:06 dalisoft

Looks like you found a workaround? Please reopen if not.

infertux avatar Aug 29 '24 00:08 infertux

@infertux No, i did not found any workaround. Even the linked commit did not fixed the issue. Seems not possible to debug such bug. So temporarily moved to other project

dalisoft avatar Dec 22 '24 23:12 dalisoft