privly/privly-web

View on GitHub

Showing 60 of 98 total issues

Method create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    
    unless current_user.can_post
      redirect_to welcome_page_path
    end
Severity: Minor
Found in app/controllers/posts_controller.rb - About 45 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

Function correctIndirection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  correctIndirection: function() 
  {
    var anchors = document.links;
    var i = anchors.length;
    while (i--){
Severity: Minor
Found in public/cdn/privly-0.1.1.js - About 45 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

Function toggleInjection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  toggleInjection: function() {
    var iframes = document.getElementsByTagName("iframe");
    for(var i = 0; i < iframes.length; i++) {
      var iframe = iframes[i];
      if (iframe.getAttribute("data-privly-display") === "true") {
Severity: Minor
Found in public/cdn/privly.js - About 45 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

Function getUrlVariables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  getUrlVariables: function(url) {
    
    "use strict";
    
    var vars = {};
Severity: Minor
Found in public/cdn/privly-0.1.3.js - About 45 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

Function toggleInjection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  toggleInjection: function() {
    var iframes = document.getElementsByTagName("iframe");
    for(var i = 0; i < iframes.length; i++) {
      var iframe = iframes[i];
      if (iframe.getAttribute("data-privly-display") === "true") {
Severity: Minor
Found in public/cdn/privly-0.1.3.js - About 45 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 (privly.privlyReferencesRegex.test(attrib.value)) {
              a.setAttribute("href", attrib.value);
              a.setAttribute("privlyHref", newHref);
            }
Severity: Major
Found in public/cdn/privly-0.1.2.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (privly.privlyReferencesRegex.test(attrib.value)) {
                  a.setAttribute("privlyHref", attrib.value);
                }
    Severity: Major
    Found in public/cdn/privly-0.1.3.js - About 45 mins to fix

      Method set_burn_date has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_burn_date
            
            unless @post.user == current_user
              return
            end
      Severity: Minor
      Found in app/controllers/posts_controller.rb - About 45 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

      Function getUrlVariables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        getUrlVariables: function(url) {
          
          "use strict";
          
          var vars = {};
      Severity: Minor
      Found in public/cdn/privly.js - About 45 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

      Function isEditable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        isEditable: function(node) {
      
         "use strict";
      
         if ( node.contentEditable === "true" ) {
      Severity: Minor
      Found in public/cdn/privly-0.1.2.js - About 45 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

      Method destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def destroy
          respond_to do |format|
            format.html {
              unless user_signed_in?
                redirect_to new_user_session_path, :error => "you are not signed in, we did not destroy a token"
      Severity: Minor
      Found in app/controllers/token_authentications_controller.rb - About 45 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

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

        isEditable: function(node) {
      
         "use strict";
      
         if ( node.contentEditable === "true" ) {
      Severity: Minor
      Found in public/cdn/privly.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

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

        def use_invite
          
          # Make sure the user has invites remaining
          if current_user.alpha_invites < 1
            redirect_to pages_account_path, :notice => "You do not have any invitations at this time."
      Severity: Minor
      Found in app/controllers/users/invitations_controller.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

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

        isEditable: function(node) {
      
         "use strict";
      
         if ( node.contentEditable === "true" ) {
      Severity: Minor
      Found in public/cdn/privly-0.1.3.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

      Avoid too many return statements within this function.
      Open

           return false;
      Severity: Major
      Found in public/cdn/privly.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

             return false;
        Severity: Major
        Found in public/cdn/privly-0.1.2.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

               return false;
          Severity: Major
          Found in public/cdn/privly-0.1.3.js - About 30 mins to fix

            Function injectLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              injectLink: function(object)
              {
                "use strict";
                
                //Sets content URL.
            Severity: Minor
            Found in public/cdn/privly-0.1.3.js - About 25 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

            Function injectLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              injectLink: function(object)
              {
                "use strict";
                
                //Sets content URL.
            Severity: Minor
            Found in public/cdn/privly.js - About 25 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

            Function resizeIframePostedMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              resizeIframePostedMessage: function(message){
                
                "use strict";
                
                //check the format of the message
            Severity: Minor
            Found in public/cdn/privly-0.1.2.js - About 25 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