Back to all reviewers

Swift style consistency

tensorflow/swift
Based on 2 comments
Markdown

Maintain consistent Swift style conventions throughout all code, including examples in documentation and comments. Follow these specific guidelines: 1. Use 4-space indentation for all Swift code

Code Style Markdown

Reviewer Prompt

Maintain consistent Swift style conventions throughout all code, including examples in documentation and comments. Follow these specific guidelines:

  1. Use 4-space indentation for all Swift code
  2. Do not use spaces before colons in type declarations

For example:

// Correct
struct Model: Differentiable {
    var parameter: Float
    
    var allDifferentiableVariables: AllDifferentiableVariables {
        get { return AllDifferentiableVariables(parameter: parameter) }
        set { parameter = newValue.parameter }
    }
}

// Incorrect
struct Model : Differentiable { // space before colon
  var parameter: Float  // 2-space indentation
  
  var allDifferentiableVariables: AllDifferentiableVariables {
      get { return AllDifferentiableVariables(parameter: parameter) }
      set { parameter = newValue.parameter }
  }
}

When showing code patterns that may be truncated (like in documentation examples), use โ€œโ€ฆโ€ to maintain symmetry and clarity of the pattern structure.

// Complete pattern with "..." for consistency
var allDifferentiableVariables: AllDifferentiableVariables {
    get { return AllDifferentiableVariables(x: x, y: y, ...) }
    set { x = newValue.x; y = newValue.y; ... }
}
2
Comments Analyzed
Markdown
Primary Language
Code Style
Category

Source Discussions