qomoteam/qomo

View on GitHub

Showing 97 of 97 total issues

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

  def show
    if params[:user_id]
      user = User.find_by_username params[:user_id]
      not_found unless user
      @pipeline = Pipeline.find_by_owner_id_and_slug user.id, params['id']
Severity: Minor
Found in app/controllers/pipelines_controller.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

Class DatastoreController has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class DatastoreController < ApplicationController

  LIBRARY_ID = '__dataset__library__'

  before_action :authenticate_user!, except: [:filetree, :show, :shared, :download]
Severity: Minor
Found in app/controllers/datastore_controller.rb - About 2 hrs to fix

    Function uniqueness has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          uniqueness: function(element, options) {
            var data, key, message, name, ref, scope_value, scoped_element, scoped_name;
            message = ClientSideValidations.validators.local.presence(element, options);
            if (message) {
              if (options.allow_blank === true) {
    Severity: Major
    Found in app/assets/javascripts/rails.validations.js - About 2 hrs to fix

      Method rating_for_user has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def rating_for_user(rateable_obj, rating_user, dimension = nil, options = {})
          @object = rateable_obj
          @user   = rating_user
            @rating = Rate.find_by_rater_id_and_rateable_id_and_dimension(@user.id, @object.id, dimension)
            stars = @rating ? @rating.stars : 0
      Severity: Major
      Found in app/helpers/ratyrate_helper.rb - About 2 hrs to fix

        Method show has a Cognitive Complexity of 15 (exceeds 5 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

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

            def _parse_article(self, div):
                self.article = ScholarArticle()
        
                for tag in div:
                    if not hasattr(tag, 'name'):
        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 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

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

                      for (var i = 0; i < this.opt.number; i++) {
                        this.stars[i].title = methods._getHint.call(this, i + 1);
                      }
                Severity: Major
                Found in app/assets/javascripts/jquery.raty.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery.raty.js on lines 577..579

                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 67.

                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

                      for (var i = 0; i < this.opt.number; i++) {
                        this.stars[i].title = methods._getHint.call(this, i + 1);
                      }
                Severity: Major
                Found in app/assets/javascripts/jquery.raty.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/jquery.raty.js on lines 465..467

                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 67.

                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

                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
                    Severity
                    Category
                    Status
                    Source
                    Language