Skip to content

--frozen option returns a zero error code when database is inaccessible #240

@wwahammy

Description

@wwahammy

First off, thanks so much for the work on this gem; it's really a lifesaver. (And thanks to the people who worked on Annotate originally!)

I just started using the annotaterb --frozen in my CI to make sure the annotations are up to date. When I did so, I stumbled on an unexpected behavior. If you run annotaterb --frozen and the database is not accessible, the command will return with a zero error code, i.e. successful. It's clear though that the database is definitely inaccessible, the terminal messages that the db is inaccessible will still be written to the terminal output even though the command exits with 0.

I noticed this bug when I, without thinking, simply added this to a linting job in my Github workflow; after all, it's effectively doing linting. My linting job though doesn't run the normal Rails bin/setup command; I hadn't needed this previously so I hadn't even thought of adding that. I'd assume other people might make this mistake too.

I'd propose that, when running annotaterb --frozen, the inability to access to the database should be treated as an error condition and cause the command to return a non-zero error code.

If the annotaterb team think this proposed behavior is appropriate, I'm happy to take a swing at implementing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions