indentlabs/notebook

View on GitHub

Showing 288 of 288 total issues

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

          if value.is_a?(ActiveRecord::Associations::CollectionProxy)
            value = value.map(&:name).to_sentence
          elsif attr.name.end_with?('_id') && value.present?
            universe = Universe.where(id: value.to_i).first
            value = universe.name if universe
Severity: Minor
Found in app/controllers/export_controller.rb and 1 other location - About 35 mins to fix
app/controllers/export_controller.rb on lines 84..89

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

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

    blobWrapper
        .append("path")
        .attr("class", "radarArea")
        .attr("d", function(d,i) { return radarLine(d); })
        .style("fill", function(d,i) { return cfg.color(i); })
Severity: Minor
Found in app/assets/javascripts/d3-charts/radar_chart.js and 1 other location - About 35 mins to fix
app/assets/javascripts/d3-charts/radar_chart.js on lines 183..186

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

              for (i = activeParent.children.length - 2; i >= 0; i--) {
                if (activeParent.children[i] === mindmap.activeNode) {
                  newNode = activeParent.children[i + 1];
                }
              }
Severity: Minor
Found in public/navigator/js-mindmap.js and 1 other location - About 35 mins to fix
public/navigator/js-mindmap.js on lines 542..546

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

  validates :header_image, attached: false,
    content_type: {
      in: ['image/png', 'image/jpg', 'image/jpeg', 'image/gif'],
      message: 'must be a PNG, JPG, JPEG, or GIF'
    },
Severity: Minor
Found in app/models/page_collections/page_collection.rb and 1 other location - About 35 mins to fix
app/models/users/user.rb on lines 98..113

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

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

    blobWrapper.append("path")
        .attr("class", "radarStroke")
        .attr("d", function(d,i) { return radarLine(d); })
        .style("stroke-width", cfg.strokeWidth + "px")
Severity: Minor
Found in app/assets/javascripts/d3-charts/radar_chart.js and 1 other location - About 35 mins to fix
app/assets/javascripts/d3-charts/radar_chart.js on lines 159..163

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 method.
Open

    return false
Severity: Major
Found in app/authorizers/content_page_authorizer.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return false
    Severity: Major
    Found in app/authorizers/timeline_authorizer.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return true if ::PermissionService.content_is_in_a_public_universe?(content: resource)
      Severity: Major
      Found in app/authorizers/content_authorizer.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return false
        Severity: Major
        Found in app/authorizers/content_authorizer.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return true if user && resource.universe.present? && resource.universe.user_id == user.id
          Severity: Major
          Found in app/authorizers/document_authorizer.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return false
            Severity: Major
            Found in app/authorizers/universe_core_content_authorizer.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return true if user && resource.universe.present? && resource.universe.contributors.pluck(:user_id).include?(user.id)
              Severity: Major
              Found in app/authorizers/document_authorizer.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return false
                Severity: Major
                Found in app/authorizers/attribute_authorizer.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return true if is_premium_page && PermissionService.user_is_on_premium_plan?(user: user)
                  Severity: Major
                  Found in app/authorizers/content_page_authorizer.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return true if user && user.site_administrator?
                    Severity: Major
                    Found in app/authorizers/timeline_authorizer.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                          return true if PermissionService.content_is_in_a_public_universe?(content: resource)
                      Severity: Major
                      Found in app/authorizers/attribute_authorizer.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return redirect_to root_path, notice: "You don't have permission to view that content."
                        Severity: Major
                        Found in app/controllers/content_controller.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return true if ::PermissionService.user_can_contribute_to_containing_universe?(user: user, content: resource)
                          Severity: Major
                          Found in app/authorizers/content_authorizer.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return false
                            Severity: Major
                            Found in app/authorizers/document_authorizer.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                  return true if user.active_promo_codes.any?
                              Severity: Major
                              Found in app/authorizers/extended_content_authorizer.rb - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language