consul/consul

View on GitHub

Showing 2,521 of 2,521 total issues

Function draw has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  ProposalGraph.prototype.draw = function() {
    var colors = {},
      maximumValue = this.maximumValue === 0 ? this.proposalSuccess : Math.round(this.maximumValue * 1.10);

    this.formatXColumnValues();
Severity: Major
Found in app/assets/javascripts/dashboard_graphs.js - About 2 hrs to fix

    Class ProposalsController has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ProposalsController < ApplicationController
      include FeatureFlags
      include CommentableActions
      include FlagActions
      include ImageAttributes
    Severity: Minor
    Found in app/controllers/proposals_controller.rb - About 2 hrs to fix

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

        describe "#open?" do
          it "checks draft publication" do
            # future
            process.update!(draft_publication_date: Date.current + 2.days)
            expect(process.draft_publication.open?).to be false
      Severity: Major
      Found in spec/models/legislation/process/publication_spec.rb and 1 other location - About 2 hrs to fix
      spec/models/legislation/process/publication_spec.rb on lines 22..48

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

      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

        describe "#started?" do
          it "checks draft publication" do
            # future
            process.update!(draft_publication_date: Date.current + 2.days)
            expect(process.draft_publication.started?).to be false
      Severity: Major
      Found in spec/models/legislation/process/publication_spec.rb and 1 other location - About 2 hrs to fix
      spec/models/legislation/process/publication_spec.rb on lines 52..78

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

      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

        ProposalGraph.prototype.refreshAchievements = function() {
          return $.ajax({
            url: this.proposalAchievementsUrl,
            cache: false,
            success: function(data) {
      Severity: Major
      Found in app/assets/javascripts/dashboard_graphs.js and 2 other locations - About 2 hrs to fix
      app/assets/javascripts/dashboard_graphs.js on lines 53..64
      app/assets/javascripts/dashboard_graphs.js on lines 84..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 91.

      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

        ProposalGraph.prototype.refreshData = function() {
          return $.ajax({
            url: this.url,
            cache: false,
            success: function(data) {
      Severity: Major
      Found in app/assets/javascripts/dashboard_graphs.js and 2 other locations - About 2 hrs to fix
      app/assets/javascripts/dashboard_graphs.js on lines 84..95
      app/assets/javascripts/dashboard_graphs.js on lines 110..121

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

      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

        ProposalGraph.prototype.refreshSuccessfulData = function() {
          return $.ajax({
            url: this.successfulProposalDataUrl,
            cache: false,
            success: function(data) {
      Severity: Major
      Found in app/assets/javascripts/dashboard_graphs.js and 2 other locations - About 2 hrs to fix
      app/assets/javascripts/dashboard_graphs.js on lines 53..64
      app/assets/javascripts/dashboard_graphs.js on lines 110..121

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

      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

            $("[data-check-all]").on("click", function(e) {
              var target_name;
              e.preventDefault();
              e.stopPropagation();
              target_name = $(this).data("check-all");
      Severity: Major
      Found in app/assets/javascripts/check_all_none.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/check_all_none.js on lines 12..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 90.

      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

            $("[data-check-none]").on("click", function(e) {
              var target_name;
              e.preventDefault();
              e.stopPropagation();
              target_name = $(this).data("check-none");
      Severity: Major
      Found in app/assets/javascripts/check_all_none.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/check_all_none.js on lines 5..11

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

      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

      File settings_spec.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "rails_helper"
      
      describe "Admin settings", :admin do
        scenario "Index" do
          visit admin_settings_path
      Severity: Minor
      Found in spec/system/admin/settings_spec.rb - About 2 hrs to fix

        File admin.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        namespace :admin do
          root to: "dashboard#index"
          resources :organizations, only: :index do
            get :search, on: :collection
            member do
        Severity: Minor
        Found in config/routes/admin.rb - About 2 hrs to fix

          File user_segments_spec.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rails_helper"
          
          describe UserSegments do
            let(:user1) { create(:user) }
            let(:user2) { create(:user) }
          Severity: Minor
          Found in spec/lib/user_segments_spec.rb - About 2 hrs to fix

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

                initializeMap: function(element) {
                  var createMarker, editable, investmentsMarkers, map, marker, markerClustering,
                    markerData, markerIcon, markers, moveOrPlaceMarker, removeMarker, removeMarkerSelector;
                  App.Map.cleanInvestmentCoordinates(element);
                  removeMarkerSelector = $(element).data("marker-remove-selector");
            Severity: Major
            Found in app/assets/javascripts/map.js - About 2 hrs to fix

              File votes_spec.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "rails_helper"
              
              describe "Votes" do
                let!(:verified)   { create(:user, verified_at: Time.current) }
                let!(:unverified) { create(:user) }
              Severity: Minor
              Found in spec/system/votes_spec.rb - About 2 hrs to fix

                File activity_spec.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require "rails_helper"
                
                describe "Admin activity" do
                  let(:admin) { create(:administrator) }
                
                
                Severity: Minor
                Found in spec/system/admin/activity_spec.rb - About 2 hrs to fix

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

                    context "Debate comments" do
                      let(:user)   { create(:user, email_on_comment: true) }
                      let(:debate) { create(:debate, author: user) }
                  
                      scenario "Send email on debate comment" do
                  Severity: Major
                  Found in spec/system/emails_spec.rb and 2 other locations - About 2 hrs to fix
                  spec/system/emails_spec.rb on lines 42..66
                  spec/system/emails_spec.rb on lines 155..179

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

                  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

                    context "Proposal comments" do
                      let(:user)     { create(:user, email_on_comment: true) }
                      let(:proposal) { create(:proposal, author: user) }
                  
                      scenario "Send email on proposal comment" do
                  Severity: Major
                  Found in spec/system/emails_spec.rb and 2 other locations - About 2 hrs to fix
                  spec/system/emails_spec.rb on lines 70..94
                  spec/system/emails_spec.rb on lines 155..179

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

                  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

                      describe "#prev_phase_dates_valid?" do
                        let(:error) do
                          "Start date must be later than the start date of the previous enabled phase (Information)"
                        end
                  
                  
                  Severity: Major
                  Found in spec/models/budget/phase_spec.rb and 1 other location - About 2 hrs to fix
                  spec/models/budget/phase_spec.rb on lines 93..121

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

                  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

                      describe "#next_phase_dates_valid?" do
                        let(:error) do
                          "End date must be earlier than the end date of the next enabled phase (Accepting projects)"
                        end
                  
                  
                  Severity: Major
                  Found in spec/models/budget/phase_spec.rb and 1 other location - About 2 hrs to fix
                  spec/models/budget/phase_spec.rb on lines 61..89

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

                  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

                    context "Poll comments" do
                      let(:user) { create(:user, email_on_comment: true) }
                      let(:poll) { create(:poll, author: user) }
                  
                      scenario "Send email on poll comment" do
                  Severity: Major
                  Found in spec/system/emails_spec.rb and 2 other locations - About 2 hrs to fix
                  spec/system/emails_spec.rb on lines 42..66
                  spec/system/emails_spec.rb on lines 70..94

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

                  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