Noosfero/noosfero

View on GitHub

Showing 1,031 of 1,643 total issues

Function print has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function print() {
            loadEvents();
            var dWeekDayOfMonthStart = new Date(dYear, dMonth, 1).getDay() - settings.firstDayOfWeek;
            if (dWeekDayOfMonthStart < 0) {
                dWeekDayOfMonthStart = 6 - ((dWeekDayOfMonthStart + 1) * -1);
Severity: Major
Found in plugins/event/public/jquery.e-calendar.js - About 3 hrs to fix

    File boxes_helper.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module BoxesHelper
      include SanitizeHelper
      include ActionView::Helpers::OutputSafetyHelper
    
      def insert_boxes(content)
    Severity: Minor
    Found in app/helpers/boxes_helper.rb - About 3 hrs to fix

      Function matchRecursive has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      XRegExp.matchRecursive = function (str, left, right, flags, options) {
          var options      = options || {},
              escapeChar   = options.escapeChar,
              vN           = options.valueNames,
              flags        = flags || "",

        Function click has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            click: function (event) {
              if (toggle_edit.target.isToggleIgnore(event.target))
                return true;
        
              var value_row = toggle_edit.value_row.locate(event.target);
        Severity: Minor
        Found in plugins/orders/public/javascripts/toggle_edit.js - About 2 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 _move has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            function _move($id, $ref_id, $position = 0, $is_copy = false) {
                if((int)$ref_id === 0 || (int)$id === 1) { return false; }
                $sql        = array();                        // Queries executed at the end
                $node        = $this->_get_node($id);        // Node data
                $nchildren    = $this->_get_children($id);    // Node children

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

            def filter_by_facets(scope, facets)
              queries = []
              facets.each do |term, values|
                kind, klass = term.split("-")
                if kind == "attribute" || kind == "relation" || kind == "metadata"
        Severity: Minor
        Found in plugins/pg_search/lib/pg_search_plugin.rb - About 2 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 presence_of_required_fields has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def presence_of_required_fields
              self.required_fields.each do |field|
                opts = REQUIRED_FIELDS_EXCEPTIONS[field.to_sym] || {}
                if (opts[:cond] ? opts[:cond].call(self) : self.send(field).blank?)
                  unless opts[:unless].try(:call, self)
        Severity: Minor
        Found in app/models/person.rb - About 2 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 approved_themes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def approved_themes(owner)
              Dir.glob(File.join(system_themes_dir, "*")).map do |item|
                next unless File.exists? File.join(item, "theme.yml")
        
                id = File.basename item
        Severity: Minor
        Found in app/models/theme.rb - About 2 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 add has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            add: function( elem, types, handler, data, selector ) {
        
                var elemData, eventHandle, events,
                    t, tns, type, namespaces, handleObj,
                    handleObjIn, handlers, special;

          Class Environment has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Environment
            settings_items :ldap_plugin, type: :hash, default: {}
          
            validates_presence_of :ldap_plugin_host, if: lambda { |env| !env.ldap_plugin.blank? }
          
          
          Severity: Minor
          Found in plugins/ldap/lib/ext/environment.rb - About 2 hrs to fix

            Class UploadedFile has 25 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class UploadedFile < Article
              include UploadSanitizer
              include CroppedImage
            
              attr_accessible :uploaded_data, :title
            Severity: Minor
            Found in app/models/uploaded_file.rb - About 2 hrs to fix

              Class ApproveArticle has 25 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ApproveArticle < Task
                validates_presence_of :requestor_id, :target_id
              
                validates :requestor, kind_of: { kind: Person }
                validate :allowed_requestor
              Severity: Minor
              Found in app/models/approve_article.rb - About 2 hrs to fix

                Class ProfileEditorController has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class ProfileEditorController < MyProfileController
                  protect "edit_profile", :profile, except: [:destroy_profile]
                  protect "destroy_profile", :profile, only: [:destroy_profile]
                
                  skip_before_action :verify_authenticity_token, only: [:google_map]
                Severity: Minor
                Found in app/controllers/my_profile/profile_editor_controller.rb - About 2 hrs to fix

                  Function keydown has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    , keydown: function (e) {
                  
                        if (!this.focused) return
                  
                        var _self = this
                  Severity: Major
                  Found in plugins/fb_app/public/javascripts/bootstrap-tokenfield.js - About 2 hrs to fix

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

                      def create
                        begin
                          @page = profile.articles.find(params[:id])
                        rescue
                          @page = nil
                    Severity: Major
                    Found in app/controllers/public/comment_controller.rb - About 2 hrs to fix

                      Function matcherFromGroupMatchers has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
                          var bySet = setMatchers.length > 0,
                              byElement = elementMatchers.length > 0,
                              superMatcher = function( seed, context, xml, results, expandContext ) {
                                  var elem, j, matcher,

                        Method quantity_price_data has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def quantity_price_data(actor_name)
                            data = { flags: {} }
                            statuses = ::OrdersPlugin::Order::Statuses
                            statuses_data = data[:statuses] = {}
                        
                        
                        Severity: Major
                        Found in plugins/orders/models/orders_plugin/item.rb - About 2 hrs to fix

                          Function createInfoBoxDiv_ has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                          InfoBox.prototype.createInfoBoxDiv_ = function () {
                          
                            var bw;
                            var me = this;
                          
                          
                          Severity: Minor
                          Found in plugins/sniffer/public/javascripts/infobox.js - About 2 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 facets_find_options has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def facets_find_options(facets_selected = {}, options = {})
                                  browses = []
                                  facets_selected ||= {}
                                  facets_selected.map do |id, value|
                                    next unless facets[id.to_sym]
                          Severity: Minor
                          Found in plugins/solr/lib/acts_as_faceted.rb - About 2 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 solr_options has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def solr_options(asset, category)
                              asset_class = asset_class(asset)
                              solr_options = {}
                              if !multiple_search?
                                if !results_only? && asset_class.respond_to?(:facets)
                          Severity: Minor
                          Found in plugins/solr/lib/solr_plugin/search_helper.rb - About 2 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