qomoteam/qomo

View on GitHub

Showing 66 of 97 total issues

Function length has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      length: function(element, options) {
        var CHECKS, blankOptions, check, fn, message, operator, tokenized_length, tokenizer;
        tokenizer = options.js_tokenizer || "split('')";
        tokenized_length = new Function('element', "return (element.val()." + tokenizer + " || '').length")(element);
        CHECKS = {
Severity: Minor
Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

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

          uniqueness: function(element, options) {
            var form, matches, name, name_prefix, name_suffix, valid, value;
            name = element.attr('name');
            if (/_attributes\]\[\d/.test(name)) {
              matches = name.match(/^(.+_attributes\])\[\d+\](.+)$/);
    Severity: Minor
    Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

      Method find has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.find(ids) # can accept an array of ids or a single id or a string of ids separated by commas
          param = ids.class == Array ? ids.join(",") : ids
      
          uri = URI.parse("https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=#{param}")
          response = Net::HTTP.get_response(uri)
      Severity: Minor
      Found in app/services/pubmed_api.rb - About 1 hr to fix

        Function get_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_url(self):
                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:
        Severity: Minor
        Found in scripts/scholar.py - About 55 mins 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 empty_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def empty_params
            ep = []
            self.boxes.values.each do |box|
              @tool = Tool.find box['tool_id']
              np = @tool.params
        Severity: Minor
        Found in app/models/pipeline.rb - About 45 mins 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 asset_download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def asset_download
            if params[:release_id]
              release = Release.find params[:release_id]
              not_found unless release
              tool = release.tool
        Severity: Minor
        Found in app/controllers/tools_controller.rb - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                          if ($(this).data('notLocallyUnique')) {
                            return $(this).removeData('notLocallyUnique').data('changed', true);
                          }
        Severity: Major
        Found in app/assets/javascripts/rails.validations.js - About 45 mins to fix

          Method asset_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def asset_delete
              if params[:release_id]
                release = Release.find params[:release_id]
                not_found unless release
                tool = release.tool
          Severity: Minor
          Found in app/controllers/tools_controller.rb - About 45 mins 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def initialize(name, desc, icon='fa-file-o', tpl=:binary, reader=Reader::Reader.new)
          Severity: Minor
          Found in app/services/filetype.rb - About 35 mins to fix

            Function _parse_globals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _parse_globals(self):
                    tag = self.soup.find(name='div', attrs={'id': 'gs_ab_md'})
                    if tag is not None:
                        raw_text = tag.findAll(text=True)
                        # raw text is a list because the body contains <b> etc
            Severity: Minor
            Found in scripts/scholar.py - About 35 mins 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 apply_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def apply_settings(self, settings):
                    """
                    Applies settings as provided by a ScholarSettings instance.
                    """
                    if settings is None or not settings.is_configured():
            Severity: Minor
            Found in scripts/scholar.py - About 35 mins 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 bookmark has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def bookmark
                pipeline = Pipeline.find params[:id]
                not_found unless pipeline
                unauthorized unless pipeline.shared
                unauthorized if current_user.is_guest?
            Severity: Minor
            Found in app/controllers/pipelines_controller.rb - About 35 mins 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_user has a Cognitive Complexity of 7 (exceeds 5 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: Minor
            Found in app/helpers/ratyrate_helper.rb - About 35 mins 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                build_resource(sign_up_params)
            
                if verify_rucaptcha?(resource)
                  resource.save
            Severity: Minor
            Found in app/controllers/users/registrations_controller.rb - About 35 mins 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 bookmark has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def bookmark
                tool = Tool.find params[:id]
                not_found unless tool
                unauthorized unless tool.shared
                unauthorized if current_user.is_guest?
            Severity: Minor
            Found in app/controllers/tools_controller.rb - About 35 mins 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

            Avoid too many return statements within this function.
            Open

                      return options.message;
            Severity: Major
            Found in app/assets/javascripts/rails.validations.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return False
              Severity: Major
              Found in scripts/scholar.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return options.messages.odd;
                Severity: Major
                Found in app/assets/javascripts/rails.validations.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return options.messages.even;
                  Severity: Major
                  Found in app/assets/javascripts/rails.validations.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return;
                    Severity: Major
                    Found in app/assets/javascripts/rails.validations.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language