octomation/go-service

View on GitHub

Showing 64 of 64 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

func (x *HelloResponse) ProtoReflect() protoreflect.Message {
    mi := &file_v1_service_proto_msgTypes[1]
    if protoimpl.UnsafeEnabled && x != nil {
        ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
        if ms.LoadMessageInfo() == nil {
Severity: Major
Found in api/rpc/v1/service.pb.go and 3 other locations - About 55 mins to fix
api/rpc/v1/service.pb.go on lines 48..58
api/rpc/v1/service.pb.go on lines 140..150
api/rpc/v1/service.pb.go on lines 180..190

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

func (x *SignRequest) ProtoReflect() protoreflect.Message {
    mi := &file_v1_service_proto_msgTypes[2]
    if protoimpl.UnsafeEnabled && x != nil {
        ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
        if ms.LoadMessageInfo() == nil {
Severity: Major
Found in api/rpc/v1/service.pb.go and 3 other locations - About 55 mins to fix
api/rpc/v1/service.pb.go on lines 48..58
api/rpc/v1/service.pb.go on lines 95..105
api/rpc/v1/service.pb.go on lines 180..190

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

func (x *SignResponse) ProtoReflect() protoreflect.Message {
    mi := &file_v1_service_proto_msgTypes[3]
    if protoimpl.UnsafeEnabled && x != nil {
        ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
        if ms.LoadMessageInfo() == nil {
Severity: Major
Found in api/rpc/v1/service.pb.go and 3 other locations - About 55 mins to fix
api/rpc/v1/service.pb.go on lines 48..58
api/rpc/v1/service.pb.go on lines 95..105
api/rpc/v1/service.pb.go on lines 140..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method greeterServiceServer.ServeHTTP has 7 return statements (exceeds 4 allowed).
Open

func (s *greeterServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
    ctx := req.Context()
    ctx = ctxsetters.WithPackageName(ctx, "api.rpc.v1")
    ctx = ctxsetters.WithServiceName(ctx, "GreeterService")
    ctx = ctxsetters.WithResponseWriter(ctx, resp)
Severity: Major
Found in api/rpc/v1/service.twirp.go - About 45 mins to fix

    Method greeterServiceJSONClient.Sign has 6 return statements (exceeds 4 allowed).
    Open

    func (c *greeterServiceJSONClient) Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) {
        ctx = ctxsetters.WithPackageName(ctx, "api.rpc.v1")
        ctx = ctxsetters.WithServiceName(ctx, "GreeterService")
        ctx = ctxsetters.WithMethodName(ctx, "Sign")
        caller := c.callSign
    Severity: Major
    Found in api/rpc/v1/service.twirp.go - About 40 mins to fix

      Method greeterServiceProtobufClient.Hello has 6 return statements (exceeds 4 allowed).
      Open

      func (c *greeterServiceProtobufClient) Hello(ctx context.Context, in *HelloRequest) (*HelloResponse, error) {
          ctx = ctxsetters.WithPackageName(ctx, "api.rpc.v1")
          ctx = ctxsetters.WithServiceName(ctx, "GreeterService")
          ctx = ctxsetters.WithMethodName(ctx, "Hello")
          caller := c.callHello
      Severity: Major
      Found in api/rpc/v1/service.twirp.go - About 40 mins to fix

        Method greeterServiceJSONClient.Hello has 6 return statements (exceeds 4 allowed).
        Open

        func (c *greeterServiceJSONClient) Hello(ctx context.Context, in *HelloRequest) (*HelloResponse, error) {
            ctx = ctxsetters.WithPackageName(ctx, "api.rpc.v1")
            ctx = ctxsetters.WithServiceName(ctx, "GreeterService")
            ctx = ctxsetters.WithMethodName(ctx, "Hello")
            caller := c.callHello
        Severity: Major
        Found in api/rpc/v1/service.twirp.go - About 40 mins to fix

          Method greeterServiceProtobufClient.Sign has 6 return statements (exceeds 4 allowed).
          Open

          func (c *greeterServiceProtobufClient) Sign(ctx context.Context, in *SignRequest) (*SignResponse, error) {
              ctx = ctxsetters.WithPackageName(ctx, "api.rpc.v1")
              ctx = ctxsetters.WithServiceName(ctx, "GreeterService")
              ctx = ctxsetters.WithMethodName(ctx, "Sign")
              caller := c.callSign
          Severity: Major
          Found in api/rpc/v1/service.twirp.go - About 40 mins to fix

            Function doJSONRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
            Severity: Minor
            Found in api/rpc/v1/service.twirp.go - About 35 mins to fix

              Function local_request_GreeterService_Hello_0 has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func local_request_GreeterService_Hello_0(ctx context.Context, marshaler runtime.Marshaler, server GreeterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
              Severity: Minor
              Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                Function doProtobufRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
                Severity: Minor
                Found in api/rpc/v1/service.twirp.go - About 35 mins to fix

                  Function request_GreeterService_Hello_0 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func request_GreeterService_Hello_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
                  Severity: Minor
                  Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                    Function request_GreeterService_Sign_0 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func request_GreeterService_Sign_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
                    Severity: Minor
                    Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                      Function local_request_GreeterService_Sign_0 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func local_request_GreeterService_Sign_0(ctx context.Context, marshaler runtime.Marshaler, server GreeterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
                      Severity: Minor
                      Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        func (c *greeterServiceClient) Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
                            out := new(HelloResponse)
                            err := c.cc.Invoke(ctx, GreeterService_Hello_FullMethodName, in, out, opts...)
                            if err != nil {
                                return nil, err
                        Severity: Minor
                        Found in api/rpc/v1/service_grpc.pb.go and 1 other location - About 35 mins to fix
                        api/rpc/v1/service_grpc.pb.go on lines 52..59

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 107.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        func (c *greeterServiceClient) Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) {
                            out := new(SignResponse)
                            err := c.cc.Invoke(ctx, GreeterService_Sign_FullMethodName, in, out, opts...)
                            if err != nil {
                                return nil, err
                        Severity: Minor
                        Found in api/rpc/v1/service_grpc.pb.go and 1 other location - About 35 mins to fix
                        api/rpc/v1/service_grpc.pb.go on lines 43..50

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 107.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Function Run has 5 return statements (exceeds 4 allowed).
                        Open

                        func Run(cnf *config.Server) *cobra.Command {
                            command := cobra.Command{
                                Use:   "run",
                                Short: "run the server",
                                Long:  "Start listening required protocols.",
                        Severity: Major
                        Found in internal/command/server.go - About 35 mins to fix

                          Function RegisterGreeterServiceHandlerClient has 5 return statements (exceeds 4 allowed).
                          Open

                          func RegisterGreeterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterServiceClient) error {
                          
                              mux.Handle("POST", pattern_GreeterService_Hello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
                                  ctx, cancel := context.WithCancel(req.Context())
                                  defer cancel()
                          Severity: Major
                          Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                            Function RegisterGreeterServiceHandlerServer has 5 return statements (exceeds 4 allowed).
                            Open

                            func RegisterGreeterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServiceServer) error {
                            
                                mux.Handle("POST", pattern_GreeterService_Hello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
                                    ctx, cancel := context.WithCancel(req.Context())
                                    defer cancel()
                            Severity: Major
                            Found in api/rpc/v1/service.pb.gw.go - About 35 mins to fix

                              Function errorFromResponse has 5 return statements (exceeds 4 allowed).
                              Open

                              func errorFromResponse(resp *http.Response) twirp.Error {
                                  statusCode := resp.StatusCode
                                  statusText := http.StatusText(statusCode)
                              
                                  if isHTTPRedirect(statusCode) {
                              Severity: Major
                              Found in api/rpc/v1/service.twirp.go - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language