Back to all reviewers

Consistent semantic naming

grafana/grafana
Based on 4 comments
TypeScript

Use consistent, specific, and semantically appropriate naming conventions throughout the codebase. When creating new identifiers: 1. Check for existing patterns for similar concepts (e.g., use 'ascending/descending' for sort options to match existing UI components)

Naming Conventions TypeScript

Reviewer Prompt

Use consistent, specific, and semantically appropriate naming conventions throughout the codebase. When creating new identifiers:

  1. Check for existing patterns for similar concepts (e.g., use ‘ascending/descending’ for sort options to match existing UI components)
  2. Choose specific descriptive names over general ones (e.g., ‘exportDashboardImage’ instead of ‘dashboardImageSharing’)
  3. Use semantically appropriate formats (e.g., past tense verbs like ‘image_downloaded’ for analytics events)
  4. Apply consistent patterns across similar entities (e.g., if dashboards use a certain branch naming pattern like folder/${generateTimestamp()})

For example:

// Instead of this:
builder.addRadio({
  path: 'reduceOptions.sort',
  settings: {
    options: [
      { value: SortWithReducer.None, label: 'None' },
      { value: SortWithReducer.Asc, label: 'A-Z' },
      { value: SortWithReducer.Desc, label: 'Z-A' },
    ]
  },
});

// Do this (for consistency with tooltip sorting):
builder.addRadio({
  path: 'reduceOptions.sort',
  settings: {
    options: [
      { value: SortWithReducer.None, label: 'None' },
      { value: SortWithReducer.Asc, label: 'Ascending' },
      { value: SortWithReducer.Desc, label: 'Descending' },
    ]
  },
});

This approach improves code readability, maintainability, and reduces cognitive load for developers navigating the codebase.

4
Comments Analyzed
TypeScript
Primary Language
Naming Conventions
Category

Source Discussions