Skip to content

fix: nic code consistency - #930

Open
cristiGuranIonos wants to merge 1 commit into
masterfrom
fix/nic_code_consistency
Open

fix: nic code consistency#930
cristiGuranIonos wants to merge 1 commit into
masterfrom
fix/nic_code_consistency

Conversation

@cristiGuranIonos

Copy link
Copy Markdown
Member

What does this fix or implement?

Checklist

  • PR name added as appropriate (e.g. feat:/fix:/doc:/test:/refactor:)
  • Tests added or updated
  • Documentation updated
  • Changelog updated and version incremented (label: upcoming release)
  • Github Issue linked if any
  • Jira task updated

Copilot AI review requested due to automatic review settings February 19, 2026 11:41
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves code consistency in the NIC resource by standardizing variable naming conventions, simplifying error handling, fixing a bug in error messages, and refactoring conditional logic for better readability.

Changes:

  • Standardized variable naming from dcid, srvid, nicid to dcID, srvID, nicID throughout the file
  • Simplified error handling by using inline return diag.FromErr() instead of intermediate variable assignment
  • Fixed bug in error message at line 228 that referenced wrong variable (*nic.Id*createdNic.Id)
  • Refactored flowlog change detection logic in ForceNewForFlowlogChanges for better clarity
  • Improved error messages (e.g., "lan does not exist" → "nic does not exist" in resourceNicImport)

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

}
diags := diag.FromErr(fmt.Errorf("error occurred while fetching a nic ID %s %w", d.Id(), err))
return diags
return diag.FromErr(fmt.Errorf("error occurred while fetching a nic ID %s %w", nicID, err))

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The error message format is inconsistent with common patterns in the codebase. Consider adding a colon before the error wrapper for better readability: "error occurred while fetching a nic ID %s: %w"

Suggested change
return diag.FromErr(fmt.Errorf("error occurred while fetching a nic ID %s %w", nicID, err))
return diag.FromErr(fmt.Errorf("error occurred while fetching a nic ID %s: %w", nicID, err))

Copilot uses AI. Check for mistakes.
if err != nil {
diags := diag.FromErr(fmt.Errorf("an error occurred while deleting a nic dcId %s ID %s %s", d.Get("datacenter_id").(string), d.Id(), err))
return diags
return diag.FromErr(fmt.Errorf("an error occurred while deleting a nic dcID %s ID %s %w", dcID, nicID, err))

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The error message format is inconsistent with common patterns in the codebase. Consider adding a colon before the error wrapper for better readability: "an error occurred while deleting a nic dcID %s ID %s: %w"

Suggested change
return diag.FromErr(fmt.Errorf("an error occurred while deleting a nic dcID %s ID %s %w", dcID, nicID, err))
return diag.FromErr(fmt.Errorf("an error occurred while deleting a nic dcID %s ID %s: %w", dcID, nicID, err))

Copilot uses AI. Check for mistakes.
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.

2 participants