Association-Merci-Edgar/Merci-Edgar

View on GitHub

Showing 159 of 364 total issues

Method col_sep has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def col_sep
    return @col_sep if @col_sep.present?
    File.open(csv_path, "r:#{file_encoding}") do |io|
      first_line = io.gets
      return nil unless first_line
Severity: Minor
Found in app/models/spreadsheet_file.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @import = ContactsImport.find(params[:id])
    raise "Operation impossible " if @import.user != current_user || @import.account != current_account
    @import.account = current_account
    @import.test_mode = (params[:commit] == t('helpers.submit.contacts_import.test'))
Severity: Minor
Found in app/controllers/contacts_imports_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    if current_account.in_trial_period?
      if current_account.trial_period_ended_in_less_than_one_week?
        @membership_warning = t('notices.subscriptions.trial_period_lasts_soon_html',
          end_trial_period: l(current_account.trial_period_lasts_at),
Severity: Minor
Found in app/controllers/announcements_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 _this.end();
Severity: Major
Found in app/assets/javascripts/appli/bootstrap-tour.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                        return new $googlemaps.LatLng(selectedToCenter.latitude, selectedToCenter.longitude);
    Severity: Major
    Found in app/assets/javascripts/onepage/jquery.gmap.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return center;
      Severity: Major
      Found in app/assets/javascripts/onepage/jquery.gmap.js - About 30 mins to fix

        Method internat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.internat(phone_number,country)
            unless phone_number.starts_with?('+')
              c = Country.new(country)
              phone_number = "#{c.country_code}#{phone_number}" unless phone_number.starts_with?(c.country_code)
            end
        Severity: Minor
        Found in app/models/phone.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            self.resource = warden.authenticate!(auth_options)
            if Account.current_id.nil? || Account.current_id == 0
              Account.current_id = resource.accounts.first.id
            end
        Severity: Minor
        Found in app/controllers/sessions_controller.rb - About 25 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 set_contact_criteria has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def set_contact_criteria
            self.build_structure unless structure.present?
            self.structure.build_contact unless structure.contact.present?
            contact = structure.contact
        
        
        Severity: Minor
        Found in app/models/show_buyer.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            user = User.find_by_email(params[:abilitation][:user_attributes][:email])
            if user
              params[:abilitation].delete(:user_attributes)
              params[:abilitation][:user_id] = user.id
        Severity: Minor
        Found in app/controllers/abilitations_controller.rb - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            @user = User.find(params[:id])
            if current_user != @user
              authorize! :update, @user, :message => 'Not authorized as an administrator.'
              if @user.update_attributes(params[:user], :as => :admin)
        Severity: Minor
        Found in app/controllers/users_controller.rb - About 25 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 loadSocial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function loadSocial() {
        
            //Twitter
            if (typeof (twttr) != 'undefined') {
              twttr.widgets.load();
        Severity: Minor
        Found in app/assets/javascripts/multipage/application.js - About 25 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 add_user_to_mailchimp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def add_user_to_mailchimp
            return if Rails.env == 'development' || email.include?(ENV['ADMIN_EMAIL'])
            mailchimp = Gibbon::API.new
            result = mailchimp.list_subscribe({
              :id => ENV['MAILCHIMP_LIST_ID'],
        Severity: Minor
        Found in app/models/user.rb - About 25 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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            init: function() {
                    var lnks = document.getElementsByTagName('a');   
                    for(var i = 0, lnk; lnk = lnks[i]; i++) {   
                        if ((lnk.href && lnk.href.indexOf('#') != -1) &&  ( (lnk.pathname == location.pathname) ||
                        ('/'+lnk.pathname == location.pathname) ) && (lnk.search == location.search)) {  
        Severity: Minor
        Found in app/assets/javascripts/multipage/tinyscrolling.js - About 25 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 from_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.from_csv(row)
            structure = Structure.new
            people = {}
            row.keys.each do |key|
              elements = key.to_s.split('_')
        Severity: Minor
        Found in app/models/structure.rb - About 25 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 scroll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            scroll: function(){
                    var top  = tinyScrolling.getScrollTop();
                    if(tinyScrolling.requestedY > top) {  
                        var endDistance = Math.round((tinyScrolling.getDocumentHeight() - (top + tinyScrolling.getWindowHeight())) / tinyScrolling.brakeK);
                        endDistance = Math.min(Math.round((tinyScrolling.requestedY-top)/ tinyScrolling.brakeK), endDistance);
        Severity: Minor
        Found in app/assets/javascripts/multipage/tinyscrolling.js - About 25 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 set_scheduler_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def set_scheduler_function
            if scheduler.present?
              self.show_buyer.present? ? s = self.show_buyer.structure : s = self.show_host.structure
              ps = s.people_structures.where(title:"Programmateur", person_id: scheduler.id).first_or_initialize
              if ps.new_record?
        Severity: Minor
        Found in app/models/scheduling.rb - About 25 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 loadSocial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function loadSocial() {
        
            //Twitter
            if (typeof (twttr) != 'undefined') {
              twttr.widgets.load();
        Severity: Minor
        Found in app/assets/javascripts/onepage/application.js - About 25 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 set_contact_criteria has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def set_contact_criteria
            self.build_structure unless structure.present?
            self.structure.build_contact unless structure.contact.present?
            contact = structure.contact
        
        
        Severity: Minor
        Found in app/models/festival.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language