Showing 80 of 191 total issues
File type.go
has 883 lines of code (exceeds 500 allowed). Consider refactoring. Open
package signature
import (
"bytes"
"fmt"
File parser.go
has 758 lines of code (exceeds 500 allowed). Consider refactoring. Open
package idl
import (
"fmt"
"io"
File stub.go
has 731 lines of code (exceeds 500 allowed). Consider refactoring. Open
package stub
import (
"fmt"
"io"
Method qiDecoder.value
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func (q qiDecoder) value(v reflect.Value) error {
switch v.Kind() {
case reflect.Interface:
i := v.Interface()
b, ok := i.(BinaryDecoder)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File proxy.go
has 586 lines of code (exceeds 500 allowed). Consider refactoring. Open
package idl
import (
"fmt"
Method qiDecoder.value
has 112 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (q qiDecoder) value(v reflect.Value) error {
switch v.Kind() {
case reflect.Interface:
i := v.Interface()
b, ok := i.(BinaryDecoder)
Function trace
has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring. Open
func trace(serverURL, serviceName string, objectID uint32) {
sess, err := session.NewSession(serverURL)
if err != nil {
log.Fatalf("%s: %s", serverURL, err)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function generateObjectInterface
has 89 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateObjectInterface(file *jen.File, set *signature.TypeSet,
itf *idl.InterfaceType) error {
// Proxy and stub shall generate the name method name: reuse
// the MetaObject method ForEachMethodAndSignal to get an
Function generateObjectInterface
has 86 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateObjectInterface(itf *InterfaceType, serviceName string,
file *jen.File) error {
definitions := make([]jen.Code, 0)
Method qiEncoder.value
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func (q qiEncoder) value(v reflect.Value) error {
switch v.Kind() {
case reflect.Interface:
i := v.Interface()
w, ok := i.(BinaryEncoder)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function generateProxyType
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateProxyType(file *jen.File, serviceName, ProxyName string,
itf *InterfaceType) {
file.Comment(ProxyName + " implements " + objName(serviceName))
if ProxyName == proxyName("Object") || ProxyName == proxyName("ServiceZero") {
Method client.Call
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *client) Call(cancel <-chan struct{}, serviceID, objectID, actionID uint32,
payload []byte) ([]byte, error) {
// Do nothing if cancel is already closed.
if cancel != nil {
Method qiDecoder.value
has 21 return statements (exceeds 4 allowed). Open
func (q qiDecoder) value(v reflect.Value) error {
switch v.Kind() {
case reflect.Interface:
i := v.Interface()
b, ok := i.(BinaryDecoder)
Function methodBodyBlock2
has 71 lines of code (exceeds 50 allowed). Consider refactoring. Open
func methodBodyBlock2(method Method, params *signature.TupleType,
ret signature.Type) (*Statement, error) {
writing := []jen.Code{}
if ret.Signature() == "v" {
writing = append(writing, jen.Var().Id("ret").Struct())
Method qiEncoder.value
has 71 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (q qiEncoder) value(v reflect.Value) error {
switch v.Kind() {
case reflect.Interface:
i := v.Interface()
w, ok := i.(BinaryEncoder)
Function generateStubMetaObject
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubMetaObject(file *jen.File, itf *idl.InterfaceType) error {
metaMethods := func(d jen.Dict) {
for _, method := range itf.Methods {
d[jen.Lit(int(method.ID))] = jen.Values(jen.Dict{
jen.Id("Uid"): jen.Lit(int(method.ID)),
Function trace
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func trace(serverURL, serviceName string, objectID uint32) {
sess, err := session.NewSession(serverURL)
if err != nil {
log.Fatalf("%s: %s", serverURL, err)
Function init
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
flaggy.SetName("qiloop")
description := fmt.Sprintf("%s\n\n%s",
"an utility to explore QiMessaging",
asciibot.Random())
Function generateStubObject
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubObject(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
if itf.Name == "Object" {
code := jen.Id(`p.signal.Activate(activation)`)
writing = append(writing, code)
Method Header.Read
has 13 return statements (exceeds 4 allowed). Open
func (h *Header) Read(r io.Reader) (err error) {
if err = h.readMagic(r); err != nil {
return fmt.Errorf("read message magic: %s", err)
} else if h.Magic != Magic {
return fmt.Errorf("invalid message magic: %x", h.Magic)