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

Fixed Makefile to always include TOML files. #229

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

EmbeddedDevops1
Copy link
Collaborator

@EmbeddedDevops1 EmbeddedDevops1 commented Nov 19, 2024

PR Type

enhancement


Description

  • Enhanced the Makefile to dynamically include all TOML files from the cover_agent/settings directory.
  • Replaced hardcoded TOML file paths with a variable to improve maintainability and flexibility.

Changes walkthrough 📝

Relevant files
Enhancement
Makefile
Dynamically include all TOML files in Makefile                     

Makefile

  • Added a variable TOML_FILES to dynamically find and include all TOML
    files.
  • Replaced hardcoded TOML file paths with the TOML_FILES variable in the
    installer target.
  • +2/-7     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Path Validation
    The find command should verify that the cover_agent/settings directory exists to avoid silent failures if the directory is missing

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add validation to ensure required TOML configuration files are present before building the installer

    Add error handling to check if the find command returns any TOML files. If none are
    found, the build should fail with a clear error message since TOML files are
    required for the application to work.

    Makefile [3]

    -TOML_FILES=$(shell find cover_agent/settings -name "*.toml" | sed 's/.*/-\-add-data "&:."/' | tr '\n' ' ')
    +TOML_FILES=$(shell find cover_agent/settings -name "*.toml")
    +ifeq ($(strip $(TOML_FILES)),)
    +    $(error No TOML files found in cover_agent/settings)
    +endif
    +TOML_FILES_ARGS=$(TOML_FILES:=:.) | sed 's/.*/-\-add-data "&"/' | tr '\n' ' ')
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: This is a critical validation that prevents silent failures. Without TOML files, the application would fail at runtime, so catching this during build time is important for reliability.

    8
    General
    Improve shell command robustness by properly escaping special characters in file paths

    The sed command uses double quotes which could break if file paths contain special
    characters. Use single quotes to ensure paths with spaces or special characters are
    handled correctly.

    Makefile [3]

    -TOML_FILES=$(shell find cover_agent/settings -name "*.toml" | sed 's/.*/-\-add-data "&:."/' | tr '\n' ' ')
    +TOML_FILES=$(shell find cover_agent/settings -name "*.toml" | sed 's/.*/-\-add-data '\''&:.'\'/' | tr '\n' ' ')
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion addresses a potential issue with file paths containing special characters, which could cause build failures. While valid, the current code already uses single quotes for the sed command.

    6

    💡 Need additional feedback ? start a PR chat

    @EmbeddedDevops1 EmbeddedDevops1 merged commit 35e0c50 into main Nov 19, 2024
    7 checks passed
    @EmbeddedDevops1 EmbeddedDevops1 deleted the hotfix/add-settings-file branch November 19, 2024 18:20
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant