Skip to content

Unicode dash not being detected (SC1100) #3283

@na4ma4

Description

@na4ma4

For bugs with existing features

  • Rule Id (if any, e.g. SC1000): SC1100
  • My shellcheck version (shellcheck --version or "online"): 0.11.0 and online
  • The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

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

#!/bin/bash

[[ $(curl ‑‑help || true) != "" ]] && echo "blah"

curl ‑‑help

Here's what shellcheck currently says:

$ shellcheck -x --extended-analysis=true -s bash -a --enable=all -P SCRIPTDIR -S style scripts/test.sh

Here's what I wanted or expected to see:

Something declaring the use of the incorrect hyphen ( (\u2011 NON-BREAKING HYPHEN ) instead of -(\u002d HYPHEN-MINUS) )

Extra details

I can see that in the code it can look for these dashes, it kinda looks like that check only works for inside tests (the wiki page only shows where it is used in [[ 3 –gt 2 ]]), so maybe not detecting it is intended ?

I updated the example, using echo was pretty silly, but the check still works the same.

I did a small patch to src/Parser.hs, but my haskell is terrible, but it did work when I tested it on my example.

0001-Modified-weirdDash-detection-to-work-for-arguments-a.patch

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