gitcoinco/code_fund_ads

View on GitHub

Showing 211 of 211 total issues

File theme.js has 1273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import StackedMenu from './stacked-menu'
import PerfectScrollbar from 'perfect-scrollbar'
import lozad from 'lozad'

class Theme {
Severity: Major
Found in app/javascript/themes/current/components/theme.js - About 3 days to fix

    Theme has 87 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Theme {
      constructor () {
        // looper color scheme refer from our _variable-bs-overrides.scss
        this.colors = {
          black: '#14141F',
    Severity: Major
    Found in app/javascript/themes/current/components/theme.js - About 1 day to fix

      Method to_tsvectors has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_tsvectors
          []
            .then { |result| remote? ? result << make_tsvector("remote", weight: "A") : result }
            .then { |result| keywords.blank? ? result : keywords.each_with_object(result) { |tag, memo| memo << make_tsvector(tag, weight: "A") } }
            .then { |result| job_type.blank? ? result : result << make_tsvector(job_type, weight: "B") }
      Severity: Minor
      Found in app/models/job_posting.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

      Class Campaign has 51 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Campaign < ApplicationRecord
        # extends ...................................................................
        # includes ..................................................................
        include Campaigns::Budgetable
        include Campaigns::Impressionable
      Severity: Major
      Found in app/models/campaign.rb - About 7 hrs to fix

        File campaign.rb has 426 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Campaign < ApplicationRecord
          # extends ...................................................................
          # includes ..................................................................
          include Campaigns::Budgetable
          include Campaigns::Impressionable
        Severity: Minor
        Found in app/models/campaign.rb - About 6 hrs to fix

          File stacked-menu.js has 422 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * A flexible stacked navigation menu.
           * @class
           *
           * @example <caption>The StackedMenu basic template looks like:</caption>
          Severity: Minor
          Found in app/javascript/themes/current/components/stacked-menu.js - About 6 hrs to fix

            Class AdvertisementsController has 36 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class AdvertisementsController < ApplicationController
              include Untrackable
            
              protect_from_forgery except: :show
              before_action :set_cors_headers
            Severity: Minor
            Found in app/controllers/advertisements_controller.rb - About 4 hrs to fix

              Function maskInput has 98 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                maskInput () {
                  if (window.vanillaTextMask) {
                    $('[data-mask]').each(function () {
                      const selector = this
                      const options = $(selector).data()
              Severity: Major
              Found in app/javascript/themes/current/components/theme.js - About 3 hrs to fix

                StackedMenu has 31 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export default class StackedMenu {
                  /**
                   * Create a StackedMenu.
                   * @constructor
                   * @param  {Object} options - An object containing key:value that representing the current StackedMenu.
                Severity: Minor
                Found in app/javascript/themes/current/components/stacked-menu.js - About 3 hrs to fix

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

                    _off (el, type, handler) {
                      let types = type.split(' ')
                      for (let i = 0; i < types.length; i++) {
                        el[window.removeEventListener ? 'removeEventListener' : 'detachEvent'](
                          window.removeEventListener ? types[i] : `on${types[i]}`,
                  Severity: Major
                  Found in app/javascript/themes/current/components/stacked-menu.js and 1 other location - About 3 hrs to fix
                  app/javascript/themes/current/components/stacked-menu.js on lines 240..249

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

                  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

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

                    _on (el, type, handler) {
                      let types = type.split(' ')
                      for (let i = 0; i < types.length; i++) {
                        el[window.addEventListener ? 'addEventListener' : 'attachEvent'](
                          window.addEventListener ? types[i] : `on${types[i]}`,
                  Severity: Major
                  Found in app/javascript/themes/current/components/stacked-menu.js and 1 other location - About 3 hrs to fix
                  app/javascript/themes/current/components/stacked-menu.js on lines 259..268

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

                  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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    def property_revenue(start_date, end_date = nil, scoped_by: nil, fresh: false)
                      start_date = Date.coerce(start_date)
                      end_date = Date.coerce(end_date || start_date)
                      key = "#{cache_key}/#{__method__}/#{start_date.iso8601}-#{end_date.iso8601}/#{scoped_by&.cache_key}"
                      cents = fetch_from_cache(key, force: fresh) {
                  Severity: Major
                  Found in app/models/concerns/impressionable.rb and 2 other locations - About 3 hrs to fix
                  app/models/concerns/impressionable.rb on lines 60..76
                  app/models/concerns/impressionable.rb on lines 98..114

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

                  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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    def house_revenue(start_date, end_date = nil, scoped_by: nil, fresh: false)
                      start_date = Date.coerce(start_date)
                      end_date = Date.coerce(end_date || start_date)
                      key = "#{cache_key}/#{__method__}/#{start_date.iso8601}-#{end_date.iso8601}/#{scoped_by&.cache_key}"
                      cents = fetch_from_cache(key, force: fresh) {
                  Severity: Major
                  Found in app/models/concerns/impressionable.rb and 2 other locations - About 3 hrs to fix
                  app/models/concerns/impressionable.rb on lines 60..76
                  app/models/concerns/impressionable.rb on lines 79..95

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

                  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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    def gross_revenue(start_date, end_date = nil, scoped_by: nil, fresh: false)
                      start_date = Date.coerce(start_date)
                      end_date = Date.coerce(end_date || start_date)
                      key = "#{cache_key}/#{__method__}/#{start_date.iso8601}-#{end_date.iso8601}/#{scoped_by&.cache_key}"
                      cents = fetch_from_cache(key, force: fresh) {
                  Severity: Major
                  Found in app/models/concerns/impressionable.rb and 2 other locations - About 3 hrs to fix
                  app/models/concerns/impressionable.rb on lines 79..95
                  app/models/concerns/impressionable.rb on lines 98..114

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

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

                    def create
                      return render_forbidden unless authorized_user.can_purchase_job_posting?(@job_posting)
                  
                      if params[:source_id].blank?
                        flash.now[:error] = "Payment info not submitted! Please try again."
                  Severity: Minor
                  Found in app/controllers/job_posting_purchases_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 Property has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Property < ApplicationRecord
                    # extends ...................................................................
                  
                    # includes ..................................................................
                    include Properties::Chartable
                  Severity: Minor
                  Found in app/models/property.rb - About 2 hrs to fix

                    Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (api) {
                      var validEnv = ['development', 'test', 'production']
                      var currentEnv = api.env()
                      var isDevelopmentEnv = api.env('development')
                      var isProductionEnv = api.env('production')
                    Severity: Major
                    Found in babel.config.js - About 2 hrs to fix

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                        colorpicker () {
                          if ($.fn.colorpicker) {
                            $('[data-toggle="colorpicker"]').each(function () {
                              const selector = this
                              const options = $(selector).data()
                      Severity: Major
                      Found in app/javascript/themes/current/components/theme.js and 2 other locations - About 2 hrs to fix
                      app/javascript/themes/current/components/theme.js on lines 1158..1167
                      app/javascript/themes/current/components/theme.js on lines 1296..1305

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

                      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

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                        nestable () {
                          if ($.fn.nestable) {
                            $('[data-toggle="nestable"]').each(function () {
                              const selector = this
                              const options = $(selector).data()
                      Severity: Major
                      Found in app/javascript/themes/current/components/theme.js and 2 other locations - About 2 hrs to fix
                      app/javascript/themes/current/components/theme.js on lines 1296..1305
                      app/javascript/themes/current/components/theme.js on lines 1399..1408

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

                      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

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                        atwho () {
                          if ($.fn.atwho) {
                            $('[data-toggle="atwho"]').each(function () {
                              const selector = this
                              const options = $(selector).data()
                      Severity: Major
                      Found in app/javascript/themes/current/components/theme.js and 2 other locations - About 2 hrs to fix
                      app/javascript/themes/current/components/theme.js on lines 1158..1167
                      app/javascript/themes/current/components/theme.js on lines 1399..1408

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language