Back to all reviewers

Avoid variable name abbreviations

Homebrew/brew
Based on 4 comments
Shell

Use complete, descriptive variable names instead of abbreviations to enhance code readability and maintainability. Short abbreviations like `dir`, `repo`, and single-letter variables often obscure the purpose of the variable and make code harder to understand for new contributors.

Naming Conventions Shell

Reviewer Prompt

Use complete, descriptive variable names instead of abbreviations to enhance code readability and maintainability. Short abbreviations like dir, repo, and single-letter variables often obscure the purpose of the variable and make code harder to understand for new contributors.

Good:

normalise_tap_name() {
  local directory="$1"
  local user
  local repository

  user="$(tr '[:upper:]' '[:lower:]' <<<"${directory%%/*}")"
  repository="$(tr '[:upper:]' '[:lower:]' <<<"${directory#*/}")"
  repository="${repository#@(home|linux)brew-}"
  echo "${user}/${repository}"
}

Bad:

normalise_tap_name() {
  local dir="$1"
  local u
  local repo

  u="$(tr '[:upper:]' '[:lower:]' <<<"${dir%%/*}")"
  repo="$(tr '[:upper:]' '[:lower:]' <<<"${dir#*/}")"
  repo="${repo#@(home|linux)brew-}"
  echo "${u}/${repo}"
}

Exceptions: Standard abbreviations that are widely understood within the domain or temporary variables with extremely limited scope and obvious context.

4
Comments Analyzed
Shell
Primary Language
Naming Conventions
Category

Source Discussions