Skip to content

refactor: prefer enum class for save status as enum is not for flags - #3744

Open
rodolforg wants to merge 1 commit into
synfig:masterfrom
rodolforg:enum-class-in-instance
Open

rodolforg wants to merge 1 commit into
synfig:masterfrom
rodolforg:enum-class-in-instance

Conversation

@rodolforg

Copy link
Copy Markdown
Contributor

No description provided.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Status enumeration to a scoped enum class within the studio::Instance class and updates its usage across instance.cpp. A critical issue was identified in safe_close() where the enum keyword remains in a variable declaration; this is invalid syntax for an enum class and will result in a compilation error.

enum Status status = save();
if (status == STATUS_OK) break;
else if (status == STATUS_CANCEL) return false;
if (status == Status::STATUS_OK)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The declaration of status on line 945 (context) still uses the enum keyword (e.g., enum Status status = save();). Since Status has been refactored to an enum class, this syntax is no longer valid in C++ and will cause a compilation error. The enum keyword must be removed from the variable declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant