qomoteam/qomo

View on GitHub

Showing 66 of 97 total issues

Function numericality has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      numericality: function(element, options) {
        var CHECKS, check, check_value, fn, form, operator, val;
        val = $.trim(element.val());
        if (!ClientSideValidations.patterns.numericality.test(val)) {
          if (options.allow_blank === true && this.presence(element, {
Severity: Minor
Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

    Function main has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def main():
        usage = """scholar.py [options] <query string>
    A command-line interface to Google Scholar.
    
    Examples:
    Severity: Minor
    Found in scripts/scholar.py - About 1 hr to fix

      Method jstree_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def jstree_response(path, only_dir, selected)
          files = datastore.list path
          files.reject { |e| only_dir and !e.directory? }.collect do |e|
            children = e.directory?
            state = {}
      Severity: Minor
      Found in app/controllers/datastore_controller.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 form has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          form: function(form) {
            var $form, binding, event, ref;
            $form = $(form);
            form.ClientSideValidations = {
              settings: window.ClientSideValidations.forms[$form.attr('id')],
      Severity: Minor
      Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if options.author or options.allw or options.some or options.none \
                   or options.phrase or options.title_only or options.pub \
                   or options.after or options.before:
                    print('Cluster ID queries do not allow additional search arguments.')
                    return 1
        Severity: Critical
        Found in scripts/scholar.py - About 1 hr to fix

          Method contributors_tag has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def contributors_tag(str, link=true)
              str.split(',').map do |c|
                c = c.strip
                if c.start_with? '@'
                  c = c[1..-1]
          Severity: Minor
          Found in app/helpers/application_helper.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 params_ui has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def params_ui
              self.params.collect do |p|
                box = self.boxes[p['box_id']]
                tool = Tool.find box['tool_id']
                p['tool'] = tool
          Severity: Minor
          Found in app/models/pipeline.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 rating_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def rating_for(rateable_obj, dimension=nil, options={})
          
              cached_average = rateable_obj.average dimension
              avg = cached_average ? cached_average.avg : 0
          
          
          Severity: Minor
          Found in app/helpers/ratyrate_helper.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

          Consider simplifying this complex logical expression.
          Open

                  if self.words is None and self.words_some is None \
                     and self.words_none is None and self.phrase is None \
                     and self.author is None and self.pub is None \
                     and self.timeframe[0] is None and self.timeframe[1] is None:
                      raise QueryArgumentError('search query needs more parameters')
          Severity: Critical
          Found in scripts/scholar.py - About 1 hr to fix

            Method cas_login has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def cas_login
                  if user_signed_in?
                    self.resource = current_user
                  else
                    self.resource = warden.authenticate(auth_options)
            Severity: Minor
            Found in app/controllers/concerns/cas_session.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 txt has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def txt(querier, with_globals):
                if with_globals:
                    # If we have any articles, check their attribute labels to get
                    # the maximum length -- makes for nicer alignment.
                    max_label_len = 0
            Severity: Minor
            Found in scripts/scholar.py - 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 inclusion has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  inclusion: function(element, options) {
                    var lower, message, option, ref, upper;
                    message = this.presence(element, options);
                    if (message) {
                      if (options.allow_blank === true) {
            Severity: Minor
            Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

              Method filemeta has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def filemeta(abs_path)
                  if File.directory?(abs_path)
                    kind = :directory
                  else
                    extname = File.extname(abs_path)
              Severity: Minor
              Found in app/services/datastore.rb - About 1 hr to fix

                Function init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    init: function(options) {
                      return this.each(function() {
                        this.self = $(this);
                
                        methods.destroy.call(this.self);
                Severity: Minor
                Found in app/assets/javascripts/jquery.raty.js - About 1 hr to fix

                  Function exclusion has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        exclusion: function(element, options) {
                          var lower, message, option, ref, upper;
                          message = this.presence(element, options);
                          if (message) {
                            if (options.allow_blank === true) {
                  Severity: Minor
                  Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

                    Method read has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def read(path, offset, len)
                        File.open(path) do |file|
                          offset ||= 0
                          len ||= 10.kilobytes
                          content = ''
                    Severity: Minor
                    Found in app/services/reader/text_reader.rb - About 1 hr to fix

                      Method show has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def show
                          unless params[:uid] or current_user
                            redirect_to new_user_session_path
                            return
                          end
                      Severity: Minor
                      Found in app/controllers/datastore_controller.rb - About 1 hr to fix

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

                          def show
                            if params[:user_id]
                              user = User.find_by_username params[:user_id]
                              not_found unless user
                              @tool = Tool.find_by_owner_id_and_slug user.id, params['id']
                        Severity: Minor
                        Found in app/controllers/tools_controller.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 filemeta has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def filemeta(abs_path)
                            if File.directory?(abs_path)
                              kind = :directory
                            else
                              extname = File.extname(abs_path)
                        Severity: Minor
                        Found in app/services/datastore.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 filetree has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def filetree
                            dir = params[:dir]
                            if !dir.blank?
                              username = dir.split(':')[0][1..-1]
                              path = dir.split(':')[1..-1].join('/')
                        Severity: Minor
                        Found in app/controllers/library_controller.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language