Skip to content

Should we use run =X? #479

@martin-schulze-vireso

Description

@martin-schulze-vireso

After landing #367 and rebasing #477 onto it, I got a host of shellcheck warnings for the new run =<N> syntax along the lines of:

  run =0   true
      ^-- SC2283: Remove spaces around = to assign (or use [ ] to compare, or quote '=' if literal).

My decision to use = was that it is concise and I wanted to avoid run '=0'. However, seeing this warning made me acutely aware of the ramifications. Missing the space would assign run=0 and works without error because the next part is a command that should be runnable.

I see following ways going forward:

  1. expect run '=0'
  2. find another syntax for the return code check (I checked run ?0 and run ==0, which also give shellcheck warnings but at least would not fail silently when omitting the space)
  3. stay with run =0 and update shellcheck to balk at run=0 and don't balk at run =0 in bats tests

Pinging @edsantiago since you floated other ideas in the original PR.

I am giving this some urgency since I want to settle the issue before run =<N> gets published in the next release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: CriticalBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorType: QuestionWaiting for Contributor FeedbackThe original contributor did not yet respond to the latest requesthelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions