Skip to content

Rename run function to main_run #706

@meleu

Description

@meleu

Description

I'd like to suggest renaming the default run function to something like main_run.

Reasoning: prevent name collision with BATS run function.

I already have a solution for this: I always put this in my bashly-settings.yml:

function_names:
  # NOTE: this is needed to prevent name collisions with BATS-core
  run: main_run

It's not a big thing for me, who already realized how to solve it. But it's another thing that adds more friction to let people (or AI agents) start testing right away.


UPDATE

Turns out that sourcing the whole final script is a bad practice and should be avoided. Therefore the motivation to open this thread is not valid anymore.

Since we're using Bashly, a better practice is to source only the file containing the function under test (or even all files under src/lib/ if the test requires dependencies from multiple files). Although I didn't incorporate this practice in my existing programs, I should start doing so (and encourage my colleagues accordingly).

That being said, my opinion is that keeping the entrypoint function named as run(), therefore doing nothing, is the best approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions