ShellCheck v0.8.0 Release Notes

Release Date: 2021-11-06 // over 2 years ago
  • โž• Added

    • โš  disable=all now conveniently disables all warnings
    • external-sources=true directive can be added to .shellcheckrc to make shellcheck behave as if -x was specified.
    • Optional check-extra-masked-returns for pointing out commands with suppressed exit codes (SC2312).
    • Optional require-double-brackets for recommending [[ ]] (SC2292).
    • SC2286-SC2288: Warn when command name ends in a symbol like /.)'"
    • SC2289: Warn when command name contains tabs or linefeeds
    • SC2291: Warn about repeated unquoted spaces between words in echo
    • SC2292: Suggest [[ over [ in Bash/Ksh scripts (optional)
    • SC2293/SC2294: Warn when calling eval with arrays
    • SC2295: Warn about "${x#$y}" treating $y as a pattern when not quoted
    • โš  SC2296-SC2301: Improved warnings for bad parameter expansions
    • SC2302/SC2303: Warn about loops over array values when using them as keys
    • SC2304-SC2306: Warn about unquoted globs in expr arguments
    • SC2307: Warn about insufficient number of arguments to expr
    • SC2308: Suggest other approaches for non-standard expr extensions
    • SC2313: Warn about read with unquoted, array indexed variable

    ๐Ÿ›  Fixed

    • SC2102 about repetitions in ranges no longer triggers on [[ -v arr[xx] ]]
    • SC2155 now recognizes typeset and local read-only declare statements
    • SC2181 now tries to avoid triggering for error handling functions
    • SC2290: Warn about misused = in declare & co, which were not caught by SC2270+
    • The flag --color=auto no longer outputs color when TERM is "dumb" or unset

    ๐Ÿ”„ Changed

    • SC2048: Warning about $* now also applies to ${array[*]}
    • โœ… SC2181 now only triggers on single condition tests like [ $? = 0 ].
    • โš  Quote warnings are now emitted for declaration utilities in sh
    • โš  Leading _ can now be used to suppress warnings about unused variables
    • โš  TTY output now includes warning level in text as well as color

    โœ‚ Removed

    • SC1004: Literal backslash+linefeed in '' was found to be usually correct

Previous changes from v0.7.2

  • โž• Added

    • disable directives can now be a range, e.g. disable=SC3000-SC4000
    • SC1143: Warn about line continuations in comments
    • SC2259/SC2260: Warn when redirections override pipes
    • SC2261: Warn about multiple competing redirections
    • ๐Ÿ“œ SC2262/SC2263: Warn about aliases declared and used in the same parsing unit
    • SC2264: Warn about wrapper functions that blatantly recurse
    • โœ… SC2265/SC2266: Warn when using & or | with test statements
    • SC2267: Warn when using xargs -i instead of -I
    • SC2268: Warn about unnecessary x-comparisons like [ x$var = xval ]

    ๐Ÿ›  Fixed

    • ๐Ÿ“œ SC1072/SC1073 now respond to disable annotations, though ignoring parse errors is still purely cosmetic and does not allow ShellCheck to continue.
    • ๐Ÿ‘Œ Improved error reporting for trailing tokens after ]/]] and compound commands
    • #!/usr/bin/env -S shell is now handled correctly
    • โš  Here docs with \r are now parsed correctly and give better warnings

    ๐Ÿ”„ Changed

    • ๐Ÿ“œ Assignments are now parsed to spec, without leniency for leading $ or spaces
    • โš  POSIX/dash unsupported feature warnings now have individual SC3xxx codes
    • SC1090: A leading $x/ or $(x)/ is now treated as ./ when locating files
    • โœ… SC2154: Variables appearing in -z/-n tests are no longer considered unassigned
    • โš  SC2270-SC2285: Improved warnings about misused =, e.g. ${var}=42