Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Check: Preferred Naming of Parameters for CreateFunc, DeleteFunc, ReadFunc, and UpdateFunc #12

Closed
bflad opened this issue May 31, 2019 · 0 comments · Fixed by #102
Closed
Labels
ast AST Handling check/resource Resource Check new-check New Lint Check

Comments

@bflad
Copy link
Owner

bflad commented May 31, 2019

This check seems like it should be doable in AST using the function signature of func XXX(*schema.ResourceData, interface{}) error, however it may require SSA.

In resource CreateFunc, DeleteFunc, UpdateFunc, and UpdateFunc, it is preferable to name the first parameter of *schema.ResourceData to d and the second parameter of interface{} to meta.

Valid:

func XXX(d *schema.ResourceData, meta interface{}) error {
  // ...
}

Invalid:

func XXX(invalid *schema.ResourceData, meta interface{}) error {
  // ...
}

func XXX(d *schema.ResourceData, invalid interface{}) error {
  // ...
}
@bflad bflad added ast AST Handling new-check New Lint Check check/resource Resource Check labels May 31, 2019
bflad added a commit that referenced this issue Feb 18, 2020
…teFunc parameter naming

Reference: #12
Reference: #41

Includes small breaking change to `NewSchemaValidationFuncInfo` parameters to simplify usage.
bflad added a commit that referenced this issue Feb 18, 2020
…teFunc parameter naming (#102)

Reference: #12
Reference: #41

Includes small breaking change to `NewSchemaValidationFuncInfo` parameters to simplify usage.
Mikechoi78 added a commit to Mikechoi78/tfproviderlint that referenced this issue May 23, 2022
…teFunc parameter naming (#102)

Reference: bflad/tfproviderlint#12
Reference: bflad/tfproviderlint#41

Includes small breaking change to `NewSchemaValidationFuncInfo` parameters to simplify usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast AST Handling check/resource Resource Check new-check New Lint Check
Projects
None yet
1 participant