Showing 4,066 of 4,066 total issues

File users_auth_spec.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

feature 'Users' do

  context 'Regular authentication' do
Severity: Minor
Found in spec/features/users_auth_spec.rb - About 2 hrs to fix

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

      scenario 'Show' do
        parent_comment = create(:comment, commentable: debate)
        first_child    = create(:comment, commentable: debate, parent: parent_comment)
        second_child   = create(:comment, commentable: debate, parent: parent_comment)
    
    
    Severity: Major
    Found in spec/features/comments/debates_spec.rb and 1 other location - About 2 hrs to fix
    spec/features/comments/proposals_spec.rb on lines 23..38

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

    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

      scenario 'Show' do
        parent_comment = create(:comment, commentable: proposal)
        first_child    = create(:comment, commentable: proposal, parent: parent_comment)
        second_child   = create(:comment, commentable: proposal, parent: parent_comment)
    
    
    Severity: Major
    Found in spec/features/comments/proposals_spec.rb and 1 other location - About 2 hrs to fix
    spec/features/comments/debates_spec.rb on lines 23..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 103.

    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 investment.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Budget
      class Investment < ActiveRecord::Base
        SORTING_OPTIONS = %w(id title supports).freeze
    
        include Rails.application.routes.url_helpers
    Severity: Minor
    Found in app/models/budget/investment.rb - About 2 hrs to fix

      File user.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class User < ActiveRecord::Base
      
        include Verification
      
        devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable,
      Severity: Minor
      Found in app/models/user.rb - About 2 hrs to fix

        Method initialize has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(user)
              merge Abilities::Everyone.new(user)
        
              can [:read, :update], User, id: user.id
        
        
        Severity: Major
        Found in app/models/abilities/common.rb - About 2 hrs to fix

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

            describe "#started?" do
              it "checks draft publication" do
                # future
                process.update_attributes(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 2 locations. Consider refactoring.
          Open

            describe "#open?" do
              it "checks draft publication" do
                # future
                process.update_attributes(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

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

          require 'rails_helper'
          
          feature 'Admin budgets' do
          
            background do
          Severity: Minor
          Found in spec/features/admin/budgets_spec.rb - About 2 hrs to fix

            Method initialize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def initialize(user)
                  merge Abilities::Moderation.new(user)
            
                  can :restore, Comment
                  cannot :restore, Comment, hidden_at: nil
            Severity: Major
            Found in app/models/abilities/administrator.rb - About 2 hrs to fix

              File nested_documentable.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              shared_examples "nested documentable" do |login_as_name, documentable_factory_name,
                                                        path, documentable_path_arguments,
                                                        fill_resource_method_name, submit_button,
                                                        documentable_success_notice|
                include ActionView::Helpers
              Severity: Minor
              Found in spec/shared/features/nested_documentable.rb - About 2 hrs to fix

                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
                      # TODO i18n : broken because of test locale change
                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 60..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 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"\
                        " (Draft (Not visible to the public))"
                      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

                feature 'Commenting topics from proposals' do
                  let(:user) { create :user }
                  let(:proposal) { create :proposal }
                
                  feature 'Voting comments' do
                Severity: Major
                Found in spec/custom/features/comments/topics_spec.rb and 1 other location - About 2 hrs to fix
                spec/custom/features/comments/topics_spec.rb on lines 42..73

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

                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

                feature 'Commenting topics from budget investments' do
                  let(:user) { create :user }
                  let(:investment) { create :budget_investment }
                
                  feature 'Voting comments' do
                Severity: Major
                Found in spec/custom/features/comments/topics_spec.rb and 1 other location - About 2 hrs to fix
                spec/custom/features/comments/topics_spec.rb on lines 4..35

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

                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 initialize has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def initialize(user)
                      merge Abilities::Moderation.new(user)
                
                      can :restore, Comment
                      cannot :restore, Comment, hidden_at: nil
                Severity: Major
                Found in app/models/custom/abilities/administrator.rb - About 2 hrs to fix

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

                    describe '#get_document_number_variants' do
                      it "trims and cleans up entry" do
                        expect(api.get_document_number_variants(2, '  1 2@ 34')).to eq(['1234'])
                      end
                  
                  
                  Severity: Major
                  Found in spec/lib/census_api_spec.rb and 1 other location - About 2 hrs to fix
                  spec/lib/local_census_spec.rb on lines 6..26

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

                  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

                    describe '#get_document_number_variants' do
                      it "trims and cleans up entry" do
                        expect(api.get_document_number_variants(2, '  1 2@ 34')).to eq(['1234'])
                      end
                  
                  
                  Severity: Major
                  Found in spec/lib/local_census_spec.rb and 1 other location - About 2 hrs to fix
                  spec/lib/census_api_spec.rb on lines 6..26

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

                  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

                  describe Verification::Residence do
                  
                    let(:residence) { build(:verification_residence, document_number: "12345678Z") }
                  
                    describe "verification" do
                  Severity: Major
                  Found in spec/models/custom/verification/residence_spec.rb and 1 other location - About 2 hrs to fix
                  spec/custom/models/custom/verification/residence_spec.rb on lines 5..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 92.

                  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

                  describe Verification::Residence do
                  
                    let(:residence) { build(:verification_residence, document_number: "12345678Z") }
                  
                    describe "verification" do
                  Severity: Major
                  Found in spec/custom/models/custom/verification/residence_spec.rb and 1 other location - About 2 hrs to fix
                  spec/models/custom/verification/residence_spec.rb on lines 3..28

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

                  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