diff --git a/.rubocop.yml b/.rubocop.yml index d2733f69c..093bdcb00 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,32 +1,8 @@ inherit_from: .rubocop_basic.yml -Bundler/InsecureProtocolSource: - Enabled: true - -Gemspec/DuplicatedAssignment: - Enabled: true - -Gemspec/OrderedDependencies: - Enabled: true - -Gemspec/RequiredRubyVersion: - Enabled: true - -Performance/Caller: - Enabled: true - -Performance/CaseWhenSplat: - Enabled: true - -Performance/Casecmp: - Enabled: true - Performance/CompareWithBlock: Enabled: true -Performance/Count: - Enabled: true - Performance/Detect: Enabled: true @@ -36,66 +12,12 @@ Performance/DoubleStartEndWith: Performance/EndWith: Enabled: true -Performance/FixedSize: - Enabled: true - -Performance/FlatMap: - Enabled: true - -Performance/RangeInclude: - Enabled: true - -Performance/RedundantBlockCall: - Enabled: true - -Performance/RedundantMatch: - Enabled: true - -Performance/RedundantMerge: - Enabled: true - -Performance/RegexpMatch: - Enabled: true - -Performance/ReverseEach: - Enabled: true - -Performance/Size: - Enabled: true - Performance/StartWith: Enabled: true -Performance/StringReplacement: - Enabled: true - -Performance/TimesMap: - Enabled: true - -Performance/UnfreezeString: - Enabled: true - -Performance/UriDefaultParser: - Enabled: true - -Rails/ActiveSupportAliases: - Enabled: true - -Rails/Blank: - Enabled: true - Rails/CreateTableWithTimestamps: Enabled: true -Rails/Delegate: - Enabled: true - -Rails/DelegateAllowBlank: - Enabled: true - -Rails/DynamicFindBy: - Enabled: true - Rails/EnumUniqueness: Enabled: true @@ -105,9 +27,6 @@ Rails/EnvironmentComparison: Rails/Exit: Enabled: true -Rails/FilePath: - Enabled: true - Rails/FindBy: Enabled: true @@ -123,156 +42,24 @@ Rails/HasManyOrHasOneDependent: Rails/InverseOf: Enabled: true -Rails/LexicallyScopedActionFilter: - Enabled: true - Rails/NotNullColumn: Enabled: true -Rails/Output: - Enabled: true - Rails/OutputSafety: Enabled: true -Rails/Present: - Enabled: true - -Rails/ReadWriteAttribute: - Enabled: true - -Rails/RedundantReceiverInWithOptions: - Enabled: true - Rails/ReversibleMigration: Enabled: true Rails/SaveBang: Enabled: true -Rails/ScopeArgs: - Enabled: true - Rails/SkipsModelValidations: Enabled: true -Rails/UniqBeforePluck: - Enabled: true - -RSpec/AlignLeftLetBrace: - Enabled: false - -RSpec/AlignRightLetBrace: - Enabled: false - -RSpec/AnyInstance: - Enabled: false - -RSpec/BeEql: - Enabled: true - -Capybara/FeatureMethods: - Enabled: false - -RSpec/ContextWording: - Enabled: false - -RSpec/DescribeClass: - Enabled: true - -RSpec/DescribeMethod: - Enabled: true - -RSpec/DescribeSymbol: - Enabled: true - -RSpec/ExampleLength: - Enabled: false - -RSpec/ExpectActual: - Enabled: true - -RSpec/ExpectInHook: - Enabled: true - -RSpec/ExpectOutput: - Enabled: true - -RSpec/FilePath: - Enabled: true - -RSpec/ImplicitExpect: - Enabled: true - EnforcedStyle: should - -RSpec/InstanceSpy: - Enabled: true - RSpec/InstanceVariable: Enabled: true -RSpec/InvalidPredicateMatcher: - Enabled: true - -RSpec/ItBehavesLike: - Enabled: true - -RSpec/IteratedExpectation: - Enabled: true - -RSpec/LeadingSubject: - Enabled: true - -RSpec/MessageChain: - Enabled: true - -RSpec/MessageExpectation: - Enabled: true - -RSpec/MessageSpies: - Enabled: true - EnforcedStyle: receive - -RSpec/MultipleDescribes: - Enabled: true - -RSpec/MultipleExpectations: - Enabled: false - -RSpec/MultipleSubjects: - Enabled: true - -RSpec/NamedSubject: - Enabled: false - -RSpec/NestedGroups: - Enabled: true - Max: 4 - -RSpec/PredicateMatcher: - Enabled: true - -Rails/HttpStatus: - Enabled: true - -RSpec/RepeatedDescription: - Enabled: true - -RSpec/ReturnFromStub: - Enabled: true - -RSpec/SharedContext: - Enabled: true - -RSpec/SingleArgumentMessageChain: - Enabled: true - -RSpec/SubjectStub: - Enabled: true - -RSpec/VerifiedDoubles: - Enabled: true - Security/Eval: Enabled: true diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 88fdf0f9c..041ccd935 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -122,6 +122,7 @@ Lint/UselessAssignment: Metrics/LineLength: Max: 110 + Severity: refactor Rails/ActionFilter: Enabled: true diff --git a/app/controllers/concerns/moderate_actions.rb b/app/controllers/concerns/moderate_actions.rb index f8c2b96c8..52e0a02cf 100644 --- a/app/controllers/concerns/moderate_actions.rb +++ b/app/controllers/concerns/moderate_actions.rb @@ -25,7 +25,7 @@ module ModerateActions @resources.accessible_by(current_ability, :ignore_flag).each(&:ignore_flag) elsif params[:block_authors].present? - author_ids = @resources.pluck(author_id).uniq + author_ids = @resources.pluck(author_id) User.where(id: author_ids).accessible_by(current_ability, :block).each { |user| block_user user } end diff --git a/app/controllers/tracking/budget_investments_controller.rb b/app/controllers/tracking/budget_investments_controller.rb index 4586b7308..83a4f28d0 100644 --- a/app/controllers/tracking/budget_investments_controller.rb +++ b/app/controllers/tracking/budget_investments_controller.rb @@ -48,7 +48,7 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController def heading_filters investments = @budget.investments.by_tracker(current_user.tracker&.id).distinct - investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id).uniq) + investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id)) .order(name: :asc) all_headings_filter = [ { diff --git a/lib/user_segments.rb b/lib/user_segments.rb index 17d609e68..d6bd427fb 100644 --- a/lib/user_segments.rb +++ b/lib/user_segments.rb @@ -18,29 +18,29 @@ class UserSegments end def self.all_proposal_authors - author_ids(Proposal.pluck(:author_id).uniq) + author_ids(Proposal.pluck(:author_id)) end def self.proposal_authors - author_ids(Proposal.not_archived.not_retired.pluck(:author_id).uniq) + author_ids(Proposal.not_archived.not_retired.pluck(:author_id)) end def self.investment_authors - author_ids(current_budget_investments.pluck(:author_id).uniq) + author_ids(current_budget_investments.pluck(:author_id)) end def self.feasible_and_undecided_investment_authors unfeasible_and_finished_condition = "feasibility = 'unfeasible' and valuation_finished = true" investments = current_budget_investments.where.not(unfeasible_and_finished_condition) - author_ids(investments.pluck(:author_id).uniq) + author_ids(investments.pluck(:author_id)) end def self.selected_investment_authors - author_ids(current_budget_investments.selected.pluck(:author_id).uniq) + author_ids(current_budget_investments.selected.pluck(:author_id)) end def self.winner_investment_authors - author_ids(current_budget_investments.winners.pluck(:author_id).uniq) + author_ids(current_budget_investments.winners.pluck(:author_id)) end def self.not_supported_on_current_budget