privly/privly-applications

View on GitHub

Showing 48 of 109 total issues

File context_messenger.js has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @fileOverview This script is responsible for integrating privly-applications,
 * content scripts, the browser extension background script,
 * and mobile architectures with message passing. Each of these scripting contexts
 * include this script on each of the platforms (Chrome, Firefox, etc).
Severity: Minor
Found in shared/javascripts/context_messenger.js - About 7 hrs to fix

    File seamless.js has 471 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @fileOverview The seamless-posting adapter.
     *
     * This adapter is designed to be loaded in an seamless-posting iframe.
     * It needs seamless-posting content scripts to work correctly.
    Severity: Minor
    Found in shared/javascripts/viewAdapters/seamless.js - About 7 hrs to fix

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

      /**
       * @fileOverview This is a general adapter for interfacing with the Privly-web
       * server: github.com/privly/privly-web
       *
       * Its purpose is to allow all privly-web derived applications to interface
      Severity: Minor
      Found in shared/javascripts/viewAdapters/show.js - About 3 hrs to fix

        Function pendingContent has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          pendingContent: function(callback) {
        
            // Show prompt to download extension, if in the hosted environment
            callbacks.showDownloadMessage();
        
        
        Severity: Major
        Found in shared/javascripts/viewAdapters/show.js - About 2 hrs to fix

          Function contentReturned has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            contentReturned: function(response, callback) {
              if( response.jqXHR.status === 200 ) {
                
                var json = response.json;
                
          Severity: Major
          Found in shared/javascripts/viewAdapters/show.js - About 2 hrs to fix

            File network_service.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * @fileOverview Interfaces the application with its current architecture.
             * This could be an extension, mobile app, or a hosted web server.
             *
             **/
            Severity: Minor
            Found in shared/javascripts/network_service.js - About 2 hrs to fix

              Function getMessageDOM has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getMessageDOM(row) {
                var href = row.privly_URL;
                var app = row.privly_application;
              
                // Rename deperecated apps - TODO Will be removed soon
              Severity: Major
              Found in History/js/new.js - About 2 hrs to fix

                Function get_link_creation_apps has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_link_creation_apps():
                  """
                  Gets a list of the apps that will be included in the top navigation
                  for generating new links
                  """
                Severity: Minor
                Found in build.py - 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 onConnectionCheckSucceeded has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  SeamlessAdapter.prototype.onConnectionCheckSucceeded = function () {
                    var self = this;
                    return self
                      .emitAsync('connectionCheckSucceeded')
                      .then(self.getTTLOptions.bind(self))
                Severity: Minor
                Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

                  Function upgrade has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Privly.options.upgrade = function () {
                      // Privly posting button
                      var disableButton = ls.getItem('Options:DissableButton');
                      if (disableButton !== undefined) {
                        try {
                  Severity: Minor
                  Found in shared/javascripts/options.js - About 1 hr to fix

                    Function contentReturned has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      contentReturned: function(response, callback) {
                        if( response.jqXHR.status === 200 ) {
                          
                          var json = response.json;
                          
                    Severity: Minor
                    Found in shared/javascripts/viewAdapters/show.js - 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 tooltip has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        tooltip: function(){
                    
                          // Create a new glyph if needed
                          if (Privly.options.getGlyph() === null) {
                            privlyTooltip.generateNewGlyph();
                    Severity: Minor
                    Found in shared/javascripts/tooltip.js - About 1 hr to fix

                      Function pendingContent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        pendingContent: function(callback) {
                      
                          // Show prompt to download extension, if in the hosted environment
                          callbacks.showDownloadMessage();
                      
                      
                      Severity: Minor
                      Found in shared/javascripts/viewAdapters/show.js - 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 isWhitelistedDomain has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        isWhitelistedDomain: function(url) {
                          
                          // Chrome maintains an explicit whitelist in local storage
                          if( privlyNetworkService.platformName() === "CHROME" || 
                            privlyNetworkService.platformName() === "FIREFOX") {
                      Severity: Minor
                      Found in shared/javascripts/network_service.js - 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 isDomainValid has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Privly.options.isDomainValid = function (domain) {
                          // Each subdomain can be from 1-63 characters and may contain alphanumeric
                          // characters, - and _ but may not begin or end with - or _
                          // Each domain can be from 1-63 characters and may contain alphanumeric 
                          // characters and - but may not begin or end with - Each top level domain may
                      Severity: Minor
                      Found in shared/javascripts/options.js - About 1 hr to fix

                        Function createLink has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          SeamlessAdapter.prototype.createLink = function () {
                            var self = this;
                            return self
                              .getRequestContent($('textarea').val())
                              .then(function (json) {
                        Severity: Minor
                        Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

                          Function click has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            click: function(evt, callback) {
                              
                              if( ! privlyNetworkService.permissions.canUpdate ) {
                                callbacks.singleClick(evt, callback);
                                return;
                          Severity: Minor
                          Found in shared/javascripts/viewAdapters/show.js - About 1 hr to fix

                            Function initMenu has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              SeamlessTTLSelectAdapter.prototype.initMenu = function (isAboveButton, selectedTTLValue, callback) {
                                $('#menu').empty();
                                this.getTTLOptions()
                                  .then(function (options) {
                                    var i;
                            Severity: Minor
                            Found in shared/javascripts/viewAdapters/seamless_ttlselect.js - About 1 hr to fix

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

                                Privly.glyph.getGlyphDOM = function (size) {
                                  if (size === undefined) {
                                    size = 30;
                                  }
                                  // Generate a new glyph if not exist
                              Severity: Minor
                              Found in shared/javascripts/glyph.js - About 1 hr to fix

                                Function parseDate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  parseDate: function(string, mode) {
                                
                                    var date = new Date(string);
                                    var current = new Date();
                                
                                
                                Severity: Minor
                                Found in History/js/new.js - 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

                                Severity
                                Category
                                Status
                                Source
                                Language