GospelToolbox/Labs

View on GitHub

Showing 10 of 26 total issues

Method refresh has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def refresh
    schedule = {
      service_types: {},
      service_type_teams: {},
      records: {},
Severity: Minor
Found in app/controllers/api/teamschedule/v1/schedule_controller.rb - About 3 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

Method refresh has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def refresh
    schedule = {
      service_types: {},
      service_type_teams: {},
      records: {},
Severity: Major
Found in app/controllers/api/teamschedule/v1/schedule_controller.rb - About 2 hrs to fix

    Function render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const {
          selected,
          organizations
        } = this.state;
    Severity: Minor
    Found in app/javascript/components/OrganizationDropDown.jsx - About 1 hr to fix

      Function connectLaunchpad has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function connectLaunchpad() {
          launchpad = new Launchpad(navigator);
      
          launchpad.onConnect(function() {
            resetLaunchpadColors();
      Severity: Minor
      Found in engines/set_live/app/javascript/packs/sets_show.js - About 1 hr to fix

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

        const NavUserProfile = (props) => {
          const {
            email,
            logout_url
          } = props;
        Severity: Minor
        Found in app/javascript/components/NavUserProfile.jsx - About 1 hr to fix

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

            renderRefreshButton() {
              const {
                has_token,
                organization,
                is_refreshing
          Severity: Minor
          Found in app/javascript/apps/teamschedule/App.jsx - About 1 hr to fix

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

            function generateTeamPositionRowCells(context) {
              const {
                schedule,
                serviceTypeId,
                teamId,
            Severity: Minor
            Found in app/javascript/apps/teamschedule/TeamScheduleTable.jsx - About 1 hr to fix

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

                  def sync
                    @plan = PCO::Plan.find(params[:set_id])
              
                    ids_to_delete = @plan.pco_plan_items.map(&:pco_id).to_a
                    api.plan_items(@plan.pco_service_type.pco_id, @plan.pco_id).each do |item|
              Severity: Minor
              Found in engines/set_live/app/controllers/set_live/sets_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

              Method enumerate_paged_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def enumerate_paged_response(per_page: 25)
                    offset = 0
                    fetch_more = true
              
                    all_data = []
              Severity: Minor
              Found in engines/pco/lib/pco/source_api.rb - 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 save_song has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save_song(song)
                    attrs = song['attributes']
                    
                    song_model = PCO::Song.where(organization_id: @org_id, pco_id: song['id'])
                              .first_or_create
              Severity: Minor
              Found in engines/pco/lib/pco/synchronizer.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