terraform-google-modules / terraform-google-startup-scripts

Provides a library of useful startup scripts to embed in VMs
https://registry.terraform.io/modules/terraform-google-modules/startup-scripts/google
Apache License 2.0
73 stars 36 forks source link

Improve make checks, fix annoyances #5

Closed jeffmccune closed 5 years ago

jeffmccune commented 5 years ago

Without this patch there are a number of annoyances with the make checks. This patch fixes the following:

  1. Newlines not being added to auto-generated documentation.
  2. Auto generated documentation failing if README.md does not exist.
  3. Checks execute against .git/ index
  4. terraform validate executes redundantly

To address the doc generation annoyances, this patch converts combine_docfiles to fairly simple bash. The behavior is pure sed, the rest of the bash is argument and error handling.

For the others, the patch refactors make.sh to use a general find | xargs pattern with a single function to manage exclusion lists.

check_shebangs is removed because #! /bin/bash -e should not be used because it does not take effect if the script is called via bash

. Instead, calling `set -e` is preferred. ## Expected results: ``` make Running shellcheck Running flake8 Running go fmt and go vet Running terraform validate Running hadolint on Dockerfiles Checking for required files LICENSE README.md Testing the validity of the header check .. ---------------------------------------------------------------------- Ran 2 tests in 0.057s OK Checking file headers The following lines have trailing whitespace Generating markdown docs with terraform-docs No changes made: ./README.md No changes made: ./examples/simple_example/README.md ```
jeffmccune commented 5 years ago

Closing this for the time being, the doc generation script needs to remain in Python.