privly/privly-applications

View on GitHub

Showing 48 of 109 total issues

Function click has a Cognitive Complexity of 11 (exceeds 5 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

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

function saveWhitelist() {
  var url_inputs = document.getElementsByClassName('whitelist_url');
  
  var domains = [];  // Stores whitelist inputs and whitelisted values
  var input_fields = [];
Severity: Minor
Found in Pages/js/options.js - About 1 hr to fix

    Function updateLink has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      SeamlessAdapter.prototype.updateLink = function () {
        var self = this;
    
        if (self.privlyUrl === null) {
          return Promise.resolve();
    Severity: Minor
    Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

      Function SeamlessAdapter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var SeamlessAdapter = function (application, options) {
          /**
           * The Privly URL that is created to insert to the editable element.
           * 
           * @type {String}
      Severity: Minor
      Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

        Function initializeNavigation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          initializeNavigation: function() {
            var domain = privlyNetworkService.contentServerDomain();
            $(".home_domain").text(domain.split("/")[2]);
            $(".account_url").attr("href", domain + "/pages/account");
            $(".legal_nav").attr("href", domain + "/pages/privacy");
        Severity: Minor
        Found in shared/javascripts/network_service.js - About 1 hr to fix

          Function start has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            SeamlessAdapter.prototype.start = function () {
              var self = this;
              if (self.started) {
                return;
              }
          Severity: Minor
          Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

            Function parseDate has 29 lines of code (exceeds 25 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

              Function loadLink has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                SeamlessAdapter.prototype.loadLink = function (link) {
                  var self = this;
                  var url = privlyParameters.getApplicationUrl(link);
                  var reqUrl = privlyParameters.getParameterHash(url).privlyDataURL;
              
              
              Severity: Minor
              Found in shared/javascripts/viewAdapters/seamless.js - About 1 hr to fix

                Function restoreServer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function restoreServer(){
                  
                  var posting_content_server_url = Privly.options.getServerUrl();
                  var server_input = document.getElementById("content_server_url");
                
                
                Severity: Minor
                Found in Pages/js/options.js - About 1 hr to fix

                  Function getItem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    getItem: function(key) {
                      if ( ls.localStorageDefined ) {
                        var value = localStorage.getItem(key);
                        if (value === null){
                          return undefined;
                  Severity: Minor
                  Found in shared/javascripts/local_storage.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 getParameterHash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    getParameterHash: function(url)
                    {    
                      var parameters = {};
                      var hashIndex = url.indexOf("#");
                      if (hashIndex >= 0) {
                  Severity: Minor
                  Found in shared/javascripts/parameters.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 platformName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    platformName: function() {
                      if (navigator.userAgent.indexOf("iPhone") >= 0 || 
                        navigator.userAgent.indexOf("iPad") >= 0) {
                        if( navigator.userAgent.indexOf("Safari") >= 0 ) { return "HOSTED"; }
                          return "IOS";
                  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 processResponseContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function processResponseContent(response) {
                    
                    // Change the edit button back to the default style
                    // if it has been modified. This is usually for
                    // when the user has edited content and submitted
                  Severity: Minor
                  Found in Message/js/controllers/show.js - About 1 hr to fix

                    Function sendMessageTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      SafariAdapter.prototype.sendMessageTo = function (to, payload) {
                        if (to === 'BACKGROUND_SCRIPT') {
                          if (this.getContextName() === 'BACKGROUND_SCRIPT') {
                            safari.self.contentWindow.postMessage(payload, '*');
                          }
                    Severity: Minor
                    Found in shared/javascripts/context_messenger.js - About 1 hr to fix

                      Function _postCompleted has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        NewAdapter.prototype._postCompleted = function (response, url) {
                          $("#save").prop('disabled', false);
                      
                          if (response.jqXHR.status === 201 && url !== undefined && url !== "") {
                            Privly.message.messageExtension({privlyUrl: url});
                      Severity: Minor
                      Found in shared/javascripts/viewAdapters/new.js - About 1 hr to fix

                        Function setListener has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          SafariAdapter.prototype.setListener = function (callback) {
                            if (this.getContextName() === 'BACKGROUND_SCRIPT') {
                              safari.application.addEventListener("message", function(payload) {
                                if (typeof payload.name !== "undefined" && payload.name === "privlyMessage") {
                                  // The message is received from other than BACKGROUND_SCRIPT
                        Severity: Minor
                        Found in shared/javascripts/context_messenger.js - About 1 hr to fix

                          Function sendMessageTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            FirefoxAdapter.prototype.sendMessageTo = function (to, data) {
                             
                              var contextName = this.getContextName();
                              // Messages from Privly Applications to Background Script, Content Scripts
                              // Privly Applications can't send messages directly to background scripts, they do so via
                          Severity: Minor
                          Found in shared/javascripts/context_messenger.js - About 1 hr to fix

                            Function showDownloadMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              showDownloadMessage: function(callback) {
                            
                                // Show the download extension link in the hosted context
                                if( privlyNetworkService.platformName() === "HOSTED" && !privlyHostPage.isInjected() ){
                            
                            
                            Severity: Minor
                            Found in shared/javascripts/viewAdapters/show.js - About 55 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

                            Avoid deeply nested control flow statements.
                            Open

                                    if not is_build_target(template):
                                      continue
                            
                            
                            Severity: Major
                            Found in build.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        if "nav" in template.keys() and template["nav"] == "new":
                                          creation_apps.append(template["subtemplate_dict"]["name"])
                              
                                # Hack to maintain current app order
                                creation_apps.sort()
                              Severity: Major
                              Found in build.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language