Skip to content

Commit

Permalink
Update Ruboocop.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed May 15, 2024
1 parent 13a4a17 commit 976a015
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 111 deletions.
89 changes: 0 additions & 89 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,5 @@
inherit_gem:
decidim-dev: rubocop-decidim.yml

inherit_mode:
merge:
- Exclude

AllCops:
Exclude:
- "decidim-initiatives/lib/gem_overrides/origami/date.rb"

Naming/FileName:
Exclude:
- "decidim-dev/lib/decidim-dev.rb"

Metrics/CyclomaticComplexity:
Exclude:
- "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb"

Metrics/ParameterLists:
Exclude:
- "decidim-core/lib/decidim/filter_form_builder.rb"

Metrics/PerceivedComplexity:
Exclude:
- "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb"

RSpec/DescribeClass:
Exclude:
- decidim-core/spec/lib/global_engines_spec.rb

RSpec/EmptyExampleGroup:
Exclude:
- decidim-core/spec/lib/participatory_space_manifest_spec.rb

RSpec/MultipleMemoizedHelpers:
Exclude:
- decidim-assemblies/spec/forms/assembly_form_spec.rb

Rails/Output:
Exclude:
- lib/decidim/git_backport_manager.rb
- lib/decidim/github_manager/poster.rb
- decidim-core/lib/decidim/core.rb
- decidim-core/lib/decidim/component_manifest.rb
- decidim-core/lib/decidim/participatory_space_manifest.rb

Rails/Exit:
Exclude:
- lib/decidim/git_backport_manager.rb

RSpec/NoExpectationExample:
Exclude:
- decidim-admin/spec/system/participatory_space_private_user_spec.rb
- decidim-comments/spec/services/decidim/comments/comment_creation_spec.rb
- decidim-conferences/spec/cells/decidim/conferences/conference_speaker_cell_spec.rb
- decidim-core/spec/cells/decidim/date_range_cell_spec.rb
- decidim-core/spec/commands/decidim/unsubscribe_settings_spec.rb
- decidim-core/spec/controllers/registrations_controller_spec.rb
- decidim-core/spec/lib/importers/import_manifest_spec.rb
- decidim-core/spec/lib/map/geocoding_spec.rb
- decidim-core/spec/lib/participatory_space_manifest_spec.rb
- decidim-core/spec/services/decidim/events_manager_spec.rb
- decidim-core/spec/services/decidim/settings_change_spec.rb
- decidim-core/spec/services/decidim/zip_stream/zip_stream_writer_spec.rb
- decidim-core/spec/tasks/decidim_tasks_right_to_be_forgotten_spec.rb
- decidim-elections/spec/lib/tasks/decidim_election_generate_identification_keys_spec.rb
- decidim-elections/spec/lib/tasks/decidim_election_scheduled_tasks_spec.rb
- decidim-elections/spec/shared/vote_examples.rb
- decidim-elections/spec/system/key_ceremony_spec.rb
- decidim-elections/spec/system/vote_online_inside_a_voting_spec.rb
- decidim-initiatives/spec/system/admin/update_initiative_spec.rb
- decidim-initiatives/spec/system/initiative_signing_spec.rb
- decidim-meetings/spec/commands/admin/export_meeting_registrations_spec.rb
- decidim-meetings/spec/system/explore_meeting_directory_spec.rb
- decidim-meetings/spec/system/explore_meetings_spec.rb
- decidim-proposals/spec/lib/decidim/proposals/markdown_to_proposals_spec.rb
- decidim-proposals/spec/shared/import_proposals_examples.rb
- decidim-proposals/spec/shared/proposals_wizards_examples.rb
- decidim-proposals/spec/system/admin/admin_manages_participatory_texts_spec.rb
- decidim-proposals/spec/system/participatory_texts_spec.rb
- decidim-participatory_processes/spec/system/participatory_processes_spec.rb

# fix these rules later
Capybara/SpecificFinders:
Enabled: false

RSpec/IndexedLet:
Enabled: false

Rails/HelperInstanceVariable:
Enabled: false

# EOF fix these rules later
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module PermissionOverrides
extend ActiveSupport::Concern
included do
def admin_edition_is_available?
return unless proposal
return false unless proposal

proposal.official? || proposal.official_meeting? || proposal.authors.any? { |p| p.is_a?(Decidim::Organization) }
end
Expand Down
2 changes: 0 additions & 2 deletions decidim-simple_proposal.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ Gem::Specification.new do |spec|

spec.add_dependency "decidim-core", Decidim::SimpleProposal::DECIDIM_VERSION
spec.add_dependency "decidim-proposals", Decidim::SimpleProposal::DECIDIM_VERSION

spec.add_development_dependency "decidim-dev", Decidim::SimpleProposal::DECIDIM_VERSION
end
6 changes: 3 additions & 3 deletions spec/system/admin/admin_manages_component_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
end

context "when there's antoher scope" do
let!(:scope2) { create(:scope, organization:) }
let!(:second_scope) { create(:scope, organization:) }

before do
visit current_path
end

it "can change scope" do
select scope2.name["en"], from: "component[settings][scope_id]"
select second_scope.name["en"], from: "component[settings][scope_id]"
click_link_or_button "Update"
expect(page).to have_content("The component was updated successfully")
expect(Decidim::Component.find(component.id).scope.id).to eq(scope2.id)
expect(Decidim::Component.find(component.id).scope.id).to eq(second_scope.id)
end
end
end
Expand Down
30 changes: 15 additions & 15 deletions spec/system/admin/admin_merges_proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,56 +52,56 @@
end

context "with multiple authors" do
let(:author3) { create(:user, :confirmed, organization:) }
let(:third_author) { create(:user, :confirmed, organization:) }
let(:authors) { [author, another_author] }
let(:other_authors) { [author3, organization] }
let(:other_authors) { [third_author, organization] }

it "merges two proposals into one with all the authors" do
visit current_path
merge_proposals([proposal, another_proposal])
expect(page).to have_css(".flash.success")
expect(Decidim::Proposals::Proposal.where(deleted_at: nil).count).to eq(1)
expect(Decidim::Proposals::Proposal.last.authors).to include(author, another_author, author3, organization)
expect(Decidim::Proposals::Proposal.last.authors).to include(author, another_author, third_author, organization)
expect(page).to have_css(".action-icon.action-icon--edit-proposal", count: 1)
end
end

context "when proposals has comments" do
let!(:comment) { create(:comment, commentable: proposal) }
let!(:comment2) { create(:comment, commentable: proposal) }
let!(:comment3) { create(:comment, commentable: another_proposal) }
let!(:second_comment) { create(:comment, commentable: proposal) }
let!(:third_comment) { create(:comment, commentable: another_proposal) }

it "moves comments to merge proposal" do
visit current_path
merge_proposals([proposal, another_proposal])
merge_proposal = Decidim::Proposals::Proposal.last
expect(merge_proposal.comments.count).to eq(3)
expect(merge_proposal.comments).to include(comment, comment2, comment3)
expect(merge_proposal.comments).to include(comment, second_comment, third_comment)
end
end

context "when proposals have machine translations" do
let(:proposal) { create(:proposal, body: body1, component:, users: authors) }
let(:another_proposal) { create(:proposal, body: body2, component:, users: other_authors) }
let(:body1) do
let(:proposal) { create(:proposal, body: first_body, component:, users: authors) }
let(:another_proposal) { create(:proposal, body: second_body, component:, users: other_authors) }
let(:first_body) do
{
"en" => "Hello world",
"machine_translations" => machine_translations1
"machine_translations" => first_machine_translations
}
end
let(:body2) do
let(:second_body) do
{
"en" => "This is a test sentence",
"machine_translations" => machine_translations2
"machine_translations" => second_machine_translations
}
end
let(:machine_translations1) do
let(:first_machine_translations) do
{
"fi" => "Hei maailma",
"sv" => "Hej världen"
}
end
let(:machine_translations2) do
let(:second_machine_translations) do
{
"fi" => "Tämä on testilause",
"sv" => "Det här är en testmening"
Expand Down Expand Up @@ -130,7 +130,7 @@ def merge_proposals(proposals)
Array(proposals).each do |proposal|
find(".js-proposal-id-#{proposal.id}").set(true)
end
find("#js-bulk-actions-button").click
find_by_id("js-bulk-actions-button").click
click_link_or_button "Merge into a new one"
select translated(component.name), from: "target_component_id_"
click_link_or_button "Merge"
Expand Down
2 changes: 1 addition & 1 deletion spec/system/admin/admin_splits_proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def split_proposals(proposal_ids)
Array(proposal_ids).each do |id|
find(".js-proposal-id-#{id}").set(true)
end
find("#js-bulk-actions-button").click
find_by_id("js-bulk-actions-button").click
click_link_or_button "Split proposals"
select translated(component.name), from: "target_component_id_"
click_link_or_button "Split"
Expand Down

0 comments on commit 976a015

Please sign in to comment.