octomation/go-service

View on GitHub

Showing 64 of 64 total issues

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

func _GreeterService_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
    in := new(HelloRequest)
    if err := dec(in); err != nil {
        return nil, err
    }
Severity: Major
Found in api/rpc/v1/service_grpc.pb.go and 1 other location - About 2 hrs to fix
api/rpc/v1/service_grpc.pb.go on lines 111..127

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 221.

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 81 lines of code (exceeds 50 allowed). Consider refactoring.
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 2 hrs to fix

    Function file_v1_service_proto_init has 71 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func file_v1_service_proto_init() {
        if File_v1_service_proto != nil {
            return
        }
        if !protoimpl.UnsafeEnabled {
    Severity: Minor
    Found in api/rpc/v1/service.pb.go - About 1 hr to fix

      Method greeterServiceServer.serveHelloJSON has 71 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (s *greeterServiceServer) serveHelloJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
          var err error
          ctx = ctxsetters.WithMethodName(ctx, "Hello")
          ctx, err = callRequestRouted(ctx, s.hooks)
          if err != nil {
      Severity: Minor
      Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

        Method greeterServiceServer.serveSignJSON has 71 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s *greeterServiceServer) serveSignJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
            var err error
            ctx = ctxsetters.WithMethodName(ctx, "Sign")
            ctx, err = callRequestRouted(ctx, s.hooks)
            if err != nil {
        Severity: Minor
        Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

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

          func (c *greeterServiceJSONClient) callSign(ctx context.Context, in *SignRequest) (*SignResponse, error) {
              out := new(SignResponse)
              ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
              if err != nil {
                  twerr, ok := err.(twirp.Error)
          Severity: Major
          Found in api/rpc/v1/service.twirp.go and 3 other locations - About 1 hr to fix
          api/rpc/v1/service.twirp.go on lines 117..132
          api/rpc/v1/service.twirp.go on lines 163..178
          api/rpc/v1/service.twirp.go on lines 256..271

          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 178.

          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 (c *greeterServiceJSONClient) callHello(ctx context.Context, in *HelloRequest) (*HelloResponse, error) {
              out := new(HelloResponse)
              ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
              if err != nil {
                  twerr, ok := err.(twirp.Error)
          Severity: Major
          Found in api/rpc/v1/service.twirp.go and 3 other locations - About 1 hr to fix
          api/rpc/v1/service.twirp.go on lines 117..132
          api/rpc/v1/service.twirp.go on lines 163..178
          api/rpc/v1/service.twirp.go on lines 302..317

          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 178.

          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 (c *greeterServiceProtobufClient) callHello(ctx context.Context, in *HelloRequest) (*HelloResponse, error) {
              out := new(HelloResponse)
              ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
              if err != nil {
                  twerr, ok := err.(twirp.Error)
          Severity: Major
          Found in api/rpc/v1/service.twirp.go and 3 other locations - About 1 hr to fix
          api/rpc/v1/service.twirp.go on lines 163..178
          api/rpc/v1/service.twirp.go on lines 256..271
          api/rpc/v1/service.twirp.go on lines 302..317

          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 178.

          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 (c *greeterServiceProtobufClient) callSign(ctx context.Context, in *SignRequest) (*SignResponse, error) {
              out := new(SignResponse)
              ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
              if err != nil {
                  twerr, ok := err.(twirp.Error)
          Severity: Major
          Found in api/rpc/v1/service.twirp.go and 3 other locations - About 1 hr to fix
          api/rpc/v1/service.twirp.go on lines 117..132
          api/rpc/v1/service.twirp.go on lines 256..271
          api/rpc/v1/service.twirp.go on lines 302..317

          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 178.

          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.serveSignProtobuf has 68 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (s *greeterServiceServer) serveSignProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
              var err error
              ctx = ctxsetters.WithMethodName(ctx, "Sign")
              ctx, err = callRequestRouted(ctx, s.hooks)
              if err != nil {
          Severity: Minor
          Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

            Method greeterServiceServer.serveHelloProtobuf has 68 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (s *greeterServiceServer) serveHelloProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
                var err error
                ctx = ctxsetters.WithMethodName(ctx, "Hello")
                ctx, err = callRequestRouted(ctx, s.hooks)
                if err != nil {
            Severity: Minor
            Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

              Function doProtobufRequest has 11 return statements (exceeds 4 allowed).
              Open

              func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
                  reqBodyBytes, err := proto.Marshal(in)
                  if err != nil {
                      return ctx, wrapInternal(err, "failed to marshal proto request")
                  }
              Severity: Major
              Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

                Method greeterServiceServer.serveHelloProtobuf has 11 return statements (exceeds 4 allowed).
                Open

                func (s *greeterServiceServer) serveHelloProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
                    var err error
                    ctx = ctxsetters.WithMethodName(ctx, "Hello")
                    ctx, err = callRequestRouted(ctx, s.hooks)
                    if err != nil {
                Severity: Major
                Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

                  Method greeterServiceServer.serveSignJSON has 11 return statements (exceeds 4 allowed).
                  Open

                  func (s *greeterServiceServer) serveSignJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
                      var err error
                      ctx = ctxsetters.WithMethodName(ctx, "Sign")
                      ctx, err = callRequestRouted(ctx, s.hooks)
                      if err != nil {
                  Severity: Major
                  Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

                    Function doJSONRequest has 11 return statements (exceeds 4 allowed).
                    Open

                    func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {
                        marshaler := &protojson.MarshalOptions{UseProtoNames: true}
                        reqBytes, err := marshaler.Marshal(in)
                        if err != nil {
                            return ctx, wrapInternal(err, "failed to marshal json request")
                    Severity: Major
                    Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

                      Method greeterServiceServer.serveHelloJSON has 11 return statements (exceeds 4 allowed).
                      Open

                      func (s *greeterServiceServer) serveHelloJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
                          var err error
                          ctx = ctxsetters.WithMethodName(ctx, "Hello")
                          ctx, err = callRequestRouted(ctx, s.hooks)
                          if err != nil {
                      Severity: Major
                      Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

                        Method greeterServiceServer.serveSignProtobuf has 11 return statements (exceeds 4 allowed).
                        Open

                        func (s *greeterServiceServer) serveSignProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
                            var err error
                            ctx = ctxsetters.WithMethodName(ctx, "Sign")
                            ctx, err = callRequestRouted(ctx, s.hooks)
                            if err != nil {
                        Severity: Major
                        Found in api/rpc/v1/service.twirp.go - About 1 hr to fix

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

                              command := cobra.Command{
                                  Use:   "client",
                                  Short: "client to the service",
                                  Long:  "Run service commands remotely.",
                          
                          
                          Severity: Minor
                          Found in internal/command/client.go and 1 other location - About 55 mins to fix
                          internal/command/server.go on lines 30..47

                          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 126.

                          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

                              command := cobra.Command{
                                  Use:   "server",
                                  Short: "server of the service",
                                  Long:  "Execute remote client commands.",
                          
                          
                          Severity: Minor
                          Found in internal/command/server.go and 1 other location - About 55 mins to fix
                          internal/command/client.go on lines 22..39

                          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 126.

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language