Setting up stylecop to ignore generated files and fixing style

pull/1029/head
Jan Tattermusch 10 years ago
parent e7268b8f84
commit 3de9f49e3c
  1. 57
      src/csharp/Grpc.Examples/MathGrpc.cs
  2. 10
      src/csharp/Grpc.Examples/Settings.StyleCop
  3. 11
      src/csharp/Grpc.IntegrationTesting/Settings.StyleCop
  4. 95
      src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs
  5. 3
      src/csharp/Settings.StyleCop

@ -45,35 +45,34 @@ namespace math
/// </summary> /// </summary>
public class MathGrpc public class MathGrpc
{ {
readonly static Marshaller<DivArgs> divArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivArgs.ParseFrom); static readonly Marshaller<DivArgs> DivArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivArgs.ParseFrom);
readonly static Marshaller<DivReply> divReplyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivReply.ParseFrom); static readonly Marshaller<DivReply> DivReplyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivReply.ParseFrom);
readonly static Marshaller<Num> numMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Num.ParseFrom); static readonly Marshaller<Num> NumMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Num.ParseFrom);
readonly static Marshaller<FibArgs> fibArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), FibArgs.ParseFrom); static readonly Marshaller<FibArgs> FibArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), FibArgs.ParseFrom);
readonly static Method<DivArgs, DivReply> divMethod = new Method<DivArgs, DivReply>( static readonly Method<DivArgs, DivReply> DivMethod = new Method<DivArgs, DivReply>(
MethodType.Unary, MethodType.Unary,
"/math.Math/Div", "/math.Math/Div",
divArgsMarshaller, DivArgsMarshaller,
divReplyMarshaller DivReplyMarshaller);
);
readonly static Method<FibArgs, Num> fibMethod = new Method<FibArgs, Num>( static readonly Method<FibArgs, Num> FibMethod = new Method<FibArgs, Num>(
MethodType.ServerStreaming, MethodType.ServerStreaming,
"/math.Math/Fib", "/math.Math/Fib",
fibArgsMarshaller, FibArgsMarshaller,
numMarshaller NumMarshaller);
);
readonly static Method<Num, Num> sumMethod = new Method<Num, Num>( static readonly Method<Num, Num> SumMethod = new Method<Num, Num>(
MethodType.ClientStreaming, MethodType.ClientStreaming,
"/math.Math/Sum", "/math.Math/Sum",
numMarshaller, NumMarshaller,
numMarshaller NumMarshaller);
);
readonly static Method<DivArgs, DivReply> divManyMethod = new Method<DivArgs, DivReply>( static readonly Method<DivArgs, DivReply> DivManyMethod = new Method<DivArgs, DivReply>(
MethodType.DuplexStreaming, MethodType.DuplexStreaming,
"/math.Math/DivMany", "/math.Math/DivMany",
divArgsMarshaller, DivArgsMarshaller,
divReplyMarshaller DivReplyMarshaller);
);
public interface IMathServiceClient public interface IMathServiceClient
{ {
@ -99,31 +98,31 @@ namespace math
public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken)) public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(DivMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)) public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(DivMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken)) public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<FibArgs, Num>(fibMethod, channel); var call = new Grpc.Core.Call<FibArgs, Num>(FibMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token); Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
} }
public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken)) public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<Num, Num>(sumMethod, channel); var call = new Grpc.Core.Call<Num, Num>(SumMethod, channel);
return Calls.AsyncClientStreamingCall(call, token); return Calls.AsyncClientStreamingCall(call, token);
} }
public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<DivArgs, DivReply>(divManyMethod, channel); var call = new Grpc.Core.Call<DivArgs, DivReply>(DivManyMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
} }
@ -143,10 +142,10 @@ namespace math
public static ServerServiceDefinition BindService(IMathService serviceImpl) public static ServerServiceDefinition BindService(IMathService serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder("/math.Math/") return ServerServiceDefinition.CreateBuilder("/math.Math/")
.AddMethod(divMethod, serviceImpl.Div) .AddMethod(DivMethod, serviceImpl.Div)
.AddMethod(fibMethod, serviceImpl.Fib) .AddMethod(FibMethod, serviceImpl.Fib)
.AddMethod(sumMethod, serviceImpl.Sum) .AddMethod(SumMethod, serviceImpl.Sum)
.AddMethod(divManyMethod, serviceImpl.DivMany).Build(); .AddMethod(DivManyMethod, serviceImpl.DivMany).Build();
} }
public static IMathServiceClient NewStub(Channel channel) public static IMathServiceClient NewStub(Channel channel)

@ -0,0 +1,10 @@
<StyleCopSettings Version="105">
<SourceFileList>
<SourceFile>Math.cs</SourceFile>
<Settings>
<GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings>
</Settings>
</SourceFileList>
</StyleCopSettings>

@ -0,0 +1,11 @@
<StyleCopSettings Version="105">
<SourceFileList>
<SourceFile>Messages.cs</SourceFile>
<SourceFile>Empty.cs</SourceFile>
<Settings>
<GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings>
</Settings>
</SourceFileList>
</StyleCopSettings>

@ -44,50 +44,49 @@ namespace grpc.testing
/// </summary> /// </summary>
public class TestServiceGrpc public class TestServiceGrpc
{ {
readonly static Marshaller<Empty> emptyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Empty.ParseFrom); static readonly Marshaller<Empty> EmptyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Empty.ParseFrom);
readonly static Marshaller<SimpleRequest> simpleRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleRequest.ParseFrom); static readonly Marshaller<SimpleRequest> SimpleRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleRequest.ParseFrom);
readonly static Marshaller<SimpleResponse> simpleResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleResponse.ParseFrom); static readonly Marshaller<SimpleResponse> SimpleResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleResponse.ParseFrom);
readonly static Marshaller<StreamingOutputCallRequest> streamingOutputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallRequest.ParseFrom); static readonly Marshaller<StreamingOutputCallRequest> StreamingOutputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallRequest.ParseFrom);
readonly static Marshaller<StreamingOutputCallResponse> streamingOutputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallResponse.ParseFrom); static readonly Marshaller<StreamingOutputCallResponse> StreamingOutputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallResponse.ParseFrom);
readonly static Marshaller<StreamingInputCallRequest> streamingInputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallRequest.ParseFrom); static readonly Marshaller<StreamingInputCallRequest> StreamingInputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallRequest.ParseFrom);
readonly static Marshaller<StreamingInputCallResponse> streamingInputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallResponse.ParseFrom); static readonly Marshaller<StreamingInputCallResponse> StreamingInputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallResponse.ParseFrom);
readonly static Method<Empty, Empty> emptyCallMethod = new Method<Empty, Empty>( static readonly Method<Empty, Empty> EmptyCallMethod = new Method<Empty, Empty>(
MethodType.Unary, MethodType.Unary,
"/grpc.testing.TestService/EmptyCall", "/grpc.testing.TestService/EmptyCall",
emptyMarshaller, EmptyMarshaller,
emptyMarshaller EmptyMarshaller);
);
readonly static Method<SimpleRequest, SimpleResponse> unaryCallMethod = new Method<SimpleRequest, SimpleResponse>( static readonly Method<SimpleRequest, SimpleResponse> UnaryCallMethod = new Method<SimpleRequest, SimpleResponse>(
MethodType.Unary, MethodType.Unary,
"/grpc.testing.TestService/UnaryCall", "/grpc.testing.TestService/UnaryCall",
simpleRequestMarshaller, SimpleRequestMarshaller,
simpleResponseMarshaller SimpleResponseMarshaller);
);
readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> streamingOutputCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> StreamingOutputCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.ServerStreaming, MethodType.ServerStreaming,
"/grpc.testing.TestService/StreamingOutputCall", "/grpc.testing.TestService/StreamingOutputCall",
streamingOutputCallRequestMarshaller, StreamingOutputCallRequestMarshaller,
streamingOutputCallResponseMarshaller StreamingOutputCallResponseMarshaller);
);
readonly static Method<StreamingInputCallRequest, StreamingInputCallResponse> streamingInputCallMethod = new Method<StreamingInputCallRequest, StreamingInputCallResponse>( static readonly Method<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCallMethod = new Method<StreamingInputCallRequest, StreamingInputCallResponse>(
MethodType.ClientStreaming, MethodType.ClientStreaming,
"/grpc.testing.TestService/StreamingInputCall", "/grpc.testing.TestService/StreamingInputCall",
streamingInputCallRequestMarshaller, StreamingInputCallRequestMarshaller,
streamingInputCallResponseMarshaller StreamingInputCallResponseMarshaller);
);
readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> fullDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> FullDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.DuplexStreaming, MethodType.DuplexStreaming,
"/grpc.testing.TestService/FullDuplexCall", "/grpc.testing.TestService/FullDuplexCall",
streamingOutputCallRequestMarshaller, StreamingOutputCallRequestMarshaller,
streamingOutputCallResponseMarshaller StreamingOutputCallResponseMarshaller);
);
readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> halfDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>( static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> HalfDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.DuplexStreaming, MethodType.DuplexStreaming,
"/grpc.testing.TestService/HalfDuplexCall", "/grpc.testing.TestService/HalfDuplexCall",
streamingOutputCallRequestMarshaller, StreamingOutputCallRequestMarshaller,
streamingOutputCallResponseMarshaller StreamingOutputCallResponseMarshaller);
);
public interface ITestServiceClient public interface ITestServiceClient
{ {
@ -119,49 +118,49 @@ namespace grpc.testing
public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken)) public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel); var call = new Grpc.Core.Call<Empty, Empty>(EmptyCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken)) public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel); var call = new Grpc.Core.Call<Empty, Empty>(EmptyCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken)) public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(UnaryCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token); return Calls.BlockingUnaryCall(call, request, token);
} }
public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)) public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel); var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(UnaryCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token); return Calls.AsyncUnaryCall(call, request, token);
} }
public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) { public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(streamingOutputCallMethod, channel); {
var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(StreamingOutputCallMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token); Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
} }
public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken)) public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(streamingInputCallMethod, channel); var call = new Grpc.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(StreamingInputCallMethod, channel);
return Calls.AsyncClientStreamingCall(call, token); return Calls.AsyncClientStreamingCall(call, token);
} }
public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(fullDuplexCallMethod, channel); var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(FullDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{ {
var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(halfDuplexCallMethod, channel); var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(HalfDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token); return Calls.DuplexStreamingCall(call, responseObserver, token);
} }
} }
@ -185,12 +184,12 @@ namespace grpc.testing
public static ServerServiceDefinition BindService(ITestService serviceImpl) public static ServerServiceDefinition BindService(ITestService serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder("/grpc.testing.TestService/") return ServerServiceDefinition.CreateBuilder("/grpc.testing.TestService/")
.AddMethod(emptyCallMethod, serviceImpl.EmptyCall) .AddMethod(EmptyCallMethod, serviceImpl.EmptyCall)
.AddMethod(unaryCallMethod, serviceImpl.UnaryCall) .AddMethod(UnaryCallMethod, serviceImpl.UnaryCall)
.AddMethod(streamingOutputCallMethod, serviceImpl.StreamingOutputCall) .AddMethod(StreamingOutputCallMethod, serviceImpl.StreamingOutputCall)
.AddMethod(streamingInputCallMethod, serviceImpl.StreamingInputCall) .AddMethod(StreamingInputCallMethod, serviceImpl.StreamingInputCall)
.AddMethod(fullDuplexCallMethod, serviceImpl.FullDuplexCall) .AddMethod(FullDuplexCallMethod, serviceImpl.FullDuplexCall)
.AddMethod(halfDuplexCallMethod, serviceImpl.HalfDuplexCall) .AddMethod(HalfDuplexCallMethod, serviceImpl.HalfDuplexCall)
.Build(); .Build();
} }

@ -1,7 +1,4 @@
<StyleCopSettings Version="105"> <StyleCopSettings Version="105">
<GlobalSettings>
<StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
</GlobalSettings>
<Analyzers> <Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules> <Rules>

Loading…
Cancel
Save