privly/privly-applications

View on GitHub

Showing 109 of 109 total issues

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

    if (postingContentServerUrl !== undefined) {
      try {
        Privly.options.setServerUrl(postingContentServerUrl);
        ls.removeItem('posting_content_server_url');
      } catch (ignore) {}
Severity: Minor
Found in shared/javascripts/options.js and 1 other location - About 55 mins to fix
shared/javascripts/options.js on lines 120..125

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

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

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

    if (userWhitelistJSON !== undefined) {
      try {
        Privly.options.setWhitelist(userWhitelistJSON);
        ls.removeItem('user_whitelist_json');
      } catch (ignore) {}
Severity: Minor
Found in shared/javascripts/options.js and 1 other location - About 55 mins to fix
shared/javascripts/options.js on lines 128..133

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

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

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

    Privly.message.addListener(function (message, sendResponse) {
      if (message.targetAppId !== self.selfAppId) {
        return;
      }
      return self.onMessageReceived(message, sendResponse);
Severity: Minor
Found in shared/javascripts/viewAdapters/seamless.js and 1 other location - About 55 mins to fix
shared/javascripts/viewAdapters/seamless_ttlselect.js on lines 199..204

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

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

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

    Privly.message.addListener(function (message, sendResponse) {
      if (message.targetAppId !== self.selfAppId) {
        return;
      }
      return self.onMessageReceived(message, sendResponse);
Severity: Minor
Found in shared/javascripts/viewAdapters/seamless_ttlselect.js and 1 other location - About 55 mins to fix
shared/javascripts/viewAdapters/seamless.js on lines 827..832

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

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

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

    case "http://localhost:3000":
      var local_input = document.getElementById("server_form");
      local_input.style.display = "block";
      server_input.selectedIndex = 2;
      break;
Severity: Major
Found in Pages/js/options.js and 2 other locations - About 45 mins to fix
Pages/js/options.js on lines 120..124
Pages/js/options.js on lines 127..131

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

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

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

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

          case "https://dev.privly.org":
            var dev_input = document.getElementById("server_form");
            dev_input.style.display = "block";
            server_input.selectedIndex = 1;
            break;
      Severity: Major
      Found in Pages/js/options.js and 2 other locations - About 45 mins to fix
      Pages/js/options.js on lines 120..124
      Pages/js/options.js on lines 134..138

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

      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

      Avoid deeply nested control flow statements.
      Open

              for(var i=0 ; i<len ; i++) {
                this.workers[i].port.emit("PRIVLY_MESSAGE", data);
              }
      Severity: Major
      Found in shared/javascripts/context_messenger.js - About 45 mins to fix

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

            case "https://privlyalpha.org":
              var alpha_input = document.getElementById("server_form");
              alpha_input.style.display = "block";
              server_input.selectedIndex = 0;
              break;
        Severity: Major
        Found in Pages/js/options.js and 2 other locations - About 45 mins to fix
        Pages/js/options.js on lines 127..131
        Pages/js/options.js on lines 134..138

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

        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

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

          SeamlessAdapter.prototype.msgInsertLink = function (link) {
            return this.messageExtension({
              action: 'posting/contentScript/insertLink',
              link: link
            }, true);
        Severity: Major
        Found in shared/javascripts/viewAdapters/seamless.js and 3 other locations - About 40 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 291..296
        shared/javascripts/viewAdapters/seamless.js on lines 322..327
        shared/javascripts/viewAdapters/seamless_ttlselect.js on lines 88..93

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

        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

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

          SeamlessAdapter.prototype.msgSetTargetText = function (text) {
            return this.messageExtension({
              action: 'posting/contentScript/setTargetText',
              text: text
            }, true);
        Severity: Major
        Found in shared/javascripts/viewAdapters/seamless.js and 3 other locations - About 40 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 304..309
        shared/javascripts/viewAdapters/seamless.js on lines 322..327
        shared/javascripts/viewAdapters/seamless_ttlselect.js on lines 88..93

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

        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

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

          SeamlessTTLSelectAdapter.prototype.msgAppReady = function (size) {
            return this.messageExtension({
              action: 'posting/contentScript/TTLSelectReady',
              size: size
            }, true);
        Severity: Major
        Found in shared/javascripts/viewAdapters/seamless_ttlselect.js and 3 other locations - About 40 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 291..296
        shared/javascripts/viewAdapters/seamless.js on lines 304..309
        shared/javascripts/viewAdapters/seamless.js on lines 322..327

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

        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

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

          SeamlessAdapter.prototype.msgEmitEnterEvent = function (keys) {
            return this.messageExtension({
              action: 'posting/contentScript/emitEnterEvent',
              keys: keys
            }, true);
        Severity: Major
        Found in shared/javascripts/viewAdapters/seamless.js and 3 other locations - About 40 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 291..296
        shared/javascripts/viewAdapters/seamless.js on lines 304..309
        shared/javascripts/viewAdapters/seamless_ttlselect.js on lines 88..93

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

        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

        Function getAuthenticatedUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getAuthenticatedUrl: function(url) {
            
            // get the parameter string for the auth token
            privlyNetworkService.setAuthTokenString();
            
        Severity: Minor
        Found in shared/javascripts/network_service.js - 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

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

          SeamlessAdapter.prototype.msgStartLoading = function () {
            return this.messageExtension({
              action: 'posting/contentScript/loading',
              state: true
            });
        Severity: Minor
        Found in shared/javascripts/viewAdapters/seamless.js and 1 other location - About 35 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 252..257

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

        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

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

          SeamlessAdapter.prototype.msgStopLoading = function () {
            return this.messageExtension({
              action: 'posting/contentScript/loading',
              state: false
            });
        Severity: Minor
        Found in shared/javascripts/viewAdapters/seamless.js and 1 other location - About 35 mins to fix
        shared/javascripts/viewAdapters/seamless.js on lines 240..245

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

        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

        Avoid too many return statements within this function.
        Open

              return "FIREFOX";
        Severity: Major
        Found in shared/javascripts/network_service.js - About 30 mins to fix

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

              privlyNetworkService.sameOriginPostRequest(
                privlyNetworkService.contentServerDomain() + "/users/invitation",
                callbacks.checkRegistration,
                { "user[email]":  $("#register_email").val() });
          Severity: Minor
          Found in Pages/js/first_run.js and 1 other location - About 30 mins to fix
          Login/js/new.js on lines 93..96

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

          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

          Avoid too many return statements within this function.
          Open

                return "HOSTED";
          Severity: Major
          Found in shared/javascripts/network_service.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language