XR006

ResourcesExtra · tfsproutx

check for Resource that implements Timeouts for missing Create, Delete, Read, or Update implementation

The XR006 analyzer reports extraneous Timeouts fields in resources where the corresponding Create/CreateContext, Delete/DeleteContext, Read/ReadContext, or Update/UpdateContext implementation does not exist.

Examples

&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Create: schema.DefaultTimeout(10 * time.Minute),
  },
}
// Fixed Timeouts field alignment
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Read: schema.DefaultTimeout(10 * time.Minute),
  },
}

// Removed Timeouts
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
}

Ignoring reports

Singular reports can be ignored by adding a //lintignore:XR006 Go code comment at the end of the offending line or on the line immediately preceding, e.g.

//lintignore:XR006
&schema.Resource{
  /* ... no Create ... */
  Read: /* ... */,
  Timeouts: schema.ResourceTimesout{
    Create: schema.DefaultTimeout(10 * time.Minute),
  },
}

This page is generated from xpasses/XR006/README.md, which lives beside the analyzer.