pandora icon indicating copy to clipboard operation
pandora copied to clipboard

feat: Improve Bash script based on feedback

Open Adriel007 opened this issue 10 months ago • 3 comments

Script Documentation

This document outlines the improvements made to the Bash script based on the provided feedback.

Error Handling

  • Previously, the script used set -o errexit and set -o pipefail, ensuring better error handling. However, the variable fail was used without initialization. Now, fail is initialized before usage.

Directory Path Handling

  • Instead of using find, which can be problematic with spaces in file or directory names, a while loop with read is utilized. The IFS (Internal Field Separator) is modified to handle spaces.

Temporary File Handling

  • It's considered a good practice to use temporary files to store intermediate results. While not directly implemented here, it's recommended.

Directory Validation

  • Validation of directories before usage can prevent unexpected errors. This validation has been added after changing to the project's root directory.

Command and Go Installation Validation

  • Although not directly implemented here, it's suggested to add checks to ensure the availability of commands like gover, git and go, as well as proper installation of Go.

Script Changes Summary

  • Initialized the fail variable locally before usage.
  • Replaced find with a while loop to handle directory paths with spaces.
  • Added validation after changing to the project's root directory.

Script Overview

The script performs the following tasks:

  1. Changes to the project's root directory.
  2. Generates coverage files.
  3. Combines coverage reports.

Note: It's advisable to further enhance the script with command and Go installation validation checks.

Adriel007 avatar Apr 17 '24 01:04 Adriel007

Hi Adriel! Our product doesn't use Travis ci anymore. And this script used only in travic ci. I think we have to remove any mentions of travis

oke11o avatar Apr 23 '24 10:04 oke11o

Hi Adriel! Our product doesn't use Travis ci anymore. And this script used only in travic ci. I think we have to remove any mentions of travis

Ah, okay, thanks for the advice

Adriel007 avatar Apr 23 '24 10:04 Adriel007

I just fixed and pushed the commit.

Adriel007 avatar Apr 23 '24 10:04 Adriel007