Skip to content

[C++] Fix shellcheck errors in cpp/build-support/*-flatbuffers.sh #50917

Description

@hiroyuki-sato

Describe the enhancement requested

This is the sub issue #44748.

  • SC2034: foo appears unused. Verify it or export it.
  • SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
  • SC2086: Double quote to prevent globbing and word splitting.
shellcheck cpp/build-support/*flatbuffer*.sh

In cpp/build-support/update-flatbuffers.sh line 27:
PYTHON_SOURCE_DIR="$CWD/../../python"
^---------------^ SC2034 (warning): PYTHON_SOURCE_DIR appears unused. Verify use (or export if used externally).


In cpp/build-support/update-flatbuffers.sh line 29:
TOP="$FORMAT_DIR/.."
^-^ SC2034 (warning): TOP appears unused. Verify use (or export if used externally).


In cpp/build-support/update-flatbuffers.sh line 33:
FILES=($(find $FORMAT_DIR -name '*.fbs'))
       ^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
              ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
FILES=($(find "$FORMAT_DIR" -name '*.fbs'))


In cpp/build-support/vendor-flatbuffers.sh line 28:
mkdir -p $VENDOR_LOCATION
         ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 29:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/base.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                   ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/base.h "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 30:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/flatbuffers.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                          ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/flatbuffers.h "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 31:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/stl_emulation.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                            ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/stl_emulation.h "$VENDOR_LOCATION"

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- PYTHON_SOURCE_DIR appears unused....
  https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions