Skip to content

Skip SC2015 when it end with: || true #2977

Closed
@ale5000-git

Description

@ale5000-git

For bugs

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
set -e

foo && bar || true

Here's what shellcheck currently says:

foo && bar || true
    ^-- [SC2015](https://www.shellcheck.net/wiki/SC2015) (info): Note that A && B || C is not if-then-else. C may run when A is true.

Here's what I wanted or expected to see:

Nothing, the || true is used to ignore return codes so even if it get executed when A is true it doesn't matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions