Skip to content

Remove Get/Set in getter/setter function names #180

@gabor-boros

Description

@gabor-boros

Summary

Some method names in the codebase don’t follow a consistent naming convention. In many cases, we use names like GetUser(), when a simpler and clearer User() would be more appropriate.

To improve readability and maintainability, methods that return a resource should drop the Get or Set prefix unless it adds necessary clarity. Instead, use the format Resource().

This does not apply to:

  • API or repository-related methods
  • Methods named exactly Get()
  • Methods like GetBy<Resource>(), GetAllBy<Resource>(), or similar

Valid renames:

  • GetDefault()Default()
  • GetValidator()Validator()
  • GetTaskInfo()TaskInfo()
  • GetWriteSession() -> WriteSession()
  • SetWriteSession() -> `
  • ...

Do not rename the following patterns (commonly found in the repository directory):

These methods are "API or repository-related methods"

  • GetByCreator()
  • GetByResource()
  • GetByUser()
  • GetAllForIssue()
  • ...

Review the codebase for methods that can be simplified according to this convention, and update them where appropriate.

Example Use-cases

As someone who maintains the code, I want to have a pleasant feeling looking at it.

Drawbacks

NA

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions