isprambiente/Domando

View on GitHub

Showing 8 of 18 total issues

Function send has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  send(body = '') {
    var options, position, width;
    width = this.element.dataset.modalSize || '90%';
    position = this.element.dataset.modalPosition || 'top';
    options = {
Severity: Minor
Found in app/javascript/controllers/modal_controller.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

    window.addEventListener("click",function(t){if("click->menu#open"!=t.target.getAttribute("data-action")&&"click->section#colShow"!=t.target.getAttribute("data-action")){const e=document.querySelector("#cart_col.quickview"),c=document.querySelector("#filters_col.quickview"),mm=document.querySelector("#menu_col.quickview");null==mm||mm.contains(t.target)||mm.classList.remove("is-active"),null==e||e.contains(t.target)||e.classList.remove("is-active"),null==c||c.contains(t.target)||c.classList.remove("is-active")}t.stopPropagation()});
    Severity: Critical
    Found in app/javascript/controllers/application.js - About 1 hr to fix

      Function slimSelect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        slimSelect(select) {
          if (select.dataset.formAddable === 'true') {
            return new SlimSelect({
              addToBody: true,
              select: `#${select.id}`,
      Severity: Minor
      Found in app/javascript/controllers/form_controller.js - About 1 hr to fix

        Method propose_send has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def propose_send
            @author = propose_params[:author_id].present? ? User.find(propose_params[:author_id]) : ''
            if @author.present? && propose_params[:title].present?
              UserMailer.with(author: @author, propose: propose_params).propose_email.deliver_now
              User.admins.map { |u| FaqMailer.with(user: u, author: @author, propose: propose_params).propose_email.deliver_now }
        Severity: Minor
        Found in app/controllers/home_controller.rb - 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

        Function slimSelect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          slimSelect(select) {
            if (select.dataset.formAddable === 'true') {
              return new SlimSelect({
                addToBody: true,
                select: `#${select.id}`,
        Severity: Minor
        Found in app/javascript/controllers/form_controller.js - 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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def perform(username: '')
            return if Rails.env.test?
        
            users = User.all.order(label: :asc)
            users = users.where(username: username) if username.present?
        Severity: Minor
        Found in app/jobs/users_check_job.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 list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def list
            @filters = filter_params
            @page = params[:page] || 1
            faqs = Faq.accessible_by(current_ability).actived.approved
            @evidences = faqs.evidenced.limit(Settings.faq.max_faqs_in_evidence)
        Severity: Minor
        Found in app/controllers/home_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

        Function send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          send(message, level = 'success', timeout = 2000, toast = true) {
            var options;
            options = {
              toast: level === 'error' ? false : toast,
              icon: level,
        Severity: Minor
        Found in app/javascript/controllers/message_controller.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

        Severity
        Category
        Status
        Source
        Language