rubyberlin/cfp-app

View on GitHub

Showing 46 of 46 total issues

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

  if (next_link.length > 0) {
    if (localStorage.proposal_uuid_table_order !== undefined) {
      var proposal_uuids = JSON.parse(localStorage.proposal_uuid_table_order);
      var current_index = proposal_uuids.indexOf(next_link.data("proposal-uuid"));
      if (current_index + 1 < proposal_uuids.length) {
Severity: Major
Found in app/javascript/staff/program/proposals.js and 1 other location - About 7 hrs to fix
app/javascript/staff/proposals.js on lines 24..39

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

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

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

  if (next_link.length > 0) {
    if (localStorage.proposal_uuid_table_order !== undefined) {
      var proposal_uuids = JSON.parse(localStorage.proposal_uuid_table_order);
      var current_index = proposal_uuids.indexOf(next_link.data("proposal-uuid"));
      if (current_index + 1 < proposal_uuids.length) {
Severity: Major
Found in app/javascript/staff/proposals.js and 1 other location - About 7 hrs to fix
app/javascript/staff/program/proposals.js on lines 21..36

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

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

Class Proposal has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

class Proposal < ApplicationRecord
  include Proposal::State

  has_many :public_comments, dependent: :destroy
  has_many :internal_comments, dependent: :destroy
Severity: Minor
Found in app/models/proposal.rb - About 5 hrs to fix

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

    class ProposalDecorator < ApplicationDecorator
      include Proposal::State
      decorates :proposal
      delegate_all
      decorates_association :speakers
    Severity: Minor
    Found in app/decorators/proposal_decorator.rb - About 4 hrs to fix

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

      class Event < ApplicationRecord
        has_many :teammates, dependent: :destroy
        has_many :staff, through: :teammates, source: :user
        has_many :proposals, dependent: :destroy
        has_many :speakers
      Severity: Minor
      Found in app/models/event.rb - About 4 hrs to fix

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

          function onProposalFormatChange(ev) {
            removePopover('format');
            const $formatSelect = $(this);
            const formatId = $formatSelect.val();
        
        
        Severity: Major
        Found in app/javascript/staff/program/selection.js and 1 other location - About 3 hrs to fix
        app/javascript/staff/program/selection.js on lines 20..29

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

        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

          function onProposalTrackChange(ev) {
            removePopover('track');
            const $trackSelect = $(this);
            const trackId = $trackSelect.val();
            const url = $trackSelect.data('targetPath');
        Severity: Major
        Found in app/javascript/staff/program/selection.js and 1 other location - About 3 hrs to fix
        app/javascript/staff/program/selection.js on lines 31..43

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

        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

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

            {
              stateSaveParams: function () {
                var rows = $('[data-proposal-id]');
                var uuids = [];
                rows.each(function (i, row) {
        Severity: Major
        Found in app/javascript/staff/program/proposals.js and 1 other location - About 3 hrs to fix
        app/javascript/staff/proposals.js on lines 10..20

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

        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

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

              {
                stateSaveParams: function () {
                  var rows = $('[data-proposal-id]');
                  var uuids = [];
                  rows.each(function (i, row) {
        Severity: Major
        Found in app/javascript/staff/proposals.js and 1 other location - About 3 hrs to fix
        app/javascript/staff/program/proposals.js on lines 7..17

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

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

          Class ApplicationController has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationController < ActionController::Base
            include Pundit
            include ActivateNavigation
            rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
            # after_action :verify_authorized, except: :index
          Severity: Minor
          Found in app/controllers/application_controller.rb - About 2 hrs to fix

            Class EventStats has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class EventStats
              attr_reader :event
            
              def initialize(event)
                @event = event
            Severity: Minor
            Found in app/models/event_stats.rb - About 2 hrs to fix

              Class ProgramSession has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class ProgramSession < ApplicationRecord
                LIVE = 'live'.freeze # confirmed accepted
                DRAFT = 'draft'.freeze # created by organizer, not ready to be published (live)
                UNCONFIRMED_ACCEPTED = 'unconfirmed accepted'.freeze # accepted, to be confirmed by speaker
                UNCONFIRMED_WAITLISTED = 'unconfirmed waitlisted'.freeze
              Severity: Minor
              Found in app/models/program_session.rb - About 2 hrs to fix

                Class EventsController has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Staff::EventsController < Staff::ApplicationController
                  before_action :enable_staff_event_subnav
                
                  helper_method :sticky_template_test_email
                
                
                Severity: Minor
                Found in app/controllers/staff/events_controller.rb - About 2 hrs to fix

                  Class TimeSlotDecorator has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Staff::TimeSlotDecorator < Draper::Decorator
                    decorates :time_slot
                    delegate_all
                  
                    def start_time
                  Severity: Minor
                  Found in app/decorators/staff/time_slot_decorator.rb - About 2 hrs to fix

                    Method create_from_proposal has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.create_from_proposal(proposal)
                        transaction do
                          ps = ProgramSession.create!(event_id: proposal.event_id,
                                                      proposal_id: proposal.id,
                                                      title: proposal.title,
                    Severity: Minor
                    Found in app/models/program_session.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

                        $('#time_slot_start_time').timepicker({
                          controlType: 'select',
                          timeFormat: 'h:mm tt',
                          stepMinute: 5,
                          onSelect: function(time) {
                    Severity: Major
                    Found in app/javascript/staff/program/time-slot.js and 1 other location - About 1 hr to fix
                    app/javascript/staff/program/time-slot.js on lines 31..39

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

                    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

                        $('#time_slot_end_time').timepicker({
                          controlType: 'select',
                          timeFormat: 'h:mm tt',
                          stepMinute: 5,
                          onSelect: function(time) {
                    Severity: Major
                    Found in app/javascript/staff/program/time-slot.js and 1 other location - About 1 hr to fix
                    app/javascript/staff/program/time-slot.js on lines 22..30

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

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

                      def incomplete_checklist_items
                        missing_items = []
                    
                        missing_items << "Event must have a url" if url.blank?
                        missing_items << "Event must have a start date" unless start_date
                    Severity: Minor
                    Found in app/models/event.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

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

                      def after_sign_in_path_for(user)
                        if session[:pending_invite_accept_url]
                          session[:pending_invite_accept_url]
                        elsif !user.complete?
                          edit_profile_path
                    Severity: Minor
                    Found in app/controllers/application_controller.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

                    Severity
                    Category
                    Status
                    Source
                    Language