[ 
https://issues.apache.org/jira/browse/AVRO-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16680720#comment-16680720
 ] 

Michael A. Smith commented on AVRO-2255:
----------------------------------------

There isn't a trivial way to tell which files in the repo are shell scripts, 
because they don't all have a simple extension like '.sh'. A mildly non-trivial 
solution would be something like

{code:bash}
git ls-files -z | xargs -0 file | awk -F: '/shell script/{printf $1"\0"}' | 
xargs -0 shellcheck
{code}

If we want to run it in docker we can do that partially:

{code:bash}
git ls-files -z | xargs -0 file | awk -F: '/shell script/{printf $1"\0"}' |
    xargs -0 docker run --rm -v "$PWD:$PWD" -w "$PWD" koalaman/shellcheck
{code}

Doing it fully in docker is annoying because alpine doesn't have the `file` 
command (even though it's a POSIX standard command), so we'd have to jump 
through some hoops to get that working neatly.

> Implement shellcheck automatically on Pull Requests
> ---------------------------------------------------
>
>                 Key: AVRO-2255
>                 URL: https://issues.apache.org/jira/browse/AVRO-2255
>             Project: Apache Avro
>          Issue Type: Improvement
>            Reporter: Michael A. Smith
>            Priority: Major
>
> In the several PRs to AVRO-2229 I suggested improvements to some of the shell 
> scripts. Many of those improvements were bugs caught by 
> [https://github.com/koalaman/shellcheck.] I think we should implement 
> shellcheck in our automatic checks so that contributors get fast feedback on 
> their shell scripts.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to