SpontaneousCMS/spontaneous

View on GitHub

Showing 342 of 342 total issues

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

      def reload!
        rotation do |file, mtime|
          # Retrive the last modified time
          new_file = mtimes[file].nil?
          previous_mtime = mtimes[file] ||= mtime
Severity: Minor
Found in lib/spontaneous/loader.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

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

      def fix_schema(error)
        modification = error.modification
        actions = modification.actions
        say(actions.description, :red)
        say("Please choose one of the solutions below", :yellow)
Severity: Minor
Found in lib/spontaneous/cli.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

Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(owner, name, type, options={}, blocks = [], &block)
Severity: Minor
Found in lib/spontaneous/prototypes/field_prototype.rb - About 45 mins to fix

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

        def combine_shards(hashes, &block)
          hashes = hashes.split(',') unless hashes.is_a?(Array)
          shards = hashes.map { |hash| Spontaneous.shard_path(hash) }
          Tempfile.open('shard') do |combined|
            combined.binmode
    Severity: Minor
    Found in lib/spontaneous/media.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

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

          def field(name, type=nil, options={}, &block)
            if type.is_a?(Hash)
              options = type
              type = nil
            end
    Severity: Minor
    Found in lib/spontaneous/model/core/fields.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

    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(owner, user, created_at, old_visibility_path, new_owner_id, new_box_sid)
    Severity: Minor
    Found in lib/spontaneous/model/core/modifications.rb - About 45 mins to fix

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

            def reload!
              changed_files = []
              rotation do |file, mtime|
                # Retrive the last modified time
                new_file = mtimes[file].nil?
      Severity: Minor
      Found in lib/spontaneous/loader.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

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

                  if (icon) {
                      var img = new Spontaneous.Image(icon);
                      target.append(img.icon(60, 60).click(click));
                  }
      Severity: Minor
      Found in application/js/views/page_piece_view.js and 1 other location - About 45 mins to fix
      application/js/views/piece_view.js on lines 125..128

      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 2 locations. Consider refactoring.
      Open

                  if (icon) {
                      var img = new Spontaneous.Image(icon);
                      wrap.append(img.icon(60, 60).click(click));
                  }
      Severity: Minor
      Found in application/js/views/piece_view.js and 1 other location - About 45 mins to fix
      application/js/views/page_piece_view.js on lines 71..74

      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

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

                                  S.Ajax.test_field_versions(this.content, [this], this.upload_values.bind(this), this.upload_conflict.bind(this));
      Severity: Minor
      Found in application/js/field/image.js and 1 other location - About 40 mins to fix
      application/js/field/file.js on lines 60..60

      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

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

                      link.click(function() {
                          var page = $(this).data('page');
                          S.Location.load_id(page.id);
                          return false;
                      });
      Severity: Minor
      Found in application/js/top_bar.js and 1 other location - About 40 mins to fix
      application/js/top_bar.js on lines 200..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 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

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

                          S.Ajax.test_field_versions(this.content, [this], this.upload_values.bind(this), this.upload_conflict.bind(this));
      Severity: Minor
      Found in application/js/field/file.js and 1 other location - About 40 mins to fix
      application/js/field/image.js on lines 171..171

      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

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

                  var page = this.page, li = dom.li('.ancestor-node'), link = $('<a/>').data('page', page).click(function() {
                      var page = $(this).data('page');
                      S.Location.load_id(page.id);
                      return false;
                  }).text(this.title);
      Severity: Minor
      Found in application/js/top_bar.js and 1 other location - About 40 mins to fix
      application/js/top_bar.js on lines 176..180

      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 makeRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              makeRequest: function(method, url, data, callback, options) {
      Severity: Minor
      Found in application/js/ajax.js - About 35 mins to fix

        Method define_proxy_association has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def define_proxy_association(association, proxy_methods, name, opts = {}, &block)
        Severity: Minor
        Found in lib/spontaneous/data_mapper/content_model/associations.rb - About 35 mins to fix

          Method register has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def register(task_name, task, options = {}, params = {}, env = {})
          Severity: Minor
          Found in lib/spontaneous/simultaneous.rb - About 35 mins to fix

            Method store has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def store(revision, partition, path, template, transaction)
            Severity: Minor
            Found in lib/spontaneous/output/store/backend.rb - About 35 mins to fix

              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def initialize(owner, user, created_at, old_value, new_value)
              Severity: Minor
              Found in lib/spontaneous/model/core/modifications.rb - About 35 mins to fix

                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def initialize(owner, name, options, blocks = [], &block)
                Severity: Minor
                Found in lib/spontaneous/prototypes/box_prototype.rb - About 35 mins to fix

                  Method store has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def store(revision, partition, _path, template, transaction)
                  Severity: Minor
                  Found in lib/spontaneous/output/store/fog.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language