Skip to content

Comments

Scope error variables into if statements where possible#1486

Merged
rowanseymour merged 1 commit intomainfrom
claude/stupefied-buck
Feb 13, 2026
Merged

Scope error variables into if statements where possible#1486
rowanseymour merged 1 commit intomainfrom
claude/stupefied-buck

Conversation

@rowanseymour
Copy link
Member

No description provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 13, 2026 19:42
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.56%. Comparing base (64d0cdb) to head (048f707).

Files with missing lines Patch % Lines
flows/definition/legacy/definition.go 0.00% 0 Missing and 4 partials ⚠️
cmd/docgen/docs/base.go 0.00% 0 Missing and 1 partial ⚠️
contactql/parser.go 50.00% 0 Missing and 1 partial ⚠️
flows/inputs/msg.go 0.00% 0 Missing and 1 partial ⚠️
utils/validator.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1486      +/-   ##
==========================================
- Coverage   69.57%   69.56%   -0.02%     
==========================================
  Files         306      306              
  Lines       18069    18059      -10     
==========================================
- Hits        12572    12562      -10     
  Misses       5063     5063              
  Partials      434      434              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors error handling throughout the codebase to use scoped error variables within if statements, following a well-established Go idiom. The changes convert the pattern err := func(); if err != nil to if err := func(); err != nil, which scopes the error variable more tightly to where it's actually used.

Changes:

  • Refactored error variable declarations to be scoped within if statements across 6 files
  • Applied the pattern consistently to various function calls including JSON unmarshaling, validation, and callback operations
  • No behavioral changes, only improved variable scoping

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
utils/validator.go Scoped error variable in UnmarshalAndValidate function
flows/inputs/msg.go Scoped error variable in readMsg function
flows/definition/legacy/definition.go Scoped error variables in migrateAction and migrateRuleSet functions (4 instances)
excellent/base.go Scoped error variable in VisitTemplate function
contactql/parser.go Scoped error variables in BoolCombination.validate and ParseQuery functions (2 instances)
cmd/docgen/docs/base.go Scoped error variable in Generate function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rowanseymour rowanseymour merged commit 7118e30 into main Feb 13, 2026
11 of 13 checks passed
@rowanseymour rowanseymour deleted the claude/stupefied-buck branch February 13, 2026 19:47
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant