revive icon indicating copy to clipboard operation
revive copied to clipboard

GitHub Copilot code review instructions

Open ccoVeille opened this issue 5 months ago • 2 comments

We merged #1437, it was a first step as stated in the PR.

  • #1437

Now, we need to include instruction that are

This morning I was looking at an open PR

  • https://github.com/mgechev/revive/pull/1429

And I think it's a good opportunity to look at this PR and try to list them

  • a new rule must have an identifier
  • this identifier must be short and meaningful
  • its identifier must comply kebab case
  • this identifier must be different than the one used by other revive rules
  • the rule must be a .go file in rule/ folder
  • the name of this file should be a snake case version of the identifier
  • the file should contain a struct based on the rule identifier name
  • the name of the struct should be a camelCase version of the identifier
  • the struct must implement lint.Rule interface ( Apply, Name being present )
  • Name must return the name of the identifier
  • the struct may implement a Configure
  • if the rule added a Configure, the rule must use validate the rule comply the expected interface with something equivalent to var _ lint.Configurable = newRule{} where newRule is the name of the struct created for the rule
  • the rule must be added to allRules variable in config/config.go
  • the rule must be listed in README.md file
  • the rule must be listed and documented in RULES-DESCRIPTION.md

This is a draft of what we could write.

Now, I see how long it was for me to write I might have asked Copilot to write it for me, but it can still be used as a base in a prompt when asking to improve it.

ccoVeille avatar Jul 26 '25 07:07 ccoVeille

Good to add:

  • new rule in README.md and RULES_DESCRIPTION.md must be in lexicographical order by rule name.
  • new rule must have correct confidence based on its implementation.

vbvictor avatar Jul 26 '25 12:07 vbvictor

Note, instructions won't work for reviews until we fix the name of the file. cc @alexandear

denisgcm avatar Jul 26 '25 18:07 denisgcm