koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts

Home Page:https://www.shellcheck.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SC1010 thrown for ``words=(do da di)``

ChillerDragon opened this issue · comments

For bugs

  • Rule Id (if any, e.g. SC1010):

  • My shellcheck version: 0.9.0

  • The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC1010)
    it and also the shellcheck output say

    or quote to make it literal

    but would be nice if that hack would not be needed here

  • I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

For new checks and feature suggestions

  • https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
    it and also the wiki say

    or quote to make it literal

    but would be nice if that hack would not be needed here

  • I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
    there are more false positives of SC1010 but none in an array as far as i know

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

#!/bin/bash

words=(do da di)
echo "${words[*]}"

Here's what shellcheck currently says:

In test.sh line 3:
words=(do da di)
       ^-- SC1010 (warning): Use semicolon or linefeed before 'do' (or quote to make it literal).

For more information:
  https://www.shellcheck.net/wiki/SC1010 -- Use semicolon or linefeed before ...

Here's what I wanted or expected to see:

SC1010 should be ignored when inside of an array declaration