SpontaneousCMS/spontaneous

View on GitHub

Showing 261 of 342 total issues

Method include_page? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def include_page?(page)
      return true unless page.page?
      unless @exclude_pages.nil?
        rejected = @exclude_pages.any? { |selector| match_page(selector, page) }
        return false if rejected
Severity: Minor
Found in lib/spontaneous/search/index.rb - About 1 hr 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 fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def fields
      field_lists = Hash.new { |h, k| h[k] = [] }
      # collect all the definitions for a particular field or group
      all_types.select { |t| include_type?(t) }.each do |type|
        type.field_prototypes.each do |prototype|
Severity: Minor
Found in lib/spontaneous/search/index.rb - About 1 hr 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 smush! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def smush!
      p src_file
      return if ::Spontaneous.development?
      ext = @format.nil? ? File.extname(src_file) : ".#{@format}"
      id = [Time.now.to_i, Time.now.usec].join('-')
Severity: Minor
Found in lib/spontaneous/utils/smush_it.rb - About 1 hr 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 init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def init(options={})
        @@semaphore.synchronize do
          self.environment = (options.delete(:environment) || ENV["SPOT_ENV"] || :development)
          self.mode = options.delete(:mode) || ENV["SPOT_MODE"] || :back
          root = options.delete(:root) || ENV["SPOT_ROOT"] || Dir.pwd
Severity: Minor
Found in lib/spontaneous/plugins/application/state.rb - About 1 hr 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 append_features has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def append_features(base)
      if base.instance_variable_defined?("@_dependencies")
        base.instance_variable_get("@_dependencies") << self
        return false
      else
Severity: Minor
Found in lib/spontaneous/concern.rb - About 1 hr 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 Boolean has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Spontaneous.Field.Boolean = (function($, S) {
    var dom = S.Dom
        , _unprocessed_value_ = 'unprocessed_value';

    var BooleanField = new JS.Class(Spontaneous.Field.String, {
Severity: Minor
Found in application/js/field/boolean.js - About 1 hr to fix

    Method application has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.application(site = ::Spontaneous.instance)
            ::Rack::Builder.new do
              site.back_controllers.each do |namespace, controller|
                map(namespace) do
                  use Scope::Edit, site
    Severity: Minor
    Found in lib/spontaneous/rack/back.rb - About 1 hr to fix

      Function on_select has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              on_select: function(event) {
                  var input = this.input(), toolbar = this.popupToolbar(), state = TextCommand.get_state(input);
                  $.each(this.commands, function() {
                      this.respond_to_selection(state);
                  });
      Severity: Minor
      Found in application/js/field/markdown.js - About 1 hr to fix

        Function insert_entry has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                insert_entry: function(entry, position) {
                    this.trigger('entry_added', entry, position);
                    var entries = this.entries()
                    , w = this.entry_wrappers()
                    , e = this.view_for_entry(entry)
        Severity: Minor
        Found in application/js/views/box_view.js - About 1 hr to fix

          Function getSelectionPosition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                              getSelectionPosition: function() {
                                  var cal = calculator, self = this, element = self[0], elementOffset = self.offset();
          
                                  cal.simulator.empty();
                                  // clone primary styles to imitate textarea
          Severity: Minor
          Found in application/js/jquery-selection-position.js - About 1 hr to fix

            Method application has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def self.application(site = ::Spontaneous.instance)
                    ::Rack::Builder.new do
                      use Scope::Front, site
                      use Spontaneous::Rack::Static, root: Spontaneous.revision_dir / 'public', urls: %w[/], try: ['.html', 'index.html', '/index.html']
            
            
            Severity: Minor
            Found in lib/spontaneous/rack/front.rb - About 1 hr to fix

              Function parse_selector has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      parse_selector: function(selector) {
                          var p, id = '', classes = [], result = {};
                          selector = selector || '';
                          if (typeof selector === 'string') {
                              p = selector.split('.');
              Severity: Minor
              Found in application/js/dom.js - About 1 hr to fix

                Function drop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            var drop = function(event) {
                                event.stopPropagation();
                                event.preventDefault();
                                dropper.removeClass('drop-active').addClass('uploading');
                                var files = event.dataTransfer.files;
                Severity: Minor
                Found in application/js/field/image.js - About 1 hr to fix

                  Method parse_response has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def parse_response(response)
                          case
                          when response.is_a?(site.model)
                            @page = response
                          when response.respond_to?(:to_str)
                  Severity: Minor
                  Found in lib/spontaneous/rack/public.rb - About 1 hr to fix

                    Method load_classes_with_requirements has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def load_classes_with_requirements(klasses)
                          klasses.uniq!
                    
                          while klasses.size > 0
                            # Note size to make sure things are loading
                    Severity: Minor
                    Found in lib/spontaneous/loader.rb - About 1 hr to fix

                      Method validate! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def validate!
                              begin
                                validate_schema
                              rescue Spontaneous::SchemaModificationError => e
                                changes = e.modification
                      Severity: Minor
                      Found in lib/spontaneous/schema.rb - About 1 hr to fix

                        Function Editing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        Spontaneous.Editing = (function($, S) {
                            var dom = S.Dom, Page = S.Page;
                        
                            var Editing = new JS.Singleton({
                                include: Spontaneous.Properties,
                        Severity: Minor
                        Found in application/js/editing.js - About 55 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 render_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def render_path(path)
                                @template_params = {}
                                find_page!(path)
                        
                                response = catch(:halt) do
                        Severity: Minor
                        Found in lib/spontaneous/rack/public.rb - About 55 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 render! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def render!(output, params, parent_context)
                              # See `spontaneous/output/store/transaction.rb` for the `store_output`
                              # clauses that explain this reasoning...
                              if output.protected?
                                # We can be sure that if the output says it's protected then it'll be
                        Severity: Minor
                        Found in lib/spontaneous/output/template/renderer.rb - About 55 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 find_target has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def find_target
                                case @category
                                when :type
                                  begin
                                    @name.constantize
                        Severity: Minor
                        Found in lib/spontaneous/schema/uid.rb - About 55 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