From f94801a3433eab3f0436ddd6dd34e3871dc63107 Mon Sep 17 00:00:00 2001 From: Clarissa Borges Date: Sun, 21 Feb 2021 15:57:50 -0300 Subject: [PATCH] Add rubocop code analyser --- .github/workflows/ruby.yml | 4 +- .rubocop.yml | 757 +++++++++++++++++++++++++++++++++++++ Gemfile | 6 +- Gemfile.lock | 32 ++ README.md | 8 + 5 files changed, 805 insertions(+), 2 deletions(-) create mode 100644 .rubocop.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index fc4b2c12..583407f3 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -67,5 +67,7 @@ jobs: bundle config path vendor/bundle bundle install --jobs 4 - run: bin/setup ci + - name: rubocop + run: bundle exec rubocop - name: run spec - run: bin/rails spec \ No newline at end of file + run: bin/rails spec diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..2a200fa2 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,757 @@ +AllCops: + NewCops: enable + TargetRubyVersion: 2.6 + Exclude: + - db/**/* + - tmp/**/* + - node_modules/**/* + - script/**/* + - bin/**/* + - vendor/**/* + - Gemfile* + - gems/bess/bin/**/* + - gems/houdini_upgrade/bin/**/* + - gems/houdini_full_contact/bin/**/* + - 'config.ru' + - 'app/views/app_data/_profile.jbuilder' + - 'app/views/app_data/_user.jbuilder' + - 'app/views/app_data/_nonprofit.jbuilder' + - 'app/views/campaigns/_create.jbuilder' + - 'app/views/campaigns/index.jbuilder' + - 'app/views/api/nonprofits/create.json.jbuilder' + - 'app/views/nonprofits/custom_field_joins/index.jbuilder' + - 'app/views/nonprofits/payments/show.jbuilder' + - 'app/views/nonprofits/refunds/index.jbuilder' + - 'app/views/nonprofits/custom_field_masters/index.jbuilder' + - 'app/views/nonprofits/recurring_donations/show.jbuilder' + - 'gems/houdini_upgrade/lib/tasks/houdini_upgrade_tasks.rake' + - 'gems/bess/lib/tasks/houdini_tasks.rake' + - 'lib/tasks/settings.rake' + - 'lib/tasks/civicrm.rake' + - 'lib/tasks/scheduler.rake' + - 'lib/tasks/i18n_js.rake' + - 'lib/tasks/seed.rake' + - 'lib/tasks/health_report.rake' + - 'lib/tasks/notice.rake' + - 'gems/houdini_full_contact/houdini_full_contact.gemspec' + - 'gems/houdini_upgrade/houdini_upgrade.gemspec' + - 'gems/ruby-param-validation/param_validation.gemspec' + - 'gems/ruby-qx/qx.gemspec' + - 'gems/bess/bess.gemspec' + - 'gems/houdini_full_contact/Rakefile' + - 'gems/houdini_upgrade/Rakefile' + - 'gems/ruby-param-validation/Rakefile' + - 'gems/bess/Rakefile' + - 'Rakefile' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/org.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/social_profile.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/topic.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/info.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/job.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/application_record.rb' + - 'gems/houdini_full_contact/app/models/houdini/full_contact/photo.rb' + - 'gems/houdini_full_contact/app/listeners/houdini/full_contact/full_contact_listener.rb' + - 'gems/houdini_full_contact/app/jobs/houdini/full_contact/application_job.rb' + - 'gems/houdini_full_contact/app/jobs/houdini/full_contact/full_contact_job.rb' + - 'gems/houdini_full_contact/lib/houdini.rb' + - 'gems/houdini_full_contact/lib/houdini_full_contact/version.rb' + - 'gems/houdini_full_contact/lib/houdini/full_contact.rb' + - 'gems/houdini_full_contact/lib/houdini/full_contact/engine.rb' + - 'gems/houdini_full_contact/lib/houdini/full_contact/insert_infos.rb' + - 'gems/houdini_full_contact/lib/houdini_full_contact.rb' + - 'gems/houdini_full_contact/config/routes.rb' + - 'gems/houdini_full_contact/config/initializers/houdini_event_publisher.rb' + - 'gems/houdini_full_contact/db/migrate/20200611182909_create_full_contact.rb' + - 'gems/houdini_upgrade/lib/houdini_upgrade/version.rb' + - 'gems/houdini_upgrade/lib/houdini_upgrade/table_to_migrate.rb' + - 'gems/houdini_upgrade/lib/houdini_upgrade/column_to_migrate.rb' + - 'gems/houdini_upgrade/lib/houdini_upgrade/engine.rb' + - 'gems/houdini_upgrade/lib/houdini_upgrade.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/cw_to_activestorage_generator.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/event_background_image_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/nonprofit_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/campaign_background_image_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/article_background_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/article_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/nonprofit_background_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/image_attachment_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/nonprofit_logo_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/campaign_main_image_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/campaign_banner_image_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/profile_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/uploaders/event_main_image_uploader.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/migrate/rename_uploader_columns.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/models/campaign.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/models/profile.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/models/event.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/models/nonprofit.rb' + - 'gems/houdini_upgrade/lib/generators/cw_to_activestorage/templates/models/image_attachment.rb' + - 'gems/houdini_upgrade/lib/tasks/templates/backup_uploader_columns.rb' + - 'gems/houdini_upgrade/lib/tasks/templates/delete_uploader_backup_tables.rb' + - 'gems/houdini_upgrade/config/routes.rb' + - 'gems/houdini_upgrade/db/migrate/20200602215911_remove_picture_from_profile.rb' + - 'gems/houdini_upgrade/db/migrate/20210204013426_remove_long_and_lat.rb' + - 'gems/houdini_upgrade/db/migrate/20210204174909_remove_supporter_emails.rb' + - 'gems/houdini_upgrade/db/migrate/20191105200033_remove_billing_plan_tiers.rb' + - 'gems/ruby-param-validation/lib/param_validation.rb' + - 'gems/ruby-param-validation/test/param_validation_test.rb' + - 'gems/ruby-qx/lib/qx.rb' + - 'gems/ruby-qx/test/UpsertTest.rb' + - 'gems/ruby-qx/test/qx_test.rb' + - 'gems/bess/lib/houdini.rb' + - 'gems/bess/lib/bess.rb' + - 'gems/bess/lib/houdini/ccs/local_tar_gz_adapter.rb' + - 'gems/bess/lib/houdini/ccs/github_adapter.rb' + - 'gems/bess/lib/houdini/event_publisher.rb' + - 'gems/bess/lib/houdini/webhook_adapter/open_fn_adapter.rb' + - 'gems/bess/lib/houdini/ccs.rb' + - 'gems/bess/lib/houdini/webhook_adapter.rb' + - 'gems/bess/lib/houdini/payment_provider/stripe_provider.rb' + - 'gems/bess/lib/houdini/payment_provider/registry.rb' + - 'gems/bess/lib/houdini/intl.rb' + - 'gems/bess/lib/houdini/engine.rb' + - 'gems/bess/lib/houdini/maintenance.rb' + - 'gems/bess/lib/houdini/payment_provider.rb' + - 'gems/bess/lib/bess/version.rb' + - 'gems/bess/lib/generators/react/component_generator.rb' + - 'gems/bess/spec/lib/houdini/maintenance_spec.rb' + - 'gems/bess/spec/spec_helper.rb' + - 'app/mailers/event_mailer.rb' + - 'app/mailers/payment_mailer.rb' + - 'app/mailers/base_mailer.rb' + - 'app/mailers/nonprofit_mailer.rb' + - 'app/mailers/billing_subscription_mailer.rb' + - 'app/mailers/generic_mailer.rb' + - 'app/mailers/admin_mailer.rb' + - 'app/mailers/export_mailer.rb' + - 'app/mailers/ticket_mailer.rb' + - 'app/mailers/campaign_mailer.rb' + - 'app/mailers/testing.rb' + - 'app/mailers/user_mailer.rb' + - 'app/mailers/donation_mailer.rb' + - 'app/mailers/nonprofit_admin_mailer.rb' + - 'app/mailers/recurring_donation_mailer.rb' + - 'app/mailers/import_mailer.rb' + - 'app/models/campaign.rb' + - 'app/models/tag_master.rb' + - 'app/models/ticket_purchase.rb' + - 'app/models/supporter.rb' + - 'app/models/billing_plan.rb' + - 'app/models/modern_donation.rb' + - 'app/models/import.rb' + - 'app/models/email_list.rb' + - 'app/models/supporter_note.rb' + - 'app/models/email_setting.rb' + - 'app/models/campaign_gift.rb' + - 'app/models/card.rb' + - 'app/models/ticket_to_legacy_ticket.rb' + - 'app/models/profile.rb' + - 'app/models/nonprofit_account.rb' + - 'app/models/charge.rb' + - 'app/models/campaign_gift_option.rb' + - 'app/models/activity.rb' + - 'app/models/payment.rb' + - 'app/models/export.rb' + - 'app/models/transaction.rb' + - 'app/models/tag_join.rb' + - 'app/models/payout.rb' + - 'app/models/campaign_gift_purchase.rb' + - 'app/models/custom_field_join.rb' + - 'app/models/bank_account.rb' + - 'app/models/payment_import.rb' + - 'app/models/concerns/model/eventable.rb' + - 'app/models/concerns/model/jbuilder.rb' + - 'app/models/concerns/model/houidable.rb' + - 'app/models/concerns/model/trx_assignable.rb' + - 'app/models/concerns/image/attachment_extensions.rb' + - 'app/models/source_token.rb' + - 'app/models/errors/message_invalid.rb' + - 'app/models/errors/active_model_error.rb' + - 'app/models/dispute.rb' + - 'app/models/create_model.rb' + - 'app/models/object_event_hook_config.rb' + - 'app/models/payment_payout.rb' + - 'app/models/import_request.rb' + - 'app/models/billing_subscription.rb' + - 'app/models/offsite_payment.rb' + - 'app/models/modern_campaign_gift.rb' + - 'app/models/donation.rb' + - 'app/models/user.rb' + - 'app/models/refund.rb' + - 'app/models/application_record.rb' + - 'app/models/base.rb' + - 'app/models/comment.rb' + - 'app/models/recurring_donation.rb' + - 'app/models/custom_field_master.rb' + - 'app/models/event.rb' + - 'app/models/transaction_assignment.rb' + - 'app/models/nonprofit.rb' + - 'app/models/ticket.rb' + - 'app/models/tracking.rb' + - 'app/models/event_discount.rb' + - 'app/models/ticket_level.rb' + - 'app/models/direct_debit_detail.rb' + - 'app/models/role.rb' + - 'app/models/image_attachment.rb' + - 'app/models/miscellaneous_np_info.rb' + - 'app/controllers/tickets_controller.rb' + - 'app/controllers/button_debug_controller.rb' + - 'app/controllers/application_controller.rb' + - 'app/controllers/campaign_gift_options_controller.rb' + - 'app/controllers/roles_controller.rb' + - 'app/controllers/event_discounts_controller.rb' + - 'app/controllers/nonprofits_controller.rb' + - 'app/controllers/direct_uploads_controller.rb' + - 'app/controllers/email_settings_controller.rb' + - 'app/controllers/super_admins_controller.rb' + - 'app/controllers/front_controller.rb' + - 'app/controllers/cards_controller.rb' + - 'app/controllers/campaign_gifts_controller.rb' + - 'app/controllers/users/sessions_controller.rb' + - 'app/controllers/users/registrations_controller.rb' + - 'app/controllers/users/confirmations_controller.rb' + - 'app/controllers/concerns/controllers/nonprofit/authorization.rb' + - 'app/controllers/concerns/controllers/nonprofit/current.rb' + - 'app/controllers/concerns/controllers/supporter/current.rb' + - 'app/controllers/concerns/controllers/campaign/authorization.rb' + - 'app/controllers/concerns/controllers/campaign/current.rb' + - 'app/controllers/concerns/controllers/event/authorization.rb' + - 'app/controllers/concerns/controllers/event/current.rb' + - 'app/controllers/concerns/controllers/user/authorization.rb' + - 'app/controllers/concerns/controllers/locale.rb' + - 'app/controllers/image_attachments_controller.rb' + - 'app/controllers/ticket_levels_controller.rb' + - 'app/controllers/widget_controller.rb' + - 'app/controllers/campaigns/supporters_controller.rb' + - 'app/controllers/campaigns/campaign_gift_options_controller.rb' + - 'app/controllers/campaigns/donations_controller.rb' + - 'app/controllers/recurring_donations_controller.rb' + - 'app/controllers/campaigns_controller.rb' + - 'app/controllers/api/nonprofits_controller.rb' + - 'app/controllers/api/api_controller.rb' + - 'app/controllers/onboard_controller.rb' + - 'app/controllers/settings_controller.rb' + - 'app/controllers/profiles_controller.rb' + - 'app/controllers/emails_controller.rb' + - 'app/controllers/billing_subscriptions_controller.rb' + - 'app/controllers/direct_debit_details_controller.rb' + - 'app/controllers/events_controller.rb' + - 'app/controllers/nonprofits/supporters_controller.rb' + - 'app/controllers/nonprofits/activities_controller.rb' + - 'app/controllers/nonprofits/tag_joins_controller.rb' + - 'app/controllers/nonprofits/refunds_controller.rb' + - 'app/controllers/nonprofits/nonprofit_keys_controller.rb' + - 'app/controllers/nonprofits/custom_field_joins_controller.rb' + - 'app/controllers/nonprofits/payouts_controller.rb' + - 'app/controllers/nonprofits/charges_controller.rb' + - 'app/controllers/nonprofits/cards_controller.rb' + - 'app/controllers/nonprofits/donations_controller.rb' + - 'app/controllers/nonprofits/reports_controller.rb' + - 'app/controllers/nonprofits/bank_accounts_controller.rb' + - 'app/controllers/nonprofits/miscellaneous_np_infos_controller.rb' + - 'app/controllers/nonprofits/email_lists_controller.rb' + - 'app/controllers/nonprofits/button_controller.rb' + - 'app/controllers/nonprofits/recurring_donations_controller.rb' + - 'app/controllers/nonprofits/custom_field_masters_controller.rb' + - 'app/controllers/nonprofits/imports_controller.rb' + - 'app/controllers/nonprofits/supporter_notes_controller.rb' + - 'app/controllers/nonprofits/trackings_controller.rb' + - 'app/controllers/nonprofits/tag_masters_controller.rb' + - 'app/controllers/nonprofits/payments_controller.rb' + - 'app/controllers/static_controller.rb' + - 'app/listeners/credit_card_payment_listener.rb' + - 'app/listeners/application_listener.rb' + - 'app/listeners/campaign_listener.rb' + - 'app/listeners/sepa_payment_listener.rb' + - 'app/listeners/nonprofit_mailer_listener.rb' + - 'app/listeners/wemove_listener.rb' + - 'app/listeners/object_event_listener.rb' + - 'app/listeners/ticket_mailing_listener.rb' + - 'app/helpers/profiles_helper.rb' + - 'app/helpers/card_helper.rb' + - 'app/helpers/onboard_helper.rb' + - 'app/helpers/pricing_helper.rb' + - 'app/helpers/nonprofits_helper.rb' + - 'app/helpers/application_helper.rb' + - 'app/helpers/devise_helper.rb' + - 'app/helpers/api/nonprofits_helper.rb' + - 'app/jobs/application_job.rb' + - 'app/jobs/admin_failed_gift_job.rb' + - 'app/jobs/recurring_donation_cancelled_job.rb' + - 'app/jobs/payment_notification_email_nonprofit_job.rb' + - 'app/jobs/export_payments_failed_job.rb' + - 'app/jobs/export_supporters_failed_job.rb' + - 'app/jobs/supporter_notes_export_create_job.rb' + - 'app/jobs/failed_recurring_donation_payment_donor_email_job.rb' + - 'app/jobs/verification_failed_job.rb' + - 'app/jobs/campaign_creation_email_followup_job.rb' + - 'app/jobs/recurring_donations_export_create_job.rb' + - 'app/jobs/refund_notification_donor_email_job.rb' + - 'app/jobs/export_supporters_completed_job.rb' + - 'app/jobs/we_move_execute_for_donations_job.rb' + - 'app/jobs/direct_debit_create_notify_donor_job.rb' + - 'app/jobs/campaign_creation_federated_email_job.rb' + - 'app/jobs/nonprofit_create_job.rb' + - 'app/jobs/user_invite_create_job.rb' + - 'app/jobs/payment_notification_email_donor_job.rb' + - 'app/jobs/role_added_job.rb' + - 'app/jobs/refund_notification_nonprofit_email_job.rb' + - 'app/jobs/direct_debit_create_notify_nonprofit_job.rb' + - 'app/jobs/recurring_donation_change_amount_nonprofit_email_job.rb' + - 'app/jobs/event_create_creator_email_job.rb' + - 'app/jobs/export_supporter_notes_failed_job.rb' + - 'app/jobs/bank_account_create_job.rb' + - 'app/jobs/payment_export_create_job.rb' + - 'app/jobs/import_completed_job.rb' + - 'app/jobs/refund_notification_job.rb' + - 'app/jobs/export_recurring_donations_completed_job.rb' + - 'app/jobs/recurring_donation_change_amount_job.rb' + - 'app/jobs/email_job.rb' + - 'app/jobs/recurring_donation_change_amount_donor_email_job.rb' + - 'app/jobs/export_recurring_donations_failed_job.rb' + - 'app/jobs/failed_recurring_donation_payment_nonprofit_email_job.rb' + - 'app/jobs/supporters_export_create_job.rb' + - 'app/jobs/pay_recurring_donation_job.rb' + - 'app/jobs/event_create_job.rb' + - 'app/jobs/payout_pending_job.rb' + - 'app/jobs/import_creation_job.rb' + - 'app/jobs/email_list_create_job.rb' + - 'app/jobs/verification_completed_job.rb' + - 'app/jobs/supporter_fundraiser_create_job.rb' + - 'app/jobs/mailchimp_supporter_sync_job.rb' + - 'app/jobs/export_supporter_notes_completed_job.rb' + - 'app/jobs/pay_recurring_donations_job.rb' + - 'app/jobs/export_payments_completed_job.rb' + - 'app/jobs/webhook_transmit_job.rb' + - 'app/jobs/stripe_account_create_job.rb' + - 'lib/import/import_civicrm_payments.rb' + - 'lib/get_data.rb' + - 'lib/name_copy_naming_algorithm.rb' + - 'lib/htp.rb' + - 'lib/path/nonprofit_path.rb' + - 'lib/health_report.rb' + - 'lib/qexpr_query_chunker.rb' + - 'lib/qexpr.rb' + - 'lib/slug_nonprofit_naming_algorithm.rb' + - 'lib/chunked_uploader.rb' + - 'lib/hash.rb' + - 'lib/uuid.rb' + - 'lib/validation_error.rb' + - 'lib/slug_copy_naming_algorithm.rb' + - 'lib/create/create_tag_master.rb' + - 'lib/create/create_campaign.rb' + - 'lib/create/create_campaign_gift_option.rb' + - 'lib/create/create_custom_field_join.rb' + - 'lib/create/create_campaign_gift.rb' + - 'lib/create/stripe/create_stripe_account.rb' + - 'lib/create/create_peer_to_peer_campaign.rb' + - 'lib/create/create_custom_field_master.rb' + - 'lib/notify/notify_user.rb' + - 'lib/update/update_miscellaneous_np_info.rb' + - 'lib/update/update_supporter_notes.rb' + - 'lib/update/update_email_settings.rb' + - 'lib/update/update_charges.rb' + - 'lib/update/update_recurring_donations.rb' + - 'lib/update/update_tickets.rb' + - 'lib/update/update_campaign_gift_option.rb' + - 'lib/update/update_order.rb' + - 'lib/update/update_email_lists.rb' + - 'lib/update/update_payouts.rb' + - 'lib/update/update_disputes.rb' + - 'lib/update/update_donation.rb' + - 'lib/update/update_supporter.rb' + - 'lib/update/update_activities.rb' + - 'lib/update/update_refunds.rb' + - 'lib/update/update_custom_field_joins.rb' + - 'lib/update/update_nonprofit.rb' + - 'lib/maintain/maintain_dedications.rb' + - 'lib/maintain/maintain_ticket_records.rb' + - 'lib/maintain/maintain_payment_records.rb' + - 'lib/include_asset.rb' + - 'lib/query/query_email_settings.rb' + - 'lib/query/query_campaign_gifts.rb' + - 'lib/query/query_donations.rb' + - 'lib/query/query_source_token.rb' + - 'lib/query/query_recurring_donations.rb' + - 'lib/query/query_campaign_metrics.rb' + - 'lib/query/query_nonprofit_keys.rb' + - 'lib/query/query_ticket_levels.rb' + - 'lib/query/query_event_organizer.rb' + - 'lib/query/query_roles.rb' + - 'lib/query/billing_plans.rb' + - 'lib/query/query_payments.rb' + - 'lib/query/query_events.rb' + - 'lib/query/query_activities.rb' + - 'lib/query/query_full_contact_infos.rb' + - 'lib/query/query_charges.rb' + - 'lib/query/query_event_discounts.rb' + - 'lib/query/query_event_metrics.rb' + - 'lib/query/query_tickets.rb' + - 'lib/query/query_custom_fields.rb' + - 'lib/query/query_profiles.rb' + - 'lib/query/query_supporters.rb' + - 'lib/query/query_campaigns.rb' + - 'lib/query/query_nonprofits.rb' + - 'lib/query/query_users.rb' + - 'lib/onboard_accounts.rb' + - 'lib/copy_naming_algorithm.rb' + - 'lib/email.rb' + - 'lib/audit.rb' + - 'lib/slug_p2p_campaign_naming_algorithm.rb' + - 'lib/pay_recurring_donation.rb' + - 'lib/errors/not_enough_quantity_error.rb' + - 'lib/errors/cc_org_error.rb' + - 'lib/errors/charge_error.rb' + - 'lib/errors/expired_token_error.rb' + - 'lib/errors/authentication_error.rb' + - 'lib/merge_supporters.rb' + - 'lib/cancel_billing_subscription.rb' + - 'lib/delete/delete_campaign_gift_option.rb' + - 'lib/delete/delete_tag_joins.rb' + - 'lib/delete/delete_custom_field_joins.rb' + - 'lib/cypher.rb' + - 'lib/timespan.rb' + - 'lib/required_keys.rb' + - 'lib/fetch/fetch_event.rb' + - 'lib/fetch/fetch_todo_status.rb' + - 'lib/fetch/fetch_miscellaneous_np_info.rb' + - 'lib/fetch/fetch_nonprofit.rb' + - 'lib/fetch/stripe/fetch_stripe_account.rb' + - 'lib/fetch/fetch_nonprofit_email.rb' + - 'lib/fetch/fetch_campaign.rb' + - 'lib/retrieve/retrieve_active_record_items.rb' + - 'lib/json_resp.rb' + - 'lib/queue_donations.rb' + - 'lib/image.rb' + - 'lib/format/format/geography.rb' + - 'lib/format/format/phone.rb' + - 'lib/format/format/interpolate.rb' + - 'lib/format/format/date.rb' + - 'lib/format/format/csv.rb' + - 'lib/format/format/indefinitize.rb' + - 'lib/format/format/timezone.rb' + - 'lib/format/format/url.rb' + - 'lib/format/format/name.rb' + - 'lib/format/format/dedication.rb' + - 'lib/format/format/remove_diacritics.rb' + - 'lib/format/format/address.rb' + - 'lib/format/format/html.rb' + - 'lib/format/format/currency.rb' + - 'lib/list/list_activities.rb' + - 'lib/numeric.rb' + - 'lib/stripe_utils.rb' + - 'lib/insert/insert_donation.rb' + - 'lib/insert/insert_supporter.rb' + - 'lib/insert/insert_payout.rb' + - 'lib/insert/insert_direct_debit_detail.rb' + - 'lib/insert/insert_tracking.rb' + - 'lib/insert/insert_activities.rb' + - 'lib/insert/insert_email_lists.rb' + - 'lib/insert/insert_tag_joins.rb' + - 'lib/insert/insert_custom_field_joins.rb' + - 'lib/insert/insert_tickets.rb' + - 'lib/insert/insert_disputes.rb' + - 'lib/insert/insert_duplicate.rb' + - 'lib/insert/insert_refunds.rb' + - 'lib/insert/insert_recurring_donation.rb' + - 'lib/insert/insert_card.rb' + - 'lib/insert/insert_nonprofit_keys.rb' + - 'lib/insert/insert_bank_account.rb' + - 'lib/insert/insert_charge.rb' + - 'lib/insert/insert_source_token.rb' + - 'lib/insert/insert_supporter_notes.rb' + - 'lib/scheduled_jobs.rb' + - 'lib/qx_query_chunker.rb' + - 'lib/mailchimp.rb' + - 'lib/generate_locales.rb' + - 'lib/psql.rb' + - 'lib/calculate/calculate_fees.rb' + - 'lib/calculate/calculate_suggested_amounts.rb' + - 'lib/metrics/nonprofit_metrics.rb' + - 'lib/stripe_account.rb' + - 'lib/generators/overrides.rb' + - 'lib/generators/libmodule/libmodule_generator.rb' + - 'lib/generators/overrides/rails/plugin/plugin_builder.rb' + - 'lib/generators/ts/declaration/declaration_generator.rb' + - 'lib/construct/construct_billing_subscription.rb' + - 'lib/construct/construct_nonprofit.rb' + - 'lib/search_vector.rb' + - 'lib/export/export_payments.rb' + - 'lib/export/export_supporter_notes.rb' + - 'lib/export/export_supporters.rb' + - 'lib/export/export_recurring_donations.rb' + - 'spec/mailers/donation_mailer_spec.rb' + - 'spec/mailers/admin_spec.rb' + - 'spec/factories/ticket_to_legacy_tickets.rb' + - 'spec/factories/tag_masters.rb' + - 'spec/factories/modern_campaign_gifts.rb' + - 'spec/factories/supporter_notes.rb' + - 'spec/factories/import_requests.rb' + - 'spec/factories/cards.rb' + - 'spec/factories/ticket_levels.rb' + - 'spec/factories/tickets.rb' + - 'spec/factories/campaign_gifts.rb' + - 'spec/factories/payment_payouts.rb' + - 'spec/factories/transactions.rb' + - 'spec/factories/payouts.rb' + - 'spec/factories/supporters.rb' + - 'spec/factories/billing_plans.rb' + - 'spec/factories/users.rb' + - 'spec/factories/miscellaneous_np_infos.rb' + - 'spec/factories/transaction_assignments.rb' + - 'spec/factories/donations.rb' + - 'spec/factories/object_event_hook_configs.rb' + - 'spec/factories/direct_debit_details.rb' + - 'spec/factories/ticket_purchases.rb' + - 'spec/factories/billing_subscriptions.rb' + - 'spec/factories/email_lists.rb' + - 'spec/factories/payments.rb' + - 'spec/factories/campaigns.rb' + - 'spec/factories/refunds.rb' + - 'spec/factories/tag_joins.rb' + - 'spec/factories/exports.rb' + - 'spec/factories/charges.rb' + - 'spec/factories/campaign_gift_options.rb' + - 'spec/factories/modern_donations.rb' + - 'spec/factories/disputes.rb' + - 'spec/factories/custom_field_joins.rb' + - 'spec/factories/bank_accounts.rb' + - 'spec/factories/profiles.rb' + - 'spec/factories/event_discounts.rb' + - 'spec/factories/recurring_donations.rb' + - 'spec/factories/source_tokens.rb' + - 'spec/factories/roles.rb' + - 'spec/factories/campaign_gift_purchases.rb' + - 'spec/factories/custom_field_masters.rb' + - 'spec/factories/nonprofits.rb' + - 'spec/factories/payment_imports.rb' + - 'spec/factories/offsite_payments.rb' + - 'spec/factories/events.rb' + - 'spec/rails_helper.rb' + - 'spec/lib/import/import_civicrm_payments_spec.rb' + - 'spec/lib/chunked_uploader_spec.rb' + - 'spec/lib/copy_naming_algorithm_spec.rb' + - 'spec/lib/slug_p2p_campaign_naming_algorithm_spec.rb' + - 'spec/lib/stripe_utils_spec.rb' + - 'spec/lib/error_handler/error_handler_null_spec.rb' + - 'spec/lib/error_handler/error_handler_airbrake_spec.rb' + - 'spec/lib/merge_supporters_spec.rb' + - 'spec/lib/pay_recurring_donation_spec.rb' + - 'spec/lib/create/create_campaign_spec.rb' + - 'spec/lib/create/create_campaign_gift_spec.rb' + - 'spec/lib/create/create_peer_to_peer_campaign_spec.rb' + - 'spec/lib/mailchimp_spec.rb' + - 'spec/lib/update/update_recurring_donations_spec.rb' + - 'spec/lib/update/update_payouts_spec.rb' + - 'spec/lib/update/update_disputes_spec.rb' + - 'spec/lib/update/update_charges_spec.rb' + - 'spec/lib/update/update_tickets_spec.rb' + - 'spec/lib/update/update_donation_spec.rb' + - 'spec/lib/update/update_refunds_spec.rb' + - 'spec/lib/update/update_supporter_spec.rb' + - 'spec/lib/update/update_misc_nonprofit_settings_spec.rb' + - 'spec/lib/query/query_users_spec.rb' + - 'spec/lib/query/billing_plans_spec.rb' + - 'spec/lib/query/query_roles_spec.rb' + - 'spec/lib/query/query_campaign_metrics_spec.rb' + - 'spec/lib/query/query_ticket_levels_spec.rb' + - 'spec/lib/query/query_payments_spec.rb' + - 'spec/lib/query/query_campaign_gifts_spec.rb' + - 'spec/lib/query/query_recurring_donations_spec.rb' + - 'spec/lib/query/query_source_token_spec.rb' + - 'spec/lib/query/query_donations_spec.rb' + - 'spec/lib/query/query_supporters_spec.rb' + - 'spec/lib/numeric_spec.rb' + - 'spec/lib/name_copy_naming_algorithm_spec.rb' + - 'spec/lib/delete/delete_campaign_gift_option_spec.rb' + - 'spec/lib/fetch/fetch_misc_nonprofit_settings_spec.rb' + - 'spec/lib/fetch/fetch_nonprofit_email_spec.rb' + - 'spec/lib/retrieve/retrieve_active_record_items_spec.rb' + - 'spec/lib/slug_copy_naming_algorithm_spec.rb' + - 'spec/lib/format/geography_spec.rb' + - 'spec/lib/format/indefinitize_spec.rb' + - 'spec/lib/format/name_spec.rb' + - 'spec/lib/format/currency_spec.rb' + - 'spec/lib/format/url_spec.rb' + - 'spec/lib/format/dedication_spec.rb' + - 'spec/lib/insert/insert_refunds_spec.rb' + - 'spec/lib/insert/insert_recurring_donation_spec.rb' + - 'spec/lib/insert/insert_donation_spec.rb' + - 'spec/lib/insert/insert_charge_spec.rb' + - 'spec/lib/insert/insert_disputes_spec.rb' + - 'spec/lib/insert/insert_bank_account_spec.rb' + - 'spec/lib/insert/insert_payout_spec.rb' + - 'spec/lib/insert/insert_custom_field_joins_spec.rb' + - 'spec/lib/insert/insert_tag_joins_spec.rb' + - 'spec/lib/insert/insert_supporter_notes_spec.rb' + - 'spec/lib/insert/insert_duplicate_spec.rb' + - 'spec/lib/insert/insert_source_token_spec.rb' + - 'spec/lib/insert/insert_tickets_spec.rb' + - 'spec/lib/insert/insert_card_spec.rb' + - 'spec/lib/uuid_spec.rb' + - 'spec/lib/stripe_account_spec.rb' + - 'spec/lib/timespan_spec.rb' + - 'spec/lib/cancel_billing_subscriptions_spec.rb' + - 'spec/lib/calculate/calculate_suggested_amounts_spec.rb' + - 'spec/lib/calculate/calculate_fees_spec.rb' + - 'spec/lib/construct/construct_nonprofit_spec.rb' + - 'spec/lib/slug_nonprofit_naming_algorithm_spec.rb' + - 'spec/lib/export/export_recurring_donations_spec.rb' + - 'spec/lib/export/export_supporters_spec.rb' + - 'spec/lib/export/export_payments_spec.rb' + - 'spec/lib/export/export_supporter_notes_spec.rb' + - 'spec/spec_helper.rb' + - 'spec/models/campaign_gift_purchase_spec.rb' + - 'spec/models/custom_field_master_spec.rb' + - 'spec/models/user_spec.rb' + - 'spec/models/supporter_note_spec.rb' + - 'spec/models/modern_campaign_gift_spec.rb' + - 'spec/models/import_request_spec.rb' + - 'spec/models/nonprofit_spec.rb' + - 'spec/models/concerns/model/eventable_spec.rb' + - 'spec/models/concerns/model/houidable_spec.rb' + - 'spec/models/payment_import_spec.rb' + - 'spec/models/ticket_spec.rb' + - 'spec/models/ticket_purchase_spec.rb' + - 'spec/models/transaction_spec.rb' + - 'spec/models/event_discount_spec.rb' + - 'spec/models/supporter_spec.rb' + - 'spec/models/ticket_to_legacy_ticket_spec.rb' + - 'spec/models/transaction_assignment_spec.rb' + - 'spec/models/modern_donation_spec.rb' + - 'spec/models/ticket_level_spec.rb' + - 'spec/models/object_event_hook_config_spec.rb' + - 'spec/models/tag_master_spec.rb' + - 'spec/models/campaign_spec.rb' + - 'spec/models/campaign_gift_option_spec.rb' + - 'spec/controllers/image_attachments_spec.rb' + - 'spec/controllers/event_discounts_spec.rb' + - 'spec/controllers/cards_spec.rb' + - 'spec/controllers/front_spec.rb' + - 'spec/controllers/onboard_controller_spec.rb' + - 'spec/controllers/email_settings_spec.rb' + - 'spec/controllers/profiles_spec.rb' + - 'spec/controllers/campaigns_spec.rb' + - 'spec/controllers/roles_spec.rb' + - 'spec/controllers/direct_debit_details_spec.rb' + - 'spec/controllers/widget_controller_spec.rb' + - 'spec/controllers/emails_spec.rb' + - 'spec/controllers/ticket_levels_spec.rb' + - 'spec/controllers/concerns/supporter/current_spec.rb' + - 'spec/controllers/support/new_controller_user_context.rb' + - 'spec/controllers/support/shared_user_context.rb' + - 'spec/controllers/campaigns/donations_spec.rb' + - 'spec/controllers/campaigns/supporters_spec.rb' + - 'spec/controllers/campaigns/campaign_gift_options_spec.rb' + - 'spec/controllers/campaign_gifts_spec.rb' + - 'spec/controllers/api/nonprofits_controller_spec.rb' + - 'spec/controllers/static_controller_spec.rb' + - 'spec/controllers/tickets_spec.rb' + - 'spec/controllers/campaign_gift_options_spec.rb' + - 'spec/controllers/settings_spec.rb' + - 'spec/controllers/billing_subscriptions_spec.rb' + - 'spec/controllers/nonprofits_spec.rb' + - 'spec/controllers/nonprofits/charges_spec.rb' + - 'spec/controllers/nonprofits/cards_spec.rb' + - 'spec/controllers/nonprofits/trackings_spec.rb' + - 'spec/controllers/nonprofits/payments_spec.rb' + - 'spec/controllers/nonprofits/donations_spec.rb' + - 'spec/controllers/nonprofits/supporters_spec.rb' + - 'spec/controllers/nonprofits/email_lists_spec.rb' + - 'spec/controllers/nonprofits/tag_joins_spec.rb' + - 'spec/controllers/nonprofits/bank_accounts_spec.rb' + - 'spec/controllers/nonprofits/activities_spec.rb' + - 'spec/controllers/nonprofits/button_spec.rb' + - 'spec/controllers/nonprofits/custom_fields_joins_spec.rb' + - 'spec/controllers/nonprofits/custom_field_masters_spec.rb' + - 'spec/controllers/nonprofits/tag_masters_spec.rb' + - 'spec/controllers/nonprofits/reports_spec.rb' + - 'spec/controllers/nonprofits/payouts_spec.rb' + - 'spec/controllers/nonprofits/imports_spec.rb' + - 'spec/controllers/nonprofits/recurring_donations_spec.rb' + - 'spec/controllers/nonprofits/miscellaneous_np_infos_spec.rb' + - 'spec/controllers/nonprofits/nonprofit_keys_spec.rb' + - 'spec/controllers/super_admins_spec.rb' + - 'spec/controllers/recurring_donations_spec.rb' + - 'spec/controllers/events_spec.rb' + - 'spec/cve/cve_2015_3226_spec.rb' + - 'spec/cve/cve_2014_2538_spec.rb' + - 'spec/cve/cve_2015_3225_spec.rb' + - 'spec/support/contexts.rb' + - 'spec/support/date_time.rb' + - 'spec/support/factory_bot.rb' + - 'spec/support/mock_helpers.rb' + - 'spec/support/contexts/shared_rd_donation_value_context.rb' + - 'spec/support/contexts/shared_donation_charge_context.rb' + - 'spec/support/contexts/general_shared_user_context.rb' + - 'spec/support/construct.rb' + - 'spec/support/payments_for_a_payout.rb' + - 'spec/support/expect.rb' + - 'spec/support/init_dotenv.rb' + - 'spec/support/test_upload_service.rb' + - 'spec/support/time_helpers.rb' + - 'spec/requests/maintenance_spec.rb' + - 'spec/requests/nonprofits/direct_debit_details_spec.rb' + - 'spec/migration/delete_tag_join_spec.rb' + - 'spec/migration/delete_custom_field_join_spec.rb' + - 'spec/routing/state_code_routing_spec.rb' + - 'node_modules/rails-erb-loader/test/dependencies/dependency/version.rb' + - 'node_modules/rails-erb-loader/test/dependencies/dependency/hello.rb' + - 'node_modules/rails-erb-loader/test/dependencies/dependency.rb' + - 'node_modules/rails-erb-loader/erb_transformer.rb' + - 'node_modules/node-sass/src/libsass/extconf.rb' + - 'config/puma.rb' + - 'config/state_code_constraint.rb' + - 'config/boot.rb' + - 'config/spring.rb' + - 'config/routes.rb' + - 'config/initializers/hamster_extensions.rb' + - 'config/initializers/new_framework_defaults_6_1.rb' + - 'config/initializers/assets.rb' + - 'config/initializers/log_rage.rb' + - 'config/initializers/secret_token.rb' + - 'config/initializers/quiet_assets.rb' + - 'config/initializers/permissions_policy.rb' + - 'config/initializers/devise_async.rb' + - 'config/initializers/timeout.rb' + - 'config/initializers/content_security_policy.rb' + - 'config/initializers/filter_parameter_logging.rb' + - 'config/initializers/devise.rb' + - 'config/initializers/stripe.rb' + - 'config/initializers/mime_types.rb' + - 'config/initializers/reload_api.rb' + - 'config/initializers/session_store.rb' + - 'config/initializers/application_controller_renderer.rb' + - 'config/initializers/chunked_uploader_service.rb' + - 'config/initializers/slack_notice.rb' + - 'config/initializers/email_jobs.rb' + - 'config/initializers/pg_type_map.rb' + - 'config/initializers/wrap_parameters.rb' + - 'config/initializers/backtrace_silencers.rb' + - 'config/initializers/houdini_event_publisher.rb' + - 'config/initializers/locale.rb' + - 'config/initializers/inflections.rb' + - 'config/initializers/mailchimp.rb' + - 'config/initializers/cookies_serializer.rb' + - 'config/initializers/block_ips.rb' + - 'config/initializers/new_framework_defaults_6_0.rb' + - 'config/initializers/time.rb' + - 'config/application.rb' + - 'config/environment.rb' + - 'config/environments/test.rb' + - 'config/environments/staging.rb' + - 'config/environments/ci.rb' + - 'config/environments/production.rb' + - 'config/environments/development.rb' + DisplayCopNames: true + +require: + - rubocop-rails + - rubocop-rake + - rubocop-rspec + +Layout/IndentationStyle: + EnforcedStyle: tabs + +Layout/IndentationWidth: + Width: 1 diff --git a/Gemfile b/Gemfile index ae39563c..a7bc2135 100755 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,10 @@ group :development, :ci, :test do gem 'listen' gem 'table_print', '~> 1.5', '>= 1.5.6' # giuNice table printing of data for the console gem 'colorize', '~> 0.8.1' # Print colorized text in debugger/console + gem 'rubocop', '~> 1.10' + gem 'rubocop-rails', '~> 2.9' + gem 'rubocop-rake', '~> 0.5.1' + gem 'rubocop-rspec', '~> 2.2' end group :ci, :test do @@ -86,4 +90,4 @@ end gem 'bess', path: 'gems/bess' -gem 'houdini_full_contact', path: 'gems/houdini_full_contact' \ No newline at end of file +gem 'houdini_full_contact', path: 'gems/houdini_full_contact' diff --git a/Gemfile.lock b/Gemfile.lock index a1afcf05..83164456 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,6 +111,7 @@ GEM zeitwerk (~> 2.3) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) + ast (2.4.2) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -226,6 +227,9 @@ GEM mini_portile2 (~> 2.5.0) racc (~> 1.4) orm_adapter (0.5.0) + parallel (1.20.1) + parser (3.0.0.0) + ast (~> 2.4.1) pg (1.2.3) power_assert (1.2.0) pry (0.12.2) @@ -277,6 +281,7 @@ GEM method_source rake (>= 0.8.7) thor (~> 1.0) + rainbow (3.0.0) rake (12.3.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) @@ -287,6 +292,7 @@ GEM execjs railties (>= 3.2) tilt + regexp_parser (2.0.3) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) @@ -325,6 +331,27 @@ GEM rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.9.4) + rubocop (1.10.0) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.2.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + rubocop-rails (2.9.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 0.90.0, < 2.0) + rubocop-rake (0.5.1) + rubocop + rubocop-rspec (2.2.0) + rubocop (~> 1.0) + rubocop-ast (>= 1.1.0) + ruby-progressbar (1.11.0) ruby-vips (2.0.17) ffi (~> 1.9) sassc (2.4.0) @@ -364,6 +391,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) + unicode-display_width (2.0.0) unicode_utils (1.4.0) warden (1.2.9) rack (>= 2.0.9) @@ -432,6 +460,10 @@ DEPENDENCIES roadie-rails (~> 2.1) rspec (~> 3.9.0) rspec-rails (~> 4.0.0) + rubocop (~> 1.10) + rubocop-rails (~> 2.9) + rubocop-rake (~> 0.5.1) + rubocop-rspec (~> 2.2) sassc (~> 2.0, >= 2.0.1) sassc-rails (~> 2.1, >= 2.1.2) simplecov (~> 0.16.1) diff --git a/README.md b/README.md index a5947a26..cae141e0 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,14 @@ admin=User.find(1) #or the id of the user you want to add the role role=Role.create(user:admin,name: "super_admin") ``` +#### Code Analysis + +We use `Rubocop` to perform static code analysis: + +```bash +rubocop +``` + ## Known Issues For a list of [how to solve known issues](docs/KNOWN_ISSUES.MD)