Noosfero/noosfero

View on GitHub

Showing 1,031 of 1,643 total issues

Function panBox_ has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

InfoBox.prototype.panBox_ = function (disablePan) {

  var map;
  var bounds;
  var xOffset = 0, yOffset = 0;
Severity: Minor
Found in plugins/sniffer/public/javascripts/infobox.js - About 3 hrs 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 view_page has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def view_page
    path = get_path(params[:page], params[:format])

    @version = params[:version].to_i
    @npage = params[:npage] || "1"
Severity: Minor
Found in app/controllers/public/content_viewer_controller.rb - About 3 hrs 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 edit has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def edit
    params[:article] ||= {}
    @success_back_to = params[:success_back_to]
    @article = profile.articles.find(params[:id])
    version = params[:version]
Severity: Minor
Found in app/controllers/my_profile/cms_controller.rb - About 3 hrs 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

File order.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class OrdersPlugin::Order < ApplicationRecord
  # if abstract_class is true then it will trigger https://github.com/rails/rails/issues/20871
  # self.abstract_class = true

  Statuses = ::OrdersPlugin::Item::Statuses
Severity: Minor
Found in plugins/orders/models/orders_plugin/order.rb - About 3 hrs to fix

    Method products has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.products(consumer, csv)
        default_product_category = consumer.environment.product_categories.find_by slug: "software-livre"
    
        detection = CharlockHolmes::EncodingDetector.detect csv
        csv = CharlockHolmes::Converter.convert csv, detection[:encoding], "UTF-8"
    Severity: Major
    Found in plugins/suppliers/lib/suppliers_plugin/import.rb - About 3 hrs to fix

      Function defaultPrefilter has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function defaultPrefilter( elem, props, opts ) {
          var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
              anim = this,
              style = elem.style,
              orig = {},

        Function trigger has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            trigger: function( event, data, elem, onlyHandlers ) {
                // Don't do events on text and comment nodes
                if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
                    return;
                }

          File ffmpeg.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rmagick"
          require "yaml"
          
          # Works for ffmpeg version 2.8.6-1~bpo8 shiped by Debian Jessie Backports
          # https://packages.debian.org/jessie-backports/ffmpeg
          Severity: Minor
          Found in plugins/html5_video/lib/video_processor/ffmpeg.rb - About 3 hrs to fix

            Class SearchController has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class SearchController < PublicController
              helper TagsHelper
              include SearchHelper
              include ActionView::Helpers::NumberHelper
              include SanitizeParams
            Severity: Minor
            Found in app/controllers/public/search_controller.rb - About 3 hrs to fix

              Function send has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              send: function( headers, complete ) {
              
                                  // Get a new xhr
                                  var handle, i,
                                      xhr = s.xhr();

                File cart.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                shopping_cart = {
                }
                
                function Cart(config) {
                  var $ = jQuery;
                Severity: Minor
                Found in plugins/shopping_cart/public/cart.js - About 3 hrs to fix

                  Method write has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def write(articles, options = {})
                      result = ""
                      xml = Builder::XmlMarkup.new(target: result)
                  
                      xml.instruct! :xml, version: "1.0"
                  Severity: Minor
                  Found in app/services/feed_writer.rb - About 3 hrs 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 new has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def new
                      # FIXME this method should share some logic with edit !!!
                      @success_back_to = params[:success_back_to]
                      # user must choose an article type first
                  
                  
                  Severity: Minor
                  Found in app/controllers/my_profile/cms_controller.rb - About 3 hrs 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 copyToClipboard has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              copyToClipboard : function(highlighter)
                              {
                                  var flashDiv, flashSwf,
                                      highlighterId = highlighter.id
                                      ;

                    Class CreateEnterprise has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class CreateEnterprise < Task
                      N_("Identifier")
                      N_("Name")
                      N_("Address")
                      N_("Contact phone")
                    Severity: Minor
                    Found in app/models/create_enterprise.rb - About 3 hrs to fix

                      Class Organization has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Organization < Profile
                        include OrganizationHelper
                      
                        attr_accessible :moderated_articles, :foundation_year, :contact_person,
                                        :acronym, :legal_form, :economic_activity, :management_information,
                      Severity: Minor
                      Found in app/models/organization.rb - About 3 hrs to fix

                        File task.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class Task < ApplicationRecord
                          extend ActsAsHavingSettings::ClassMethods
                          acts_as_having_settings field: :data
                        
                          store_accessor :metadata
                        Severity: Minor
                        Found in app/models/task.rb - About 3 hrs to fix

                          Function clean has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              clean: function( elems, context, fragment, scripts ) {
                                  var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
                                      safe = context === document && safeFragment,
                                      ret = [];
                          
                          

                            Method index has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def index
                                return unless load_page_tabs
                            
                                if params[:tabs_added]
                                  @page_tabs = FbAppPlugin::PageTab.create_from_tabs_added params[:tabs_added]

                            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 scopes_to_solr_options has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def scopes_to_solr_options(scope, klass = nil, options = {})
                                  filter_queries = []
                                  klass ||= scope.base_class
                                  solr_fields = klass.configuration[:solr_fields].keys
                                  scopes_applied = scope.scopes_applied.dup rescue [] # rescue association and class direct filtering
                            Severity: Minor
                            Found in plugins/solr/lib/solr_plugin.rb - About 3 hrs 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