Skip to content

[sweeper] dot_zshrc.tmpl #168

Description

@github-actions

Failing file

dot_zshrc.tmpl

Check

shellcheck(sh) on the rendered POSIX-sh output

Problem

The rendered output contains a zsh-style function definition that shellcheck cannot parse as POSIX sh, plus several one-line if [[ ... ]] then statements that are missing a separator before then. The parse error cascades into a missing-} error at the end of the file.

Output

In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 19:
function zle-line-init { print -n '\e[6 q' }
                       ^-- SC1073 (error): Couldn't parse this brace group. Fix to allow more checks.
                                           ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 83:
if [[ -f $HOME/.atuin/bin/env ]] then
                                 ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 86:
if [[ $(command -v atuin) ]] then
                             ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 92:
if [[ $(command -v starship) ]] then
                                ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 97:
if [[ $(command -v thefuck) ]] then
                               ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 118:
if [[ $(command -v factory) ]] then
                               ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 123:
if [[ -d "$HOME/.lmstudio/bin" ]] then
                                  ^-- SC1010 (warning): Use semicolon or linefeed before 'then' (or quote to make it literal).


In /tmp/tmp.z13vt9kS2M/dot_zshrc.tmpl line 139:

^-- SC1056 (error): Expected a '}'. If you have one, try a ; or \n in front of it.
^-- SC1072 (error): Missing '}'. Fix any mentioned problems and try again.

For more information:
  https://www.shellcheck.net/wiki/SC1056 -- Expected a '}'. If you have one, ...
  https://www.shellcheck.net/wiki/SC1010 -- Use semicolon or linefeed before ...
  https://www.shellcheck.net/wiki/SC1083 -- This } is literal. Check expressi...

Suggested fix

  1. Rewrite the function definition at line 19 to a form that shellcheck's sh parser accepts. Either add parentheses:
function zle-line-init() {
  print -n '\e[6 q'
}

or drop the function keyword:

zle-line-init() {
  print -n '\e[6 q'
}

This resolves the SC1073/SC1083 parse error and should also clear the cascading SC1056/SC1072 errors at line 139.

  1. Add a semicolon before then on every one-line if statement, or move then to its own line. For example, line 83 becomes:
if [[ -f $HOME/.atuin/bin/env ]]; then
  . "$HOME/.atuin/bin/env"
fi

Apply the same change to the if blocks at lines 86, 92, 97, 118, and 123.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sweeperOpened by the Sweeper Minion consistency sweep

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions