qomoteam/qomo

View on GitHub

Showing 66 of 97 total issues

File scholar.py has 851 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python
"""
This module provides classes for querying Google Scholar and parsing
returned results. It currently *only* processes the first results
page. It is not a recursive crawler.
Severity: Major
Found in scripts/scholar.py - About 2 days to fix

    File rails.validations.js has 634 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    /*!
     * Client Side Validations - v5.0.0 (https://github.com/DavyJonesLocker/client_side_validations)
     * Copyright (c) 2016 Geremia Taglialatela, Brian Cardarella
     * Licensed under MIT (http://opensource.org/licenses/mit-license.php)
    Severity: Major
    Found in app/assets/javascripts/rails.validations.js - About 1 day to fix

      File jquery.raty.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * jQuery Raty - A Star Rating Plugin
       *
       * The MIT License
       *
      Severity: Major
      Found in app/assets/javascripts/jquery.raty.js - About 1 day to fix

        Method submit has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
        Open

          def submit(job_name, boxes, conns)
            job_id = SecureRandom.uuid
            job = Job.new id: job_id, user_id: @user_id, name: job_name
        
            result = {
        Severity: Minor
        Found in app/services/job_engine.rb - About 1 day 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 main has a Cognitive Complexity of 40 (exceeds 5 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 6 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 _parse_article has a Cognitive Complexity of 37 (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 5 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 submit has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def submit(job_name, boxes, conns)
            job_id = SecureRandom.uuid
            job = Job.new id: job_id, user_id: @user_id, name: job_name
        
            result = {
        Severity: Major
        Found in app/services/job_engine.rb - About 4 hrs to fix

          Function _parse_links has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              def _parse_links(self, span):
                  for tag in span:
                      if not hasattr(tag, 'name'):
                          continue
                      if tag.name != 'a' or tag.get('href') is None:
          Severity: Minor
          Found in scripts/scholar.py - 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 _parse_article has a Cognitive Complexity of 21 (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 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 input has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              input: function(input) {
                var $form, $input, binding, event, form, ref;
                $input = $(input);
                form = input.form;
                $form = $(form);
          Severity: Major
          Found in app/assets/javascripts/rails.validations.js - About 2 hrs to fix

            Method filetree has a Cognitive Complexity of 18 (exceeds 5 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 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 rating_for has 59 lines of code (exceeds 25 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: Major
            Found in app/helpers/ratyrate_helper.rb - About 2 hrs to fix

              Class ToolsController has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ToolsController < ApplicationController
              
                before_action :authenticate_user!, except: [:index, :search, :show]
              
                def index
              Severity: Minor
              Found in app/controllers/tools_controller.rb - About 2 hrs to fix

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

                      Severity
                      Category
                      Status
                      Source
                      Language