alibaba/java-dns-cache-manipulator

View on GitHub
scripts/integration_test

Summary

Maintainability
Test Coverage

Can't follow non-constant source. Use a directive to specify location.
Open

source "$BASH_BUDDY_ROOT/lib/maven_utils.sh"
Severity: Minor
Found in scripts/integration_test by shellcheck

Can't follow non-constant source. Use a directive to specify location.

Problematic code:

. "$(find_install_dir)/lib.sh"

Correct code:

# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"

Rationale:

ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.

Use a [[Directive]] to point shellcheck to a fixed location it can read instead.

Exceptions:

If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Can't follow non-constant source. Use a directive to specify location.
Open

source "$BASH_BUDDY_ROOT/lib/trap_error_info.sh"
Severity: Minor
Found in scripts/integration_test by shellcheck

Can't follow non-constant source. Use a directive to specify location.

Problematic code:

. "$(find_install_dir)/lib.sh"

Correct code:

# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"

Rationale:

ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.

Use a [[Directive]] to point shellcheck to a fixed location it can read instead.

Exceptions:

If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Use a ( subshell ) to avoid having to cd back.
Open

cd ..
Severity: Minor
Found in scripts/integration_test by shellcheck

Use a ( subshell ) to avoid having to cd back.

Problematic code:

for dir in */
do
  cd "$dir"
  convert index.png index.jpg
  cd ..
done

Correct code:

for dir in */
do
  (
  cd "$dir" || exit
  convert index.png index.jpg
  )
done

or

for dir in */
do
  cd "$dir" || exit
  convert index.png index.jpg
  cd ..
done

Rationale:

When doing cd dir; somestuff; cd .., cd dir can fail when permissions are lacking, if the dir was deleted, or if dir is actually a file.

In this case, somestuff will run in the wrong directory and cd .. will take you to an even more wrong directory. In a loop, this will likely cause the next cd to fail as well, propagating this error and running these commands far away from the intended directories.

Check cds exit status and/or use subshells to limit the effects of cd.

Exceptions

If you set variables you can't use a subshell. In that case, you should definitely check the exit status of cd, which will also silence this suggestion.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Can't follow non-constant source. Use a directive to specify location.
Open

source "$BASH_BUDDY_ROOT/lib/java_utils.sh"
Severity: Minor
Found in scripts/integration_test by shellcheck

Can't follow non-constant source. Use a directive to specify location.

Problematic code:

. "$(find_install_dir)/lib.sh"

Correct code:

# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"

Rationale:

ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.

Use a [[Directive]] to point shellcheck to a fixed location it can read instead.

Exceptions:

If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it.
Open

  -Dmaven.plugin.validation=NONE
Severity: Minor
Found in scripts/integration_test by shellcheck

The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it.

Problematic code:

array=( [index] = value )

Correct code:

array=( [index]=value )

Rationale:

The shell doesn't care about the = sign in your array assignment because it's not part of a recognized index assignment. Instead, it's considered a literal character and becomes part of an array element's value.

In the example problematic code, this is because the = was intended to set the index, but the shell will not recognize it when it is surrounded by spaces.

Make sure to remove any spaces around the = when assigning by index, such as in the correct code.

If you wanted the = to be a literal part of the array element, add quotes around it, such as env=( "LC_CTYPE=C" ) or specialChars=( "=" "%" ";" ) .

Exceptions:

None.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Can't follow non-constant source. Use a directive to specify location.
Open

source "$BASH_BUDDY_ROOT/lib/common_utils.sh"
Severity: Minor
Found in scripts/integration_test by shellcheck

Can't follow non-constant source. Use a directive to specify location.

Problematic code:

. "$(find_install_dir)/lib.sh"

Correct code:

# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"

Rationale:

ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.

Use a [[Directive]] to point shellcheck to a fixed location it can read instead.

Exceptions:

If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null.

Notice

Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.

Expected an indentation at 4 instead of at 2.
Open

  else
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      cd "$JAVA8_HOME/.."/8.0.345*
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  20
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  [ "$jdk" = "$default_build_jdk_version" ] && continue
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  "${MVU_DEFAULT_MVN_OPTS[@]}"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  jvu::switch_to_jdk "$jdk"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # shellcheck disable=SC2086
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      pwd
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  export JAVA8_0_345_HOME
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  8
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  local JDK_8_LATEST
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      pwd
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  "$default_build_jdk_version"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  cu::head_line_echo "test with Java: $JAVA_HOME"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # GITHUB_ACTIONS
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  #   Always set to true when GitHub Actions is running the workflow.
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  if [ true = "${GITHUB_ACTIONS:-}" ]; then
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  "$JAVA8_0_345_HOME"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  -Dmaven.plugin.validation=NONE
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  mvu::mvn_cmd ${CI_MORE_BEGIN_OPTS:-} surefire:test ${CI_MORE_END_OPTS:-}
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      d="$(echo "$JAVA8_HOME/../.."/8.0.345*/x64)" || cu::die "Fail to get java home of v8.0.345!"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      d="$(ls -v -d "$JAVA8_HOME/../.."/8.* | tail -n 1)" || cu::die "Fail to get latest java 8 home!"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # already tested by above `mvn install`
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      cd "$d" || cu::die "Fail to cd java home of v8.0.345($d)!"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  #   You can use this variable to differentiate when tests are being run locally or by GitHub Actions.
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  -DperformRelease -P'!gen-sign' -Pgen-code-cov
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      pwd
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      cd "$d" || cu::die "Fail to cd java8 home"
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # https://maven.apache.org/guides/plugins/validation/index.html
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      # shellcheck disable=SC2012
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  17
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # Maven Plugin Validation
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  fi
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  ${CI_MORE_MVN_OPTS:+${CI_MORE_MVN_OPTS}}
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  readonly CI_MORE_BEGIN_OPTS=jacoco:prepare-agent CI_MORE_END_OPTS=jacoco:report
Severity: Minor
Found in scripts/integration_test by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  # just test without build
Severity: Minor
Found in scripts/integration_test by editorconfig

There are no issues that match your filters.

Category
Status