[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: Tip: Use shellcheck to do static analysis of sh and bash scripts
From:       Richard Heck <rgheck () lyx ! org>
Date:       2017-08-21 21:26:53
Message-ID: a73b6b63-49ea-6086-e460-1a70e3f7243e () lyx ! org
[Download RAW message or body]

On 08/20/2017 12:32 PM, Christian Ridderström wrote:
> Hi,
>
> Just sharing a tip for when you write sh or bash scripts. Use a static
> analysis tool like 'shellcheck' on the scripts.
>     https://www.shellcheck.net/

Thanks for the reference. It's a useful tool.

> Below is a list of LyX scripts for which the shellcheck indicates at
> least something:
>
> HEAD @ chrid-mb $ find . -name "*.sh" -exec bash -c 'shellcheck "$1" >
> /dev/null || echo "Issue found with: $1"; ' "" {} \;
> Issue found with: ./3rdparty/boost/extract.sh

Not ours.

> Issue found with: ./autogen.sh

I fixed two very minor issues with that one and one weird one I did not
even know about.
See here: https://github.com/koalaman/shellcheck/wiki/SC2015.

> Issue found with: ./development/attic/rename.sh

Attic.

> Issue found with: ./development/autotests/export-in.sh
> Issue found with: ./development/autotests/run-tests.sh
> Issue found with: ./development/autotests/single-test.sh
> Issue found with: ./development/keystest/add_write_perms.sh
> Issue found with: ./development/keystest/cache-bisect.sh
> Issue found with: ./development/keystest/doNtimes.sh
> Issue found with: ./development/keystest/killtest.sh
> Issue found with: ./development/keystest/killtestpy.sh
> Issue found with: ./development/keystest/list_all_children.sh
> Issue found with: ./development/keystest/lyx_make.sh
> Issue found with: ./development/keystest/main.sh
> Issue found with: ./development/keystest/make_screen_shots.sh
> Issue found with: ./development/keystest/maketar.sh
> Issue found with: ./development/keystest/report.sh
> Issue found with: ./development/keystest/report_html.sh
> Issue found with: ./development/keystest/reproduce.sh
> Issue found with: ./development/keystest/setup.sh
> Issue found with: ./development/keystest/shared_functions.sh
> Issue found with: ./development/keystest/shared_variables.sh
> Issue found with: ./development/keystest/watch_keytest.sh

Someone who deals with the tests might look at these.

> Issue found with: ./development/tools/count_lines_of_included_code.sh
> Issue found with:
> ./development/tools/count_total_lines_of_compiled_code.sh
> Issue found with: ./development/tools/header_check.sh
> Issue found with: ./development/tools/list_included_headers.sh

All pretty old. I'm not sure if anyone even uses them.

> Issue found with: ./development/tools/separator-convert.sh

Moved to attic. Was for 2.2.->2.3 document conversion.

> Issue found with: ./development/tools/update-po.sh
> Issue found with: ./development/tools/updatelfuns.sh
> Issue found with: ./development/tools/updatestats.sh

Fixed all found issues with these.

Also examined the lyx-build script and put some comments into it.

Richard



[Attachment #3 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 08/20/2017 12:32 PM, Christian
      Ridderström wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>Just sharing a tip for when you write sh or bash scripts.
          Use a static analysis tool like 'shellcheck' on the scripts.</div>
        <div>    <a href="https://www.shellcheck.net/" target="_blank"
            moz-do-not-send="true">https://www.shellcheck.net/</a></div>
      </div>
    </blockquote>
    <br>
    Thanks for the reference. It's a useful tool.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">Below is a list of LyX scripts for which the
        shellcheck indicates at least something:
        <div>
          <div>
            <div>
              <div><br>
              </div>
              <div>HEAD @ chrid-mb $ find . -name "*.sh" -exec bash -c
                'shellcheck "$1" &gt; /dev/null || echo "Issue found
                with: $1"; ' "" {} \;</div>
              <div>Issue found with: ./3rdparty/boost/extract.sh</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Not ours.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Issue found with: ./autogen.sh</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I fixed two very minor issues with that one and one weird one I did
    not even know about.<br>
    See here: <a class="moz-txt-link-freetext" \
href="https://github.com/koalaman/shellcheck/wiki/SC2015">https://github.com/koalaman/shellcheck/wiki/SC2015</a>.<br>
  <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Issue found with: ./development/attic/rename.sh</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Attic.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Issue found with: ./development/autotests/<wbr>export-in.sh</div>
              <div>Issue found with: ./development/autotests/run-<wbr>tests.sh</div>
              <div>Issue found with: \
                ./development/autotests/<wbr>single-test.sh</div>
              <div>Issue found with: \
                ./development/keystest/add_<wbr>write_perms.sh</div>
              <div>Issue found with: \
                ./development/keystest/cache-<wbr>bisect.sh</div>
              <div>Issue found with: ./development/keystest/<wbr>doNtimes.sh</div>
              <div>Issue found with: ./development/keystest/<wbr>killtest.sh</div>
              <div>Issue found with: ./development/keystest/<wbr>killtestpy.sh</div>
              <div>Issue found with: \
                ./development/keystest/list_<wbr>all_children.sh</div>
              <div>Issue found with: ./development/keystest/lyx_<wbr>make.sh</div>
              <div>Issue found with: ./development/keystest/main.sh</div>
              <div>Issue found with: \
                ./development/keystest/make_<wbr>screen_shots.sh</div>
              <div>Issue found with: ./development/keystest/<wbr>maketar.sh</div>
              <div>Issue found with: ./development/keystest/report.<wbr>sh</div>
              <div>Issue found with: ./development/keystest/report_<wbr>html.sh</div>
              <div>Issue found with: ./development/keystest/<wbr>reproduce.sh</div>
              <div>Issue found with: ./development/keystest/setup.<wbr>sh</div>
              <div>Issue found with: \
                ./development/keystest/shared_<wbr>functions.sh</div>
              <div>Issue found with: \
                ./development/keystest/shared_<wbr>variables.sh</div>
              <div>Issue found with: \
./development/keystest/watch_<wbr>keytest.sh</div>  </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Someone who deals with the tests might look at these.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>Issue found with:
              ./development/tools/count_lines_of_included_code.sh
              <div>Issue found with: \
                ./development/tools/count_<wbr>total_lines_of_compiled_code.<wbr>sh</div>
                
              <div>Issue found with: ./development/tools/header_<wbr>check.sh</div>
              <div>Issue found with: \
./development/tools/list_<wbr>included_headers.sh</div>  </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    All pretty old. I'm not sure if anyone even uses them.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Issue found with: \
./development/tools/separator-<wbr>convert.sh</div>  </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Moved to attic. Was for 2.2.-&gt;2.3 document conversion.<br>
    <br>
    <blockquote type="cite"
cite="mid:CANP4zpPnHgoqzuKH9=nxuDz+NhgQpOoY9x4qFDU2wgLV_Bnf6A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Issue found with: ./development/tools/update-po.<wbr>sh</div>
              <div>Issue found with: ./development/tools/<wbr>updatelfuns.sh</div>
              <div>Issue found with: ./development/tools/<wbr>updatestats.sh</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Fixed all found issues with these. <br>
    <br>
    Also examined the lyx-build script and put some comments into it.<br>
    <br>
    Richard<br>
    <br>
    <p><br>
    </p>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic