indentlabs/notebook

View on GitHub

Showing 288 of 288 total issues

Method value_for has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def value_for(attribute_field, content)
    case attribute_field.field_type
    when 'link'
      page_links = self.attribute_values.detect do |value|
        value.entity_type == content.class.name && value.entity_id == content.id && value.attribute_field_id == attribute_field.id
Severity: Minor
Found in app/models/serializers/content_serializer.rb - About 1 hr to fix

    Method index has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def index
        @page_title = "My documents"
        @recent_documents = current_user
          .linkable_documents.order('updated_at DESC')
          .includes([:user, :page_tags, :universe])
    Severity: Minor
    Found in app/controllers/documents_controller.rb - About 1 hr to fix

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

          injectElementWithStyles = function( rule, callback, nodes, testnames ) {
      
            var style, ret, node, docOverflow,
                div = document.createElement('div'),
                // After page load injecting a fake body doesn't work so check if body exists
      Severity: Minor
      Found in app/assets/javascripts/modernizr.js - About 1 hr to fix

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

          Node.prototype.updatePosition = function () {
            var forces, showx, showy;
        
            if (this.el.hasClass("ui-draggable-dragging")) {
              this.x = parseInt(this.el.css('left'), 10) + (this.el.width() / 2);
        Severity: Minor
        Found in public/navigator/js-mindmap.js - About 1 hr to fix

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

            render () {
              return (
                <footer className="grey-text no-print">
                  <div className="container center">
                    <div className="row">
          Severity: Minor
          Found in app/javascript/components/Footer.js - About 1 hr to fix

            Method create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                content_type = content_type_from_controller(self.class)
                initialize_object
            
                unless current_user.can_create?(content_type) \
            Severity: Minor
            Found in app/controllers/content_controller.rb - About 1 hr to fix

              Method content_param_list has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def content_param_list
                  [
                    #todo remove all these (for all pages) now that we use custom attributes for them all (minus links)
                    # all but
                    #custom_attribute_values:     [:name, :value],
              Severity: Minor
              Found in app/controllers/characters_controller.rb - About 1 hr to fix

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

                    tests['smil'] = function() {
                        return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
                    };
                Severity: Major
                Found in app/assets/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/modernizr.js on lines 842..844

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

                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

                    tests['svgclippaths'] = function() {
                        return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
                    };
                Severity: Major
                Found in app/assets/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/modernizr.js on lines 833..835

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

                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

                Method value_for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def value_for(attribute_field, content)
                    case attribute_field.field_type
                    when 'link'
                      page_links = attribute_field.attribute_values.find_by(entity_type: content.class.name, entity_id: content.id)
                      if page_links.nil?
                Severity: Minor
                Found in app/models/serializers/api_content_serializer.rb - About 1 hr to fix

                  Method link_field_update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def link_field_update
                      @attribute_field = AttributeField.find_by(id: params[:field_id].to_i)
                      attribute_value = @attribute_field.attribute_values.order('created_at desc').find_or_initialize_by(entity_params)
                      attribute_value.user_id ||= current_user.id
                  
                  
                  Severity: Minor
                  Found in app/controllers/content_controller.rb - About 1 hr to fix

                    Method timeline has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def timeline
                            timeline = Timeline.find_by(id: params[:id].to_i)
                            events   = timeline.timeline_events
                    
                            render json: {
                    Severity: Minor
                    Found in app/controllers/api/v1/api_controller.rb - About 1 hr to fix

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

                          if (Math.abs(fx) > this.options.maxForce) {
                            fx = this.options.maxForce * (fx / Math.abs(fx));
                          }
                      Severity: Major
                      Found in public/navigator/js-mindmap.js and 1 other location - About 1 hr to fix
                      public/navigator/js-mindmap.js on lines 383..385

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

                      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 (Math.abs(fy) > this.options.maxForce) {
                            fy = this.options.maxForce * (fy / Math.abs(fy));
                          }
                      Severity: Major
                      Found in public/navigator/js-mindmap.js and 1 other location - About 1 hr to fix
                      public/navigator/js-mindmap.js on lines 380..382

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

                      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

                          tests['localstorage'] = function() {
                              try {
                                  localStorage.setItem(mod, mod);
                                  localStorage.removeItem(mod);
                                  return true;
                      Severity: Major
                      Found in app/assets/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/modernizr.js on lines 798..806

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

                      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

                          tests['sessionstorage'] = function() {
                              try {
                                  sessionStorage.setItem(mod, mod);
                                  sessionStorage.removeItem(mod);
                                  return true;
                      Severity: Major
                      Found in app/assets/javascripts/modernizr.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/modernizr.js on lines 788..796

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

                      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

                      Method create_prepay_invoice has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.create_prepay_invoice(n_months)
                          # Create a Paypal invoice to redirect to for payment
                          request = PayPalCheckoutSdk::Orders::OrdersCreateRequest::new
                          request.request_body({
                            intent: "CAPTURE",
                      Severity: Minor
                      Found in app/services/paypal_service.rb - About 1 hr to fix

                        Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def show
                            @page_title = @folder.title || 'Untitled folder'
                        
                            @parent_folder = @folder.parent_folder
                            @child_folders = Folder.where(parent_folder: @folder)
                        Severity: Minor
                        Found in app/controllers/folders_controller.rb - About 1 hr to fix

                          Method content_to_outline has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def content_to_outline
                              content_types = current_user.content.except('Document').except('Timeline').keys
                          
                              text = ""
                              content_types.each do |content_type|
                          Severity: Minor
                          Found in app/controllers/export_controller.rb - About 1 hr to fix

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

                                _selectOption(optionEl) {
                                  let key = optionEl.id;
                                  if (!$(optionEl).hasClass('disabled') && !$(optionEl).hasClass('optgroup') && key.length) {
                                    let selected = true;
                            
                            
                            Severity: Minor
                            Found in app/assets/javascripts/z_select.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language