alibaba/java-dns-cache-manipulator

View on GitHub

Showing 1,225 of 1,229 total issues

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Open

    wdir=$(cd "$wdir/.."; pwd)
Severity: Minor
Found in tool/src/bin/dcm by shellcheck

Use cd ... || exit in case cd fails.

Problematic code:

cd generated_files
rm -r *.c

func(){
  cd foo
  do_something
}

Correct code:

cd generated_files || exit
rm -r *.c

# For functions, you may want to use return:
func(){
  cd foo || return
  do_something
}

Rationale:

cd can fail for a variety of reasons: misspelled paths, missing directories, missing permissions, broken symlinks and more.

If/when it does, the script will keep going and do all its operations in the wrong directory. This can be messy, especially if the operations involve creating or deleting a lot of files.

To avoid this, make sure you handle the cases when cd fails. Ways to do this include

  • cd foo || exit as suggested to just abort immediately
  • if cd foo; then echo "Ok"; else echo "Fail"; fi for custom handling
  • <(cd foo && cmd) as an alternative to <(cd foo || exit; cmd) in <(..), $(..) or ( )

Exceptions:

ShellCheck does not give this warning when cd is on the left of a || or &&, or the condition of a if, while or until loop. Having a set -e command anywhere in the script will disable this message, even though it won't necessarily prevent the issue.

If you are accounting for cd failures in a way shellcheck doesn't realize, you can disable this message with a [[directive]].

Notice

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

Inline HTML
Open

<a href="https://github.com/alibaba/java-dns-cache-manipulator/network/dependents"><img src="https://badgen.net/github/dependents-repo/alibaba/java-dns-cache-manipulator?label=user%20repos" alt="user repos"></a>
Severity: Info
Found in docs/zh-CN/library.md by markdownlint

MD033 - Inline HTML

Tags: html

Aliases: no-inline-html

This rule is triggered whenever raw HTML is used in a markdown document:

Inline HTML header

To fix this, use 'pure' markdown instead of including raw HTML:

# Markdown header

Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

Inline HTML
Open

<a href="https://gitpod.io/#https://github.com/alibaba/java-dns-cache-manipulator"><img src="https://img.shields.io/badge/Gitpod-ready to code-339933?label=gitpod&logo=gitpod&logoColor=white" alt="gitpod: Ready to Code"></a>
Severity: Info
Found in docs/zh-CN/library.md by markdownlint

MD033 - Inline HTML

Tags: html

Aliases: no-inline-html

This rule is triggered whenever raw HTML is used in a markdown document:

Inline HTML header

To fix this, use 'pure' markdown instead of including raw HTML:

# Markdown header

Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

Inline HTML
Open

<a href="https://codeclimate.com/github/alibaba/java-dns-cache-manipulator"><img src="https://img.shields.io/codeclimate/maintainability/alibaba/java-dns-cache-manipulator?logo=code-climate" alt="Maintainability"></a>
Severity: Info
Found in docs/developer-guide.md by markdownlint

MD033 - Inline HTML

Tags: html

Aliases: no-inline-html

This rule is triggered whenever raw HTML is used in a markdown document:

Inline HTML header

To fix this, use 'pure' markdown instead of including raw HTML:

# Markdown header

Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

Inline HTML
Open

<a href="https://github.com/alibaba/java-dns-cache-manipulator/issues"><img src="https://img.shields.io/github/issues/alibaba/java-dns-cache-manipulator" alt="GitHub issues"></a>
Severity: Info
Found in docs/developer-guide.md by markdownlint

MD033 - Inline HTML

Tags: html

Aliases: no-inline-html

This rule is triggered whenever raw HTML is used in a markdown document:

Inline HTML header

To fix this, use 'pure' markdown instead of including raw HTML:

# Markdown header

Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

Inline HTML
Open

<a href="https://github.com/alibaba/java-dns-cache-manipulator/graphs/contributors"><img src="https://img.shields.io/github/contributors/alibaba/java-dns-cache-manipulator" alt="GitHub Contributors"></a>
Severity: Info
Found in docs/developer-guide.md by markdownlint

MD033 - Inline HTML

Tags: html

Aliases: no-inline-html

This rule is triggered whenever raw HTML is used in a markdown document:

Inline HTML header

To fix this, use 'pure' markdown instead of including raw HTML:

# Markdown header

Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

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.

Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
Open

    echo "$(tr -s '\n' ' ' < "$1")"
Severity: Minor
Found in tool/src/bin/dcm by shellcheck

Useless echo? Instead of echo $(cmd), just use cmd

Problematic code:

echo "$(cat 1.txt)"
echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6`

Correct code:

cat 1.txt # In bash, but faster and still sticks exactly one newline: printf '%s\n' "$(<1.txt)"
# The original `echo` sticks a newline; we want it too.
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6; echo

Rationale

The command substitution $(foo) yields the result of command foo with trailing newlines erased, and when it is passed to echo it generally just gives the same result as foo.

Exceptions

One may want to use command substitutions plus echo to make sure there is exactly one trailing newline. The special command substitution $(<file) in bash is also un-outline-able.

Anyway, echo is still not that reliable (see [[SC2039#echo-flags]]) and printf should be used instead.

Notice

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

Expected an indentation at 4 instead of at 2.
Open

  "maven-mvnd-*" {
Severity: Minor
Found in mvnw.cmd by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  }
Severity: Minor
Found in mvnw.cmd by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
Severity: Minor
Found in mvnw.cmd by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      the copyright owner that is granting the License.
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      "Source" form shall mean the preferred form for making modifications,
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      separable from, or merely link (or bind by name) to the interfaces of,
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      the copyright owner. For the purposes of this definition, "submitted"
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 8 instead of at 6.
Open

      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 4 instead of at 3.
Open

   3. Grant of Patent License. Subject to the terms and conditions of
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 12 instead of at 10.
Open

          excluding those notices that do not pertain to any part of
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 12 instead of at 10.
Open

          within such NOTICE file, excluding those notices that do not
Severity: Minor
Found in LICENSE by editorconfig

Expected an indentation at 12 instead of at 10.
Open

          pertain to any part of the Derivative Works, in at least one
Severity: Minor
Found in LICENSE by editorconfig
Severity
Category
Status
Source
Language