1set/starlight

View on GitHub
convert/slice.go

Summary

Maintainability
B
4 hrs
Test Coverage

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

func list_remove(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
    if len(args) != 1 {
        return nil, fmt.Errorf("remove: got %d arguments, want 1", len(args))
    }
    if err := g.checkMutable("remove from"); err != nil {
Severity: Major
Found in convert/slice.go - About 35 mins to fix

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

    func list_pop(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
        index := g.v.Len() - 1
        switch len(args) {
        case 0:
            // ok
    Severity: Major
    Found in convert/slice.go - About 35 mins to fix

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

      func list_extend(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          if len(args) != 1 {
              return nil, fmt.Errorf("extend: got %d arguments, want 1", len(args))
          }
          if err := g.checkMutable("extend"); err != nil {
      Severity: Major
      Found in convert/slice.go - About 35 mins to fix

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

        func list_insert(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
            if len(args) != 2 {
                return nil, fmt.Errorf("extend: got %d arguments, want 2", len(args))
            }
            if err := g.checkMutable("insert into"); err != nil {
        Severity: Major
        Found in convert/slice.go - About 35 mins to fix

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

          func sliceAttr(g *GoSlice, name string, methods map[string]builtinSliceMethod) (starlark.Value, error) {
              method := methods[name]
              if method == nil {
                  return nil, nil // no such method
              }
          Severity: Major
          Found in convert/slice.go and 1 other location - About 1 hr to fix
          convert/map.go on lines 227..238

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

          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

          exported method GoSlice.Len should have comment or be unexported
          Open

          func (g *GoSlice) Len() int {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_pop should be listPop
          Open

          func list_pop(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_extend should be listExtend
          Open

          func list_extend(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_index should be listIndex
          Open

          func list_index(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.Slice should have comment or be unexported
          Open

          func (g *GoSlice) Slice(start, end, step int) starlark.Value {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func parameter start_ should be start
          Open

          func indices(start_, end_ starlark.Value, len int) (start, end int, err error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_remove should be listRemove
          Open

          func list_remove(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; var end_ should be end
          Open

              var start_, end_ starlark.Value
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.SetIndex should have comment or be unexported
          Open

          func (g *GoSlice) SetIndex(index int, v starlark.Value) error {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_append should be listAppend
          Open

          func list_append(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.Clear should have comment or be unexported
          Open

          func (g *GoSlice) Clear() error {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func parameter end_ should be end
          Open

          func indices(start_, end_ starlark.Value, len int) (start, end int, err error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_insert should be listInsert
          Open

          func list_insert(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; var start_ should be start
          Open

              var start_, end_ starlark.Value
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.Attr should have comment or be unexported
          Open

          func (g *GoSlice) Attr(name string) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.AttrNames should have comment or be unexported
          Open

          func (g *GoSlice) AttrNames() []string {
          Severity: Minor
          Found in convert/slice.go by golint

          don't use underscores in Go names; func list_clear should be listClear
          Open

          func list_clear(fnname string, g *GoSlice, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
          Severity: Minor
          Found in convert/slice.go by golint

          exported method GoSlice.Iterate should have comment or be unexported
          Open

          func (g *GoSlice) Iterate() starlark.Iterator {
          Severity: Minor
          Found in convert/slice.go by golint

          There are no issues that match your filters.

          Category
          Status