Browse Source

Standardise some naming (#2063)

Motivation:

In v2 we've predominantly used 'max' instead of 'maximum' and 'config'
instead of 'configuration'. We should apply these consistently.

Modifications:

- Replaces occurrences of 'maximum' with 'max', and 'configuration' with
'config'.

Result:

More consistent naming
George Barnett 1 year ago
parent
commit
2ccb946585

+ 2 - 2
Sources/GRPCProtobufCodeGen/ProtobufCodeGenParser.swift

@@ -27,13 +27,13 @@ internal struct ProtobufCodeGenParser {
   let namer: SwiftProtobufNamer
   let extraModuleImports: [String]
   let protoToModuleMappings: ProtoFileToModuleMappings
-  let accessLevel: SourceGenerator.Configuration.AccessLevel
+  let accessLevel: SourceGenerator.Config.AccessLevel
 
   internal init(
     input: FileDescriptor,
     protoFileModuleMappings: ProtoFileToModuleMappings,
     extraModuleImports: [String],
-    accessLevel: SourceGenerator.Configuration.AccessLevel
+    accessLevel: SourceGenerator.Config.AccessLevel
   ) {
     self.input = input
     self.extraModuleImports = extraModuleImports

+ 3 - 3
Sources/GRPCProtobufCodeGen/ProtobufCodeGenerator.swift

@@ -18,10 +18,10 @@ public import GRPCCodeGen
 public import SwiftProtobufPluginLibrary
 
 public struct ProtobufCodeGenerator {
-  internal var configuration: SourceGenerator.Configuration
+  internal var configuration: SourceGenerator.Config
 
   public init(
-    configuration: SourceGenerator.Configuration
+    configuration: SourceGenerator.Config
   ) {
     self.configuration = configuration
   }
@@ -37,7 +37,7 @@ public struct ProtobufCodeGenerator {
       extraModuleImports: extraModuleImports,
       accessLevel: self.configuration.accessLevel
     )
-    let sourceGenerator = SourceGenerator(configuration: self.configuration)
+    let sourceGenerator = SourceGenerator(config: self.configuration)
 
     let codeGenerationRequest = try parser.parse()
     let sourceFile = try sourceGenerator.generate(codeGenerationRequest)

+ 3 - 3
Sources/protoc-gen-grpc-swift/GenerateGRPC.swift

@@ -123,7 +123,7 @@ final class GenerateGRPC: CodeGenerator {
       fileNamingOption: options.fileNaming
     )
 
-    let config = SourceGenerator.Configuration(options: options)
+    let config = SourceGenerator.Config(options: options)
     let fileGenerator = ProtobufCodeGenerator(configuration: config)
     let contents = try fileGenerator.generateCode(
       from: descriptor,
@@ -212,9 +212,9 @@ private func splitPath(pathname: String) -> (dir: String, base: String, suffix:
 }
 
 #if compiler(>=6.0)
-extension SourceGenerator.Configuration {
+extension SourceGenerator.Config {
   init(options: GeneratorOptions) {
-    let accessLevel: SourceGenerator.Configuration.AccessLevel
+    let accessLevel: SourceGenerator.Config.AccessLevel
     switch options.visibility {
     case .internal:
       accessLevel = .internal

+ 2 - 2
Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift

@@ -532,7 +532,7 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
   func testCodeGeneration(
     proto: Google_Protobuf_FileDescriptorProto,
     indentation: Int,
-    visibility: SourceGenerator.Configuration.AccessLevel,
+    visibility: SourceGenerator.Config.AccessLevel,
     client: Bool,
     server: Bool,
     accessLevelOnImports: Bool = true,
@@ -540,7 +540,7 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
     file: StaticString = #filePath,
     line: UInt = #line
   ) throws {
-    let config = SourceGenerator.Configuration(
+    let config = SourceGenerator.Config(
       accessLevel: visibility,
       accessLevelOnImports: accessLevelOnImports,
       client: client,