Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(scripts): Formatting #16241

Merged
merged 2 commits into from
Oct 4, 2024
Merged

chore(scripts): Formatting #16241

merged 2 commits into from
Oct 4, 2024

Conversation

AndesKrrrrrrrrrrr
Copy link
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr commented Oct 2, 2024

Format all shell scripts.

Command to reproduce:

shfmt --write $(git ls-files '**/*.sh')

No refactoring in this PR, only formatting.

Summary by CodeRabbit

  • Bug Fixes
    • Improved formatting and readability of various scripts without altering their functionality.
  • Refactor
    • Standardized whitespace and indentation across multiple scripts to enhance consistency.
    • Updated function signatures for clarity in create-secret.sh.
  • Chores
    • Minor adjustments to control flow and formatting in scripts to improve maintainability.

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr requested review from a team as code owners October 2, 2024 15:32
Copy link
Contributor

coderabbitai bot commented Oct 2, 2024

Walkthrough

This pull request includes extensive formatting changes across multiple shell scripts to improve readability and maintainability. Modifications primarily involve adjusting whitespace, indentation, and alignment of commands, while maintaining the original functionality of the scripts. Notably, some scripts have enhanced control flow structures, and a few have minor logic adjustments related to variable assignments.

Changes

File Change Summary
apps/financial-aid/api/scripts/run-xroad-proxy.sh Adjusted indentation of AWS CLI commands for improved readability.
apps/services/search-indexer/bin/generate-es-config.sh Removed unnecessary spaces and standardized indentation and formatting.
infra/scripts/build-docker-container.sh Adjusted spacing around command substitutions and conditional statements for consistency.
infra/scripts/ci/diff-chart-values-all-charts.sh Reformatted variable assignments and loop structures for clarity.
infra/scripts/ci/diff-chart-values.sh Adjusted whitespace and indentation in the case statement for better readability.
infra/scripts/ci/git-check-dirty.sh Enhanced functionality to check for unstaged changes and adjusted user configuration logic.
infra/scripts/ci/test-unit.sh Reformatted variable assignments and encapsulated Jest command execution in a subshell.
infra/scripts/container-scripts/destroy-dbs.sh Adjusted indentation for while loops for improved readability.
infra/scripts/format-yaml.sh Minor formatting change in the assignment of the DIR variable.
infra/scripts/helm-diff.sh Reformatted conditional checks and error messages for consistency.
scripts/ci/00_prepare-base-tags.sh Adjusted whitespace and control flow for better readability.
scripts/ci/10_prepare-docker-deps.sh Minor formatting change in the assignment of the DIR variable.
scripts/ci/10_prepare-host-deps.sh Removed unnecessary whitespace and added a newline at the end of the file.
scripts/ci/20_check-formatting.sh Added a newline at the end of the file.
scripts/ci/30_test.sh Adjusted formatting of variable assignments and loop structures for clarity.
scripts/ci/50_upload-coverage.sh Reformatted command substitutions for consistency.
scripts/ci/90_docker-express.sh Removed unnecessary whitespace in the assignment of the DIR variable.
scripts/ci/90_docker-jest.sh Removed unnecessary whitespace in the assignment of the DIR variable.
scripts/ci/90_docker-next.sh Removed unnecessary whitespace in the assignment of the DIR variable.
scripts/ci/90_docker-playwright.sh Removed unnecessary whitespace in the assignment of the DIR variable.
scripts/ci/90_docker-static.sh Removed unnecessary whitespace in the assignment of the DIR variable.
scripts/ci/_common.sh Reformatted DIR variable assignment and combined export statements for clarity.
scripts/ci/_nx-affected-targets.sh Corrected syntax in the conditional statement for environment variable checks.
scripts/ci/cache/generate-files.sh Added a newline at the end of the file.
scripts/ci/ci.sh Reformatted variable assignment for consistency.
scripts/ci/docker-login-ecr.sh Reformatted variable assignment for consistency.
scripts/ci/generate-build-chunks.sh Adjusted formatting of variable assignments and loop structures for clarity.
scripts/ci/generate-chunks.sh Adjusted formatting of if statement for consistency.
scripts/ci/list-unaffected.sh Adjusted formatting of variable assignments and loop structures for clarity.
scripts/ci/retag-unaffected.sh Reformatted variable assignment for consistency.
scripts/ci/run-affected-in-parallel.sh Reformatted variable assignment for consistency.
scripts/ci/run-in-parallel-native.sh Reformatted variable assignment for consistency and adjusted conditional statement.
scripts/ci/run-in-parallel.sh Reformatted variable assignment for consistency.
scripts/create-secret.sh Standardized function declaration styles and adjusted error handling formatting.
scripts/dockerfile-assets/bash/extract-environment.sh Reformatted variable assignment for consistency.
scripts/stop-test-proxies.sh Adjusted formatting of array declaration and loop syntax for consistency.

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (11)
infra/scripts/ci/diff-chart-values-all-charts.sh (1)

8-11: LGTM: Improved loop formatting with a suggestion

The reformatting of the loop to a multi-line structure enhances readability while maintaining the same functionality. This change aligns well with the PR's formatting objectives.

For future improvements, consider replacing the Python one-liner with a native bash solution for listing directories. This could potentially improve performance and reduce dependencies. For example:

for chart in $(
  cd "$ROOT/infra/src/uber-charts/" && 
  find . -maxdepth 1 -type f -name '*.json' -exec basename {} .json \;
); do
  # ... rest of the loop
done

This suggestion is outside the scope of the current PR and can be considered for future refactoring.

scripts/ci/generate-chunks.sh (1)

9-14: LGTM with a suggestion: Consider making the skip condition more flexible

The reformatting of the if statement improves readability. The use of environment variables with default values enhances script flexibility.

However, the skip condition "$SKIP_TESTS_ON_BRANCH" == "7913-$BRANCH" seems very specific. Consider making this more flexible, perhaps using a pattern match or a configurable value.

Example:

if [[ "$BRANCH" =~ $SKIP_TESTS_PATTERN ]]; then

This would allow for more dynamic control over which branches skip tests.

scripts/ci/30_test.sh (1)

Line range hint 1-56: Consider optimizing script efficiency

While the formatting changes improve readability, consider the following suggestions to enhance script efficiency:

  1. Use [[ ]] instead of [ ] for condition testing, as it's more efficient and less error-prone.
  2. Consider using a case statement instead of multiple if-else conditions for setting IS_FLAKY_TEST and EXTRA_OPTS.
  3. Use mapfile or readarray to read the arrays instead of declaring them inline, which can be more efficient for larger arrays.

These changes could further improve the script's efficiency while maintaining its readability and maintainability.

scripts/ci/00_prepare-base-tags.sh (1)

Line range hint 1-38: Overall: Well-structured and maintainable script with room for minor improvement

The script demonstrates good practices in terms of efficiency, readability, and maintainability. It makes excellent use of environmental variables and integrates well with GitHub Actions. The error handling and reporting mechanisms enhance its robustness in a CI/CD context.

While the script indirectly supports NX workspace integration through the variables it sets, consider adding a comment explaining how these variables are used in the NX context. This would further improve the script's maintainability and alignment with the guideline for NX workspace integration.

scripts/create-secret.sh (7)

43-47: Improved validate_empty function formatting and logic

The changes to the validate_empty function enhance readability and robustness:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Using [[ ]] instead of [ ] is a good practice for more predictable behavior.
  3. Moving the then keyword to the same line as the condition improves readability.

These changes align well with the script efficiency and readability guidelines.

Consider using [[ -z $1 ]] instead of [[ -d $1 ]] to check for an empty parameter, as it's more idiomatic for string checking in shell scripts.


55-64: Improved validate_whitespace function formatting

The changes to the validate_whitespace function enhance readability and consistency:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Reformatting the conditional statements improves readability.

These changes align well with the script efficiency and readability guidelines.

Consider using the __error_exit function for error handling instead of directly calling exit 0. This would provide more consistent error handling throughout the script. For example:

if [[ $1 = "$ILLEGAL_CHARS" ]]; then
  __error_exit "Whitespaces are not allowed"
fi

66-76: Improved validate_chars function formatting

The changes to the validate_chars function enhance readability and consistency:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Reformatting the conditional statements improves readability.

These changes align well with the script efficiency and readability guidelines.

Similar to the previous suggestion, consider using the __error_exit function for error handling instead of directly calling exit 0. This would provide more consistent error handling throughout the script. For example:

if [[ ! $1 =~ $ALPHANUMERIC_DASH$ONE_OR_MORE ]]; then
  __error_exit "Secret name can only contain letters, numbers, hyphens and underscores"
fi

Line range hint 78-91: Improved validate_length function formatting

The changes to the validate_length function enhance readability and consistency:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Reformatting the conditional statements improves readability.

These changes align well with the script efficiency and readability guidelines.

Consider the following improvements:

  1. Use the __error_exit function for consistent error handling:
    if ((${#1} < MIN_LENGTH || ${#1} > MAX_LENGTH)); then
      __error_exit "Too short, should be 6-256 characters long."
    fi
  2. Use the $MAX_LENGTH variable in the error message instead of hardcoding "256":
    __error_exit "Too short, should be $MIN_LENGTH-$MAX_LENGTH characters long."

This change would make the error message more maintainable if the MAX_LENGTH value changes in the future.


Line range hint 94-128: Improved prepare_secret function formatting

The changes to the prepare_secret function enhance readability and consistency:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Reformatting the conditional statements improves readability.

These changes align well with the script efficiency and readability guidelines.

Consider the following improvements for better user input handling:

  1. Use read -r instead of read -er for better portability across different shells.
  2. Add input validation for the SecureString and Add tags prompts. For example:
    while true; do
      read -rp "${BLUE}SecureString [Y/n]? ${RESET}" yn
      case $yn in
        [Yy]*|"" ) SECRET_TYPE="SecureString"; break;;
        [Nn]* ) SECRET_TYPE="String"; break;;
        * ) echo "Please answer yes or no.";;
      esac
    done

This change would make the script more robust against unexpected user inputs.


130-142: Improved create_secret function formatting

The changes to the create_secret function enhance readability and consistency:

  1. Removing the space before the parentheses in the function declaration improves consistency.
  2. Reformatting the conditional statement improves readability.

These changes align well with the script efficiency and readability guidelines.

Consider the following improvements for better security and error handling:

  1. Use double quotes around variables to prevent word splitting and globbing:
    CMD="aws ssm put-parameter --name \"$SSM_PREFIX$SECRET_NAME\" --value \"$SECRET_VALUE\" --type \"$SECRET_TYPE\""
  2. Add error handling for the AWS CLI command:
    if ! eval "$CMD"; then
      __error_exit "Failed to create secret"
    fi

These changes would make the script more secure and robust against potential errors.


Line range hint 1-168: Overall improvement in script formatting and readability

The changes made to this script have significantly enhanced its readability and maintainability:

  1. Consistent function declaration style throughout the script.
  2. Improved formatting of conditional statements and case blocks.
  3. Better overall code structure and indentation.

These changes align well with the provided coding guidelines, particularly in terms of script efficiency, readability, and maintainability. The script continues to use environmental variables and follows a modular structure, which is good for flexibility and maintainability.

While the functional aspects of the script remain unchanged, the improved formatting will make it easier for developers to understand and modify the code in the future.

To further improve the script, consider:

  1. Implementing more consistent error handling using the __error_exit function throughout.
  2. Enhancing input validation for user prompts to make the script more robust.
  3. Using double quotes around variables consistently to prevent word splitting and globbing issues.
  4. Adding comments to explain complex logic or important decisions in the script.

These suggestions would further enhance the script's robustness and maintainability, aligning even more closely with best practices for shell scripting.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0e45aa5 and 5e883df.

📒 Files selected for processing (36)
  • apps/financial-aid/api/scripts/run-xroad-proxy.sh (1 hunks)
  • apps/services/search-indexer/bin/generate-es-config.sh (1 hunks)
  • infra/scripts/build-docker-container.sh (2 hunks)
  • infra/scripts/ci/diff-chart-values-all-charts.sh (1 hunks)
  • infra/scripts/ci/diff-chart-values.sh (1 hunks)
  • infra/scripts/ci/git-check-dirty.sh (0 hunks)
  • infra/scripts/ci/test-unit.sh (1 hunks)
  • infra/scripts/container-scripts/destroy-dbs.sh (1 hunks)
  • infra/scripts/format-yaml.sh (1 hunks)
  • infra/scripts/helm-diff.sh (1 hunks)
  • scripts/ci/00_prepare-base-tags.sh (3 hunks)
  • scripts/ci/10_prepare-docker-deps.sh (1 hunks)
  • scripts/ci/10_prepare-host-deps.sh (1 hunks)
  • scripts/ci/20_check-formatting.sh (1 hunks)
  • scripts/ci/30_test.sh (1 hunks)
  • scripts/ci/50_upload-coverage.sh (2 hunks)
  • scripts/ci/90_docker-express.sh (1 hunks)
  • scripts/ci/90_docker-jest.sh (1 hunks)
  • scripts/ci/90_docker-next.sh (1 hunks)
  • scripts/ci/90_docker-playwright.sh (1 hunks)
  • scripts/ci/90_docker-static.sh (1 hunks)
  • scripts/ci/_common.sh (2 hunks)
  • scripts/ci/_nx-affected-targets.sh (1 hunks)
  • scripts/ci/cache/generate-files.sh (1 hunks)
  • scripts/ci/ci.sh (1 hunks)
  • scripts/ci/docker-login-ecr.sh (1 hunks)
  • scripts/ci/generate-build-chunks.sh (1 hunks)
  • scripts/ci/generate-chunks.sh (1 hunks)
  • scripts/ci/list-unaffected.sh (2 hunks)
  • scripts/ci/retag-unaffected.sh (1 hunks)
  • scripts/ci/run-affected-in-parallel.sh (1 hunks)
  • scripts/ci/run-in-parallel-native.sh (1 hunks)
  • scripts/ci/run-in-parallel.sh (2 hunks)
  • scripts/create-secret.sh (4 hunks)
  • scripts/dockerfile-assets/bash/extract-environment.sh (1 hunks)
  • scripts/stop-test-proxies.sh (1 hunks)
💤 Files with no reviewable changes (1)
  • infra/scripts/ci/git-check-dirty.sh
✅ Files skipped from review due to trivial changes (28)
  • apps/financial-aid/api/scripts/run-xroad-proxy.sh
  • apps/services/search-indexer/bin/generate-es-config.sh
  • infra/scripts/build-docker-container.sh
  • infra/scripts/ci/diff-chart-values.sh
  • infra/scripts/ci/test-unit.sh
  • infra/scripts/format-yaml.sh
  • infra/scripts/helm-diff.sh
  • scripts/ci/10_prepare-docker-deps.sh
  • scripts/ci/10_prepare-host-deps.sh
  • scripts/ci/20_check-formatting.sh
  • scripts/ci/50_upload-coverage.sh
  • scripts/ci/90_docker-express.sh
  • scripts/ci/90_docker-jest.sh
  • scripts/ci/90_docker-next.sh
  • scripts/ci/90_docker-playwright.sh
  • scripts/ci/90_docker-static.sh
  • scripts/ci/_common.sh
  • scripts/ci/cache/generate-files.sh
  • scripts/ci/ci.sh
  • scripts/ci/docker-login-ecr.sh
  • scripts/ci/generate-build-chunks.sh
  • scripts/ci/list-unaffected.sh
  • scripts/ci/retag-unaffected.sh
  • scripts/ci/run-affected-in-parallel.sh
  • scripts/ci/run-in-parallel-native.sh
  • scripts/ci/run-in-parallel.sh
  • scripts/dockerfile-assets/bash/extract-environment.sh
  • scripts/stop-test-proxies.sh
🧰 Additional context used
📓 Path-based instructions (5)
scripts/ci/00_prepare-base-tags.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
scripts/ci/30_test.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
scripts/ci/_nx-affected-targets.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
scripts/ci/generate-chunks.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
scripts/create-secret.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
🔇 Additional comments (19)
infra/scripts/ci/diff-chart-values-all-charts.sh (3)

5-5: LGTM: Improved variable assignment formatting

The reformatting of the DIR variable assignment to a single line improves readability and aligns with common bash scripting practices. This change is consistent with the PR's objective of formatting shell scripts.


12-13: LGTM: Consistent formatting applied

The slight reformatting of the diff-chart-values.sh execution line maintains consistency with the overall formatting style of the script. This change adheres to the PR's objective of improving shell script formatting.


Line range hint 1-13: LGTM: Successful formatting aligned with PR objectives

The changes in this file are entirely formatting-related and align perfectly with the PR's objective of formatting all shell scripts. The use of shfmt, as mentioned in the PR description, is evident in the consistent and improved formatting throughout the script. These changes enhance readability and maintainability without altering the script's functionality.

scripts/ci/generate-chunks.sh (3)

1-8: LGTM: Good script setup and initialization

The script follows good practices for bash scripting:

  • Uses set -euxo pipefail for enhanced error handling and debugging.
  • Sets the DIR variable robustly.
  • Sources a common script, promoting code reuse.

These practices contribute to script efficiency and maintainability.


Line range hint 15-21: LGTM: Efficient integration with NX and good output handling

This section of the script demonstrates several strengths:

  1. Good integration with NX workspace utilities using _nx-affected-targets.sh.
  2. Separation of concerns by using a dedicated Node.js script for chunking.
  3. Efficient use of stdout for the main output and stderr for logging.

These practices contribute to the script's efficiency and maintainability, aligning well with the coding guidelines.


Line range hint 1-21: Overall assessment: Well-structured and efficient script with minor improvement opportunity

This script demonstrates good practices in bash scripting and aligns well with the provided coding guidelines:

  1. Efficient and readable code structure.
  2. Use of environmental variables for flexibility.
  3. Good integration with NX workspace utilities.
  4. Improved formatting enhances readability.

The only suggestion for improvement is to consider making the skip condition more flexible to accommodate future changes more easily.

Great job on maintaining and improving this script!

infra/scripts/container-scripts/destroy-dbs.sh (3)

11-14: Formatting improvement: Proper indentation of while loop

The changes in this segment improve the readability of the code by correctly indenting the while loop and aligning the 'done' statement with the 'while' statement. This adheres to common shell scripting style guidelines and is consistent with the PR objectives.


16-19: Formatting improvement: Consistent indentation across loops

The changes in this segment mirror those in the previous loop, demonstrating a consistent approach to formatting throughout the script. The improved indentation and alignment enhance readability while maintaining the original functionality.


Line range hint 1-21: Verify use of 'shfmt' and consider CI integration

The formatting changes are consistent with the PR objectives and appear to have been applied uniformly across the script. To ensure ongoing consistency:

  1. Can you confirm that the shfmt command mentioned in the PR description was used for these changes?
  2. Consider integrating shfmt into your CI process to maintain consistent formatting across all shell scripts in the repository.

To verify the use of 'shfmt', you can run the following command and compare the output with the current file:

This will show how shfmt would format the file, allowing you to confirm if the current changes match the tool's output.

scripts/ci/_nx-affected-targets.sh (2)

Line range hint 1-24: LGTM: Well-structured script with good practices

The script is well-organized and follows good practices:

  • Uses strict mode (set -euxo pipefail) for better error handling.
  • Sources a common script, promoting code reuse.
  • Utilizes environment variables for flexibility.
  • Integrates with NX workspace utilities.

These practices align well with the coding guidelines for script efficiency, readability, and maintainability.


17-17: Approved: Syntax correction improves code quality

The addition of a space before the closing square brackets in the if statement is a correct syntax improvement. This change:

  • Ensures proper evaluation of the conditional expression.
  • Improves code readability.
  • Adheres to shell scripting best practices.

While the logic remains unchanged, this correction is important for maintaining high-quality, error-free scripts.

scripts/ci/30_test.sh (2)

50-55: Improved formatting enhances readability

The reformatting of the for loop improves the script's readability without changing its functionality. This change aligns well with our guidelines for maintaining readable and maintainable scripts.


56-56: Improved exit statement formatting

The addition of a newline before the exit statement enhances the script's readability and log clarity. This small change adheres to good shell scripting practices and improves maintainability.

scripts/ci/00_prepare-base-tags.sh (4)

4-4: LGTM: Proper script directory resolution

The script correctly uses a reliable method to determine its own directory, which is crucial for relative path operations. This approach enhances script portability and maintainability.


13-13: LGTM: Consistent formatting and proper use of environment variables

The formatting change improves consistency. More importantly, the script correctly uses GitHub Actions environment variables, adhering to the guideline for flexibility and integration with CI/CD systems.


26-30: LGTM: Improved formatting and robust error handling

The formatting changes enhance readability. The error handling mechanism, including Slack notification, is a good practice for maintaining observability in the CI/CD pipeline. This aligns well with the guidelines for script maintainability and efficiency.


32-32: LGTM: Improved control flow

Moving the BASE assignment inside the else block is a good improvement. It ensures that BASE is only set when BUILD_REF is valid, enhancing the script's logic and error handling. This change aligns well with the guidelines for script efficiency and maintainability.

scripts/create-secret.sh (2)

32-35: Improved error handling function formatting

The changes to the __error_exit function enhance readability and maintainability:

  1. Removing the space before the parentheses in the function declaration adheres to common shell scripting conventions.
  2. Separating the printf and exit commands improves clarity and allows for easier debugging if needed.

These changes align well with the script efficiency and readability guidelines.


144-164: Improved case statement formatting

The changes to the case statement significantly enhance readability:

  1. Each case is now on a separate line with proper indentation.
  2. The overall structure is more consistent and easier to read.

These changes align well with the script efficiency and readability guidelines, making the code more maintainable.

scripts/ci/_nx-affected-targets.sh Show resolved Hide resolved
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr added deprecated:automerge (Disabled) Merge this PR as soon as all checks pass deploy-feature Deploys features to dev test everything 💀 test & build everything 💀 labels Oct 2, 2024
Copy link
Member

@svanaeinars svanaeinars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.92%. Comparing base (47df0c0) to head (c007259).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16241   +/-   ##
=======================================
  Coverage   36.92%   36.92%           
=======================================
  Files        6781     6781           
  Lines      140031   140031           
  Branches    39816    39816           
=======================================
  Hits        51705    51705           
  Misses      88326    88326           
Flag Coverage Δ
air-discount-scheme-backend 54.22% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-catalogue-services 77.85% <ø> (ø)
api-domains-air-discount-scheme 36.95% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.92% <ø> (ø)
api-domains-criminal-record 47.93% <ø> (ø)
api-domains-driving-license 44.48% <ø> (ø)
api-domains-education 31.74% <ø> (ø)
api-domains-health-insurance 34.78% <ø> (ø)
api-domains-mortgage-certificate 35.71% <ø> (ø)
api-domains-payment-schedule 41.22% <ø> (ø)
application-api-files 57.91% <ø> (ø)
application-core 71.29% <ø> (ø)
application-system-api 41.63% <ø> (ø)
application-template-api-modules 24.40% <ø> (ø)
application-templates-accident-notification 29.44% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.63% <ø> (ø)
application-templates-estate 12.33% <ø> (ø)
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.22% <ø> (+0.07%) ⬆️
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.29% <ø> (ø)
auth-admin-web 2.43% <ø> (ø)
auth-nest-tools 31.31% <ø> (ø)
auth-react 22.80% <ø> (ø)
auth-shared 75.00% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.73% <ø> (ø)
clients-driving-license-book 43.90% <ø> (ø)
clients-financial-statements-inao 49.25% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-middlewares 73.36% <ø> (+0.59%) ⬆️
clients-regulations 42.71% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.64% <ø> (ø)
clients-zendesk 54.61% <ø> (ø)
cms 0.43% <ø> (ø)
cms-translations 39.04% <ø> (ø)
content-search-index-manager 95.65% <ø> (ø)
content-search-toolkit 8.16% <ø> (ø)
contentful-apps 5.57% <ø> (ø)
dokobit-signing 63.20% <ø> (ø)
download-service 44.09% <ø> (ø)
email-service 60.97% <ø> (ø)
feature-flags 90.97% <ø> (ø)
file-storage 53.48% <ø> (ø)
financial-aid-backend 56.53% <ø> (ø)
financial-aid-shared 19.03% <ø> (ø)
icelandic-names-registry-backend 54.55% <ø> (ø)
infra-nest-server 48.75% <ø> (ø)
infra-tracing 43.24% <ø> (ø)
island-ui-core 28.47% <ø> (ø)
judicial-system-api 18.30% <ø> (ø)
judicial-system-audit-trail 69.10% <ø> (ø)
judicial-system-backend 55.24% <ø> (ø)
judicial-system-formatters 79.76% <ø> (ø)
judicial-system-message 67.12% <ø> (ø)
judicial-system-message-handler 48.17% <ø> (ø)
judicial-system-scheduler 69.17% <ø> (ø)
judicial-system-types 48.35% <ø> (ø)
judicial-system-web 28.11% <ø> (ø)
license-api 42.68% <ø> (+0.05%) ⬆️
localization 10.15% <ø> (ø)
logging 48.43% <ø> (ø)
message-queue 67.71% <ø> (ø)
nest-audit 68.20% <ø> (ø)
nest-config 78.32% <ø> (ø)
nest-feature-flags 51.95% <ø> (ø)
nest-problem 46.34% <ø> (ø)
nest-sequelize 94.44% <ø> (ø)
nest-swagger 51.71% <ø> (ø)
nova-sms 62.56% <ø> (ø)
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.17% <ø> (ø)
reference-backend 50.41% <ø> (ø)
regulations 16.78% <ø> (ø)
residence-history 85.00% <ø> (ø)
services-auth-admin-api 51.98% <ø> (ø)
services-auth-delegation-api 57.93% <ø> (ø)
services-auth-ids-api 51.87% <ø> (-0.01%) ⬇️
services-auth-personal-representative 45.55% <ø> (+0.02%) ⬆️
services-auth-personal-representative-public 41.59% <ø> (ø)
services-auth-public-api 49.37% <ø> (ø)
services-documents 61.17% <ø> (ø)
services-endorsements-api 55.22% <ø> (ø)
services-sessions 65.74% <ø> (-0.05%) ⬇️
services-university-gateway 48.55% <ø> (+0.02%) ⬆️
services-user-notification 47.07% <ø> (ø)
services-user-profile 62.28% <ø> (ø)
shared-components 27.68% <ø> (ø)
shared-form-fields 31.63% <ø> (ø)
shared-mocking 64.62% <ø> (ø)
shared-pii 92.85% <ø> (ø)
shared-problem 87.50% <ø> (ø)
shared-utils 28.01% <ø> (ø)
skilavottord-ws 24.24% <ø> (ø)
web 1.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47df0c0...c007259. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 80ccdc3 🔗

34 Total Test Services: 0 Failed, 33 Passed
⬆️ Test Sessions change in coverage: 1 increased (+0.01%), 148 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 7.8s 1 no change Link
api 0 0 0 4 0 2.96s 1 no change Link
application-api-files 0 0 0 12 0 5.29s 1 no change Link
application-core 0 0 0 90 0 17.74s 1 no change Link
application-system-api 0 0 0 120 2 3m 14.71s 1 no change Link
application-template-api-modules 0 0 0 135 0 1m 53.26s 1 increased (+0.01%) Link
application-templates-accident-notification 0 0 0 148 0 18.33s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 12.52s 1 no change Link
application-templates-driving-license 0 0 0 13 0 16.12s 1 no change Link
application-templates-example-payment 0 0 0 2 0 11.17s 1 no change Link

Copy link
Contributor

github-actions bot commented Oct 4, 2024

Affected services are: air-discount-scheme-api,air-discount-scheme-backend,api,application-system-api,download-service,financial-aid-api,financial-aid-backend,financial-aid-open-api,github-actions-cache,icelandic-names-registry-backend,judicial-system-api,judicial-system-digital-mailbox-api,judicial-system-backend,judicial-system-message-handler,judicial-system-robot-api,judicial-system-scheduler,judicial-system-xrd-api,license-api,reference-backend,regulations-admin-backend,services-auth-admin-api,services-auth-ids-api,services-auth-delegation-api,services-auth-personal-representative,services-auth-personal-representative-public,services-auth-public-api,services-contentful-entry-tagger,services-documents,services-endorsements-api,services-form-system,services-search-indexer,services-sessions,services-university-gateway,services-user-notification,services-user-profile,services-xroad-collector,skilavottord-ws,air-discount-scheme-web,auth-admin-web,consultation-portal,contentful-apps,financial-aid-web-osk,financial-aid-web-veita,judicial-system-web,skilavottord-web,web,application-system-form,island-ui-storybook,portals-admin,service-portal,system-e2e,external-contracts-tests,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://choreformat-scripts-api-catalogue.dev01.devland.is/api
https://choreformat-scripts-api.dev01.devland.is/download
https://choreformat-scripts-application-callback-xrd.internal.dev01.devland.is/application-payment
https://choreformat-scripts-application-callback-xrd.internal.dev01.devland.is/applications
https://choreformat-scripts-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://choreformat-scripts-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://choreformat-scripts-beta.dev01.devland.is/
https://choreformat-scripts-beta.dev01.devland.is/api
https://choreformat-scripts-beta.dev01.devland.is/app/skilavottord/
https://choreformat-scripts-beta.dev01.devland.is/app/skilavottord/api/graphql
https://choreformat-scripts-beta.dev01.devland.is/minarsidur
https://choreformat-scripts-beta.dev01.devland.is/samradsgatt
https://choreformat-scripts-beta.dev01.devland.is/stjornbord
https://choreformat-scripts-beta.dev01.devland.is/umsoknir
https://choreformat-scripts-license-api-xrd.internal.dev01.devland.is/
https://choreformat-scripts-loftbru-cf.dev01.devland.is/
https://choreformat-scripts-loftbru-cf.dev01.devland.is/api/graphql
https://choreformat-scripts-loftbru-cf.dev01.devland.is/api/public
https://choreformat-scripts-loftbru-cf.dev01.devland.is/api/swagger
https://choreformat-scripts-loftbru.dev01.devland.is/
https://choreformat-scripts-loftbru.dev01.devland.is/api/graphql
https://choreformat-scripts-loftbru.dev01.devland.is/api/public
https://choreformat-scripts-loftbru.dev01.devland.is/api/swagger
https://choreformat-scripts-service-portal-api.internal.dev01.devland.is/
https://choreformat-scripts-services-university-gateway.internal.dev01.devland.is/api
https://choreformat-scripts-sessions-api.internal.dev01.devland.is/
https://choreformat-scripts-ui.dev01.devland.is/

Deployed services: application-system-api,application-system-form,service-portal,service-portal-api,portals-admin,consultation-portal,api,web,xroad-collector,skilavottord-web,skilavottord-ws,services-documents,island-ui-storybook,download-service,icelandic-names-registry-backend,endorsement-system-api,air-discount-scheme-web,air-discount-scheme-backend,air-discount-scheme-api,regulations-admin-backend,external-contracts-tests,application-system-api-worker,license-api,services-sessions,services-sessions-worker,services-sessions-cleanup,services-university-gateway,services-university-gateway-worker.
Excluded services: search-indexer-service,github-actions-cache,user-notification,user-notification-worker,user-notification-cleanup-worker,contentful-entry-tagger-service,contentful-apps

@kodiakhq kodiakhq bot merged commit 33fe31c into main Oct 4, 2024
395 checks passed
@kodiakhq kodiakhq bot deleted the chore/format-scripts branch October 4, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-feature Deploys features to dev deprecated:automerge (Disabled) Merge this PR as soon as all checks pass test everything 💀 test & build everything 💀
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants