Skip to content
This repository has been archived by the owner. It is now read-only.

Automatic syntax formatting for all shell scripts #110

Open
ollieparanoid opened this Issue Jun 24, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@ollieparanoid
Copy link
Member

commented Jun 24, 2017

That would be really helpful, something like autopep8, and an automatic check, like flake8. Suggestions welcome :)

@ollieparanoid

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2017

shfmt seems to be the right one for the job. However, it does not seem to be commonly packaged in Linux distributions, and with that program, we would introduce another dependency to the static code analysis script, making it even harder to install everything to run it locally before submitting a PR (which is required to keep development enjoyable).

I guess I will use it personally for formatting, but not let Travis require this for now.
It would be more user friendly to package all dependencies for static code analysis for Alpine Linux, and then use pmbootstrap to install them inside the native chroot, and do the static code analysis from there. That way, the host system does not get touched, and users do not need to worry about the dependencies.

If someone thinks, that this is a bad idea, please speak up here in the thread. This is how I would do it:

  • Package shfmt, shellcheck (this one has 11 (!) new Haskell dependencies), autopep8, flake8 for Alpine Linux
  • Rewrite the static analysis script to:
    • Install all tools in the native chroot
    • Copy the pmbootstrap source folder into the chroot (in a temporary folder)
    • Run all linters (fail on error)
    • Run all formatters
    • Copy the modified source back
@mvdan

This comment has been minimized.

Copy link

commented Jun 27, 2017

Let me know if you need any help packaging shfmt :)

@ollieparanoid

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2017

Thank you, I will come back to that offer if necessary :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.