Gandi/hieraviz

View on GitHub

Showing 12 of 245 total issues

File fetch.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
  'use strict';

  if (self.fetch) {
    return
Severity: Minor
Found in app/public/js/fetch.js - About 3 hrs to fix

    Function build_hierarchy has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function build_hierarchy(top, node) {
        var hierarchy = document.createElement('div');
        hierarchy.className = 'hierarchy';
        top.insertBefore(hierarchy, top.firstChild);
        fetch('/v1/' + base + '/node/' + node + '/hierarchy', auth_header()).
    Severity: Major
    Found in app/public/js/nodes.js - About 3 hrs to fix

      File nodes.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* 
      We don't need jQuery fat mama
      http://youmightnotneedjquery.com/
      https://github.com/oneuijs/You-Dont-Need-jQuery
      
      
      Severity: Minor
      Found in app/public/js/nodes.js - About 3 hrs to fix

        Function Body has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function Body() {
            this.bodyUsed = false
        
        
            this._initBody = function(body) {
        Severity: Major
        Found in app/public/js/fetch.js - About 2 hrs to fix

          Function fetch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            self.fetch = function(input, init) {
              return new Promise(function(resolve, reject) {
                var request
                if (Request.prototype.isPrototypeOf(input) && !init) {
                  request = input
          Severity: Minor
          Found in app/public/js/fetch.js - About 1 hr to fix

            Method cross_origin has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def cross_origin(hash=nil)
                    request_origin = request.env['HTTP_ORIGIN']
                    return unless request_origin
                    settings.set hash if hash
            
            
            Severity: Minor
            Found in lib/sinatra/cross-origin.rb - 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 check_authorization has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                    def check_authorization
                      if session_info['username']
                        session_info['username']
                      else
                        access_token = session['access_token']
            Severity: Minor
            Found in app/web.rb - 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 check_authorization has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def check_authorization
                      if !session['access_token'] && !request.env['HTTP_X_AUTH']
                        redirect '/v1/not_logged'
                      else
                        token = session['access_token'] || request.env['HTTP_X_AUTH']
            Severity: Minor
            Found in app/apiv1.rb - 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 Request has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function Request(input, options) {
                options = options || {}
                var body = options.body
                if (Request.prototype.isPrototypeOf(input)) {
                  if (input.bodyUsed) {
            Severity: Minor
            Found in app/public/js/fetch.js - About 1 hr to fix

              Method cross_origin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def cross_origin(hash=nil)
                      request_origin = request.env['HTTP_ORIGIN']
                      return unless request_origin
                      settings.set hash if hash
              
              
              Severity: Minor
              Found in lib/sinatra/cross-origin.rb - About 1 hr to fix

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

                  function build_line(top, file, key, value, overriden) {
                Severity: Minor
                Found in app/public/js/nodes.js - About 35 mins to fix

                  Method get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get(key, expiration)
                        file = tmpfile(key)
                        if File.exist?(file)
                          if expiration && expired?(file, expiration)
                            File.unlink(file)
                  Severity: Minor
                  Found in lib/hieraviz/store.rb - About 35 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language