pennz/DataViz

View on GitHub

Showing 17 of 227 total issues

Tree has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

type Tree struct {
    Root       *Node            // Root node
    Comparator utils.Comparator // Key comparator
    size       int              // Total number of keys in the tree
    m          int              // order (maximum number of children)
Severity: Minor
Found in trees/btree/btree.go - About 6 hrs to fix

Tree has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

type Tree struct {
    Root       *Node
    size       int
    Comparator utils.Comparator
}
Severity: Minor
Found in trees/redblacktree/redblacktree.go - About 3 hrs to fix

Function Viz has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var Viz = function () {
    function Viz() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          workerURL = _ref3.workerURL,
          worker = _ref3.worker,
Severity: Major
Found in GraphVizOnline/viz.js - About 3 hrs to fix

File viz.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
Viz.js 2.1.1 (Graphviz 2.40.1, Expat 2.2.5, Emscripten 1.37.36)
Copyright (c) 2014-2018 Michael Daines
Licensed under MIT license

Severity: Minor
Found in GraphVizOnline/viz.js - About 2 hrs to fix

Method Tree.Visualize has 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (tree *Tree) Visualize() string {
    it := tree.Iterator()
    dotString := "digraph G{bgcolor=azure;"
    nodeIndexCount := 0
    subGraphNumber := 0
Severity: Minor
Found in trees/btree/btree.go - About 1 hr to fix

Method Tree.Visualize has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (tree *Tree) Visualize() string {
    it := tree.Iterator()
    dotString := "digraph G{bgcolor=azure;"
    nodeIndexCount := 0
    subGraphNumber := 0
Severity: Minor
Found in trees/btree/btree.go - About 1 hr to fix

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 svgXmlToImageElement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function svgXmlToImageElement(svgXml) {
    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref$scale = _ref.scale,
        scale = _ref$scale === undefined ? defaultScale() : _ref$scale,
        _ref$mimeType = _ref.mimeType,
Severity: Minor
Found in GraphVizOnline/viz.js - About 1 hr to fix

Function svgXmlToImageElementFabric has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function svgXmlToImageElementFabric(svgXml) {
    var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref2$scale = _ref2.scale,
        scale = _ref2$scale === undefined ? defaultScale() : _ref2$scale,
        _ref2$mimeType = _ref2.mimeType,
Severity: Minor
Found in GraphVizOnline/viz.js - About 1 hr to fix

Function WorkerWrapper has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var WorkerWrapper = function () {
    function WorkerWrapper(worker) {
      var _this = this;

      classCallCheck(this, WorkerWrapper);
Severity: Minor
Found in GraphVizOnline/viz.js - About 1 hr to fix

Method Iterator.Prev has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func (iterator *Iterator) Prev() bool {
    if iterator.position == begin {
        goto begin
    }
    if iterator.position == end {
Severity: Minor
Found in trees/redblacktree/iterator.go - About 1 hr to fix

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

Method Iterator.Next has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func (iterator *Iterator) Next() bool {
    if iterator.position == end {
        goto end
    }
    if iterator.position == begin {
Severity: Minor
Found in trees/redblacktree/iterator.go - About 1 hr to fix

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

Method Iterator.Next has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
Open

func (iterator *Iterator) Next() bool {
    // If already at end, go to end
    if iterator.position == end {
        goto end
    }
Severity: Minor
Found in trees/btree/iterator.go - About 1 hr to fix

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

Method Iterator.Prev has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
Open

func (iterator *Iterator) Prev() bool {
    // If already at beginning, go to begin
    if iterator.position == begin {
        goto begin
    }
Severity: Minor
Found in trees/btree/iterator.go - About 1 hr to fix

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

Method Tree.rebalance has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (tree *Tree) rebalance(node *Node, deletedKey interface{}) {
    // check if rebalancing is needed
    if node == nil || len(node.Entries) >= tree.minEntries() {
        return
    }
Severity: Minor
Found in trees/btree/btree.go - About 1 hr to fix

Function main has 7 return statements (exceeds 4 allowed).
Open

func main() {
    set := treeset.NewWithIntComparator()
    set.Add(2, 3, 4, 2, 5, 6, 7, 8)
    printSet("Initial", set) // [ 2 3 4 5 6 7 8 ]

Severity: Major
Found in examples/enumerablewithindex/enumerablewithindex.go - About 45 mins to fix

Function main has 7 return statements (exceeds 4 allowed).
Open

func main() {
    m := treemap.NewWithStringComparator()
    m.Put("g", 7)
    m.Put("f", 6)
    m.Put("e", 5)
Severity: Major
Found in examples/enumerablewithkey/enumerablewithkey.go - About 45 mins to fix

Method Tree.remove has 6 return statements (exceeds 4 allowed).
Open

func (t *Tree) remove(key interface{}, qp **Node) bool {
    q := *qp
    if q == nil {
        return false
    }
Severity: Major
Found in trees/avltree/avltree.go - About 40 mins to fix
Severity
Category
Status
Source
Language