gitcoinco/code_fund_ads

View on GitHub

Showing 211 of 211 total issues

Method perform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform(*tags)
    ScoutApm::Transaction.ignore! if rand > (ENV["SCOUT_SAMPLE_RATE"] || 1).to_f
    @count = 0
    @jobs = []

Severity: Minor
Found in app/jobs/import_remoteok_jobs_job.rb - About 1 hr to fix

    Function tribute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      tribute () {
        if (window.Tribute) {
          $('[data-toggle="tribute"]').each(function () {
            const selector = this
            const options = $(selector).data()
    Severity: Minor
    Found in app/javascript/themes/current/components/theme.js - About 1 hr to fix

      Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function init (element) {
        jQuery(element).daterangepicker({
          ranges: {
            'Next 30 Days': [moment(), moment().add(29, 'days')],
            'This Month': [moment().startOf('month'), moment().endOf('month')],
      Severity: Minor
      Found in app/javascript/controllers/select_date_range_controller.js - About 1 hr to fix

        Function perform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          perform () {
            if (!this.visible) {
              console.log(
                `CodeFund container element not visible! Please verify an element exists (and is visible) that matches the CSS selector "${this.selector}"`
              )
        Severity: Minor
        Found in app/javascript/advertisements/index.js - About 1 hr to fix

          Method user_params has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def user_params
              params.require(:user).permit(
                :address_1,
                :address_2,
                :avatar,
          Severity: Minor
          Found in app/controllers/users_controller.rb - About 1 hr to fix

            Function fetchResults has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              fetchResults () {
                const query = this.inputTarget.value.trim()
                if (!query) {
                  this.resultsTarget.hidden = true
                  return
            Severity: Minor
            Found in app/javascript/controllers/search_autocomplete_controller.js - About 1 hr to fix

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

                def index
                  @summary = @campaign.summary(@start_date, @end_date)
                  reports = @campaign.daily_summary_reports_by_creative(@start_date, @end_date).unscope(:order)
                  @pagy, @reports = pagy(reports)
              
              
              Severity: Major
              Found in app/controllers/campaign_creatives_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/campaign_dailies_controller.rb on lines 7..18

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

              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

                def index
                  @summary = @campaign.summary(@start_date, @end_date)
                  daily_summaries = @campaign.daily_summaries_by_day(@start_date, @end_date).unscope(:order)
                  @pagy, @daily_summaries = pagy(daily_summaries)
              
              
              Severity: Major
              Found in app/controllers/campaign_dailies_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/campaign_creatives_controller.rb on lines 7..18

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

              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

              Function objectFitFallback has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                objectFitFallback () {
                  if (this.isIE() || this.isEdge()) {
                    const selectors = [
                      '.user-avatar img',
                      '.tile > img',
              Severity: Minor
              Found in app/javascript/themes/current/components/theme.js - About 1 hr to fix

                Method property_report has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def property_report(start = nil, stop = nil)
                      rows = []
                      rows << [
                        "ID",
                        "Name",
                Severity: Minor
                Found in app/models/concerns/campaigns/reportable.rb - About 1 hr to fix

                  Function constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    constructor (options) {
                      /**
                       * The StackedMenu options.
                       * @type {Object}
                       * @property {Boolean} compact=false                  - Transform StackedMenu items (except item childs) to small size.
                  Severity: Minor
                  Found in app/javascript/themes/current/components/stacked-menu.js - 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

                  Method noty_flash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def noty_flash
                      flash_messages = []
                      flash.each do |type, message|
                        next unless message.is_a? String
                        type = "success" if type == "notice"
                  Severity: Minor
                  Found in app/helpers/application_helper.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

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

                    def index
                      @summary = @campaign.summary(@start_date, @end_date)
                      reports = @campaign.daily_summary_reports_by_property(@start_date, @end_date)
                      @pagy, @reports = pagy_arel(reports)
                  
                  
                  Severity: Major
                  Found in app/controllers/campaign_properties_controller.rb and 1 other location - About 1 hr to fix
                  app/controllers/campaign_countries_controller.rb on lines 7..18

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

                  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

                    def index
                      @summary = @campaign.summary(@start_date, @end_date)
                      reports = @campaign.daily_summary_reports_by_country_code(@start_date, @end_date)
                      @pagy, @reports = pagy_arel(reports)
                  
                  
                  Severity: Major
                  Found in app/controllers/campaign_countries_controller.rb and 1 other location - About 1 hr to fix
                  app/controllers/campaign_properties_controller.rb on lines 8..19

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

                  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

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

                    updateProvinceCodeOptions (event) {
                      if (event && event.type === 'keyup' && event.key !== 'Enter') return
                      if (
                        event &&
                        event.type === 'cf:select:changed' &&
                  Severity: Minor
                  Found in app/javascript/controllers/select_geo_targets_controller.js - About 1 hr to fix

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

                      publisher () {
                        $(document)
                          .on('focusin', '.publisher .form-control', function () {
                            const $publisher = $(this).parents('.publisher')
                    
                    
                    Severity: Minor
                    Found in app/javascript/themes/current/components/theme.js - About 1 hr to fix

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

                        def job_posting_params
                          params.require(:job_posting).permit(
                            :company_name,
                            :company_url,
                            :company_email,
                      Severity: Minor
                      Found in app/controllers/job_posting_prospects_controller.rb - About 1 hr to fix

                        Function closeMenu has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          closeMenu (el, emiter = true) {
                            const self = this
                            let blockedSlide = this._isLevelMenu(el) && this.isCompact()
                            // open menu
                            if (this.isHoverable() || blockedSlide) {
                        Severity: Minor
                        Found in app/javascript/themes/current/components/stacked-menu.js - About 1 hr to fix

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

                            def index
                              if params[:manage_scope]
                                job_postings = JobPosting.where(user: current_user).order(start_date: :desc)
                              else
                                job_postings = JobPosting.active.ranked_by_source.order(start_date: :desc)
                          Severity: Minor
                          Found in app/controllers/job_postings_controller.rb - About 1 hr to fix

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

                              def campaign_params
                                return advertiser_campaign_params if !authorized_user.can_admin_system? && @campaign.fixed_ecpm
                                return extended_advertiser_campaign_params unless authorized_user.can_admin_system?
                                sanitize_params(:campaign, params).require(:campaign).permit(
                                  :daily_budget,
                            Severity: Minor
                            Found in app/controllers/campaigns_controller.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language