From b078f2129e5164d6546a722ed62d2e68c69d4b27 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Sat, 23 Dec 2023 21:54:13 +1300 Subject: [PATCH] Add standardrb and generate a todo file Brief discussion on Discord garnered no hatred for the idea of using a linter, and it can be aspirational - we move towards standard slowly :) (The todo file ignores violations in existing files, to allow gradual migration. It was generated using `standardrb --generate-todo` and is normally called .standard_todo.yml, but we have to rename it to .standard.yml for now for compatibility with older versions of standrad that don't support the _todo.yml file.) Co-authored-by: Tom Levy --- .standard.yml | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++ Gemfile | 2 + Gemfile.lock | 25 +++++ 3 files changed, 289 insertions(+) create mode 100644 .standard.yml diff --git a/.standard.yml b/.standard.yml new file mode 100644 index 00000000..3f2c1135 --- /dev/null +++ b/.standard.yml @@ -0,0 +1,262 @@ +# TODO: Rename this file to .standard_todo.yml once we update to standard 0.4.0 (which added support for the _todo.yml file) +# Auto generated files with errors to ignore. +# Remove from this list as you refactor files. +--- +ignore: +- Gemfile +- Rakefile +- app/controllers/accounts/confirmations_controller.rb +- app/controllers/accounts/passwords_controller.rb +- app/controllers/accounts/registrations_controller.rb +- app/controllers/accounts/requests_controller.rb +- app/controllers/accounts/settings_controller.rb +- app/controllers/application_controller.rb +- app/controllers/contest_relations_controller.rb +- app/controllers/contest_supervisors_controller.rb +- app/controllers/contests_controller.rb +- app/controllers/evaluators_controller.rb +- app/controllers/file_attachments_controller.rb +- app/controllers/filelinks/roots_controller.rb +- app/controllers/group_problem_set_controller.rb +- app/controllers/groups/files_controller.rb +- app/controllers/groups/members_controller.rb +- app/controllers/groups/problem_sets_controller.rb +- app/controllers/groups_controller.rb +- app/controllers/home_controller.rb +- app/controllers/importers/problem_series_controller.rb +- app/controllers/item_controller.rb +- app/controllers/items_controller.rb +- app/controllers/organisations_controller.rb +- app/controllers/problem_problem_set_controller.rb +- app/controllers/problem_sets_controller.rb +- app/controllers/problems/files_controller.rb +- app/controllers/problems/test_cases_controller.rb +- app/controllers/problems_controller.rb +- app/controllers/products_controller.rb +- app/controllers/roles_controller.rb +- app/controllers/schools_controller.rb +- app/controllers/settings_controller.rb +- app/controllers/submissions_controller.rb +- app/controllers/test_cases_controller.rb +- app/controllers/test_sets_controller.rb +- app/controllers/user_controller.rb +- app/controllers/users_controller.rb +- app/exporters/base_exporter.rb +- app/exporters/contests/contest_exporter.rb +- app/exporters/problems/test_case_exporter.rb +- app/helpers/accounts/requests_helper.rb +- app/helpers/application_helper.rb +- app/helpers/problems_helper.rb +- app/helpers/submissions_helper.rb +- app/importers/pdf/extract_images.rb +- app/importers/problems.rb +- app/importers/problems/base_importer.rb +- app/importers/problems/coci/importer.rb +- app/importers/problems/coci/index.rb +- app/importers/problems/coci/pdf_importer.rb +- app/importers/problems/flat_case_importer.rb +- app/importers/problems/test_case_importer.rb +- app/mailers/admin_mailer.rb +- app/models/contest.rb +- app/models/contest_relation.rb +- app/models/contest_score.rb +- app/models/contest_supervisor.rb +- app/models/entity.rb +- app/models/enumeration.rb +- app/models/evaluator.rb +- app/models/file_attachment.rb +- app/models/filelink.rb +- app/models/group.rb +- app/models/group_membership.rb +- app/models/item.rb +- app/models/item_history.rb +- app/models/language.rb +- app/models/language_group.rb +- app/models/organisation.rb +- app/models/problem.rb +- app/models/problem_series.rb +- app/models/problem_set.rb +- app/models/product.rb +- app/models/request.rb +- app/models/role.rb +- app/models/school.rb +- app/models/setting.rb +- app/models/submission.rb +- app/models/submission/judge_data.rb +- app/models/test_case_relation.rb +- app/models/user.rb +- app/models/user_problem_relation.rb +- app/policies/application_policy.rb +- app/policies/authenticated_policy.rb +- app/policies/contest_policy.rb +- app/policies/contest_relation_policy.rb +- app/policies/contest_supervisor_policy.rb +- app/policies/evaluator_policy.rb +- app/policies/file_attachment_policy.rb +- app/policies/filelink_policy.rb +- app/policies/group_policy.rb +- app/policies/item_policy.rb +- app/policies/organisation_policy.rb +- app/policies/problem_policy.rb +- app/policies/problem_set_policy.rb +- app/policies/product_policy.rb +- app/policies/request_policy.rb +- app/policies/role_policy.rb +- app/policies/school_policy.rb +- app/policies/setting_policy.rb +- app/policies/submission_policy.rb +- app/policies/user_policy.rb +- app/presenters/application_presenter.rb +- app/presenters/problem_presenter.rb +- app/scrubbers/loofah/scrubbers/escape_with_custom_whitelist.rb +- app/scrubbers/loofah/scrubbers/math_jax.rb +- app/scrubbers/loofah/scrubbers/no_comment.rb +- app/scrubbers/loofah/scrubbers/no_form.rb +- app/scrubbers/loofah/scrubbers/relative_link.rb +- app/services/code.rb +- app/services/isolate.rb +- app/uploaders/avatar_uploader.rb +- app/uploaders/file_attachment_uploader.rb +- app/workers/application_worker.rb +- app/workers/judge_submission_worker.rb +- app/workers/problem_series/base.rb +- app/workers/problem_series/download_worker.rb +- app/workers/problem_series/import_worker.rb +- app/workers/problem_series/reindex_worker.rb +- app/workers/problem_series/update_worker.rb +- app/workers/rejudge_problem_worker.rb +- config.ru +- config/application.rb +- config/authorization_rules.rb +- config/backup.rb +- config/backup/latest.rb +- config/backup/weekly.rb +- config/boot.rb +- config/environment.rb +- config/environments/development.rb +- config/environments/production.rb +- config/environments/test.rb +- config/initializers/accessible_attributes.rb +- config/initializers/carrierwave.rb +- config/initializers/datetime_limits.rb +- config/initializers/devise.rb +- config/initializers/logger.rb +- config/initializers/mail_interceptor.rb +- config/initializers/mailer.rb +- config/initializers/mime_types.rb +- config/initializers/pdfkit.rb +- config/initializers/redis.rb +- config/initializers/secret_token.rb +- config/initializers/session_store.rb +- config/initializers/timezone.rb +- config/initializers/will_paginate.rb +- config/navigation.rb +- config/routes.rb +- config/schedule.rb +- config/unicorn.rb +- db/migrate/20110819224757_devise_create_users.rb +- db/migrate/20110904045150_create_contests_problems_table.rb +- db/migrate/20110924035337_create_group_user_table.rb +- db/migrate/20110925021620_create_group_problem_table.rb +- db/migrate/20111002021523_create_contest_group_table.rb +- db/migrate/20111206102437_add_brownie_points_to_users.rb +- db/migrate/20120115015112_create_contests_max_score_submissions_view.rb +- db/migrate/20120115020222_create_contests_latest_submissions_view.rb +- db/migrate/20120115044124_create_contests_max_score_scoreboard_view.rb +- db/migrate/20120115044140_create_contests_latest_scoreboard_view.rb +- db/migrate/20120117133515_add_indexes_id_fields.rb +- db/migrate/20120119025544_create_problem_sets.rb +- db/migrate/20120119081526_remove_problems_contests_groups.rb +- db/migrate/20120122061329_create_roles.rb +- db/migrate/20120127063021_add_username_to_users.rb +- db/migrate/20120128000525_create_settings.rb +- db/migrate/20120128235138_create_evaluators.rb +- db/migrate/20120201080849_add_title_index_to_problem.rb +- db/migrate/20120201113029_add_sessions_table.rb +- db/migrate/20120210235859_create_test_sets.rb +- db/migrate/20120805020042_add_confirmable_to_users.rb +- db/migrate/20120807033035_add_end_time_to_contest_relations.rb +- db/migrate/20120807042326_create_contest_scores.rb +- db/migrate/20120810041325_add_results_final_to_contest.rb +- db/migrate/20130926021023_convert_groups_users_to_memberships.rb +- db/migrate/20130926065258_add_visibility_and_membership_to_groups.rb +- db/migrate/20130926105411_create_requests.rb +- db/migrate/20130928133936_add_last_seen_at_to_users.rb +- db/migrate/20131007025034_convert_test_case_associations.rb +- db/migrate/20131013050536_add_language_id_to_submission.rb +- db/migrate/20131205201359_add_type_to_test_set.rb +- db/migrate/20131206074948_name_all_test_sets_and_cases.rb +- db/migrate/20131207080120_change_enumeration_on_test_sets.rb +- db/migrate/20131207091535_convert_dummy_test_sets_to_samples.rb +- db/migrate/20131208014408_add_language_group_model.rb +- db/migrate/20131208015044_change_language_identifiers_to_match.rb +- db/migrate/20131208131723_rename_bad_usernames.rb +- db/migrate/20131209063832_fix_bad_markdown.rb +- db/migrate/20131217112526_change_test_set_and_test_case_sample_and_prerequisites.rb +- db/migrate/20131219035927_add_problems_order_position_to_tests.rb +- db/migrate/20131220034551_change_habtm_problem_associations.rb +- db/migrate/20131221014009_create_user_problem_relation.rb +- db/migrate/20131221101354_remove_submission_classification_default.rb +- db/migrate/20131222021036_add_rejudge_at_to_problem.rb +- db/migrate/20140206025958_create_items_and_products.rb +- db/migrate/20140218212023_generate_scan_tokens.rb +- db/migrate/20141224134542_clean_language_model.rb +- db/migrate/20150109101859_add_school_country_year_to_users.rb +- db/migrate/20150116010255_normalize_line_endings.rb +- db/migrate/20150118010607_weighted_contests.rb +- db/migrate/20150118104425_calculate_weighted_columns.rb +- db/migrate/20160131000430_update_checked_in_field.rb +- db/migrate/20200418113600_add_live_scoreboard_field.rb +- db/migrate/20200418113601_add_offical_contestants.rb +- db/seeds.rb +- lib/development_mail_interceptor.rb +- lib/ean13.rb +- lib/file_size_validator.rb +- lib/tasks/sessions.rake +- script/install/cint.rb +- script/rails +- spec/controllers/accounts/passwords_controller_spec.rb +- spec/controllers/accounts/registrations_controller_spec.rb +- spec/controllers/application_controller_spec.rb +- spec/controllers/contests_controller_spec.rb +- spec/controllers/evaluators_controller_spec.rb +- spec/controllers/groups_controller_spec.rb +- spec/controllers/problem_sets_controller_spec.rb +- spec/controllers/problems_controller_spec.rb +- spec/controllers/roles_controller_spec.rb +- spec/controllers/settings_controller_spec.rb +- spec/controllers/submissions_controller_spec.rb +- spec/controllers/test_cases_controller_spec.rb +- spec/controllers/test_sets_controller_spec.rb +- spec/controllers/user_controller_spec.rb +- spec/controllers/users_controller_spec.rb +- spec/factories/contest_supervisors.rb +- spec/factories/contests.rb +- spec/factories/evaluators.rb +- spec/factories/groups.rb +- spec/factories/problem_sets.rb +- spec/factories/problems.rb +- spec/factories/roles.rb +- spec/factories/settings.rb +- spec/factories/submissions.rb +- spec/factories/test_cases.rb +- spec/factories/test_sets.rb +- spec/factories/users.rb +- spec/features/invitation_and_join_request_spec.rb +- spec/features/registrations_spec.rb +- spec/features/submissions_spec.rb +- spec/importers/problems/flat_case_importer.rb +- spec/importers/problems/test_case_importer.rb +- spec/models/contest_relation_spec.rb +- spec/models/contest_score_spec.rb +- spec/models/contest_supervisor_spec.rb +- spec/models/language_spec.rb +- spec/models/problem_spec.rb +- spec/models/submission_spec.rb +- spec/models/test_case_relation_spec.rb +- spec/policies/authorization_spec.rb +- spec/spec_helper.rb +- spec/support/ability_spec_helper.rb +- spec/support/controllers_spec_helper.rb +- spec/support/fixtures_spec_helper.rb +- spec/support/requests_spec_helper.rb diff --git a/Gemfile b/Gemfile index fa791bc6..9fffcadd 100644 --- a/Gemfile +++ b/Gemfile @@ -84,6 +84,8 @@ group :development, :test do gem 'byebug' gem 'ruby_parser' # for declarative_authorization + + gem 'standard' end diff --git a/Gemfile.lock b/Gemfile.lock index 288ff3ce..ca83c63f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,6 +32,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) afm (0.2.2) arel (5.0.1.20140414130214) + ast (2.4.2) atomic (1.1.101) avl_tree (1.2.1) atomic (~> 1.1) @@ -131,6 +132,7 @@ GEM concurrent-ruby (~> 1.0) i18n_data (0.8.0) iso8601 (0.10.1) + jaro_winkler (1.5.6) jquery-final_countdown-rails (2.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) @@ -184,6 +186,10 @@ GEM ntlm-http (0.1.1) open4 (1.3.4) orm_adapter (0.5.0) + parallel (1.19.2) + parser (3.2.2.4) + ast (~> 2.4.1) + racc pdf-core (0.7.0) pdf-reader (2.0.0) Ascii85 (~> 1.0.0) @@ -215,6 +221,7 @@ GEM thin (~> 1.6) thor (~> 0.19.1) vegas (~> 0.1.11) + racc (1.5.2) rack (1.5.5) rack-protection (1.5.5) rack @@ -235,6 +242,7 @@ GEM activesupport (= 4.1.16) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (3.1.1) rake (13.0.6) ranked-model (0.4.0) activerecord (>= 3.1.12) @@ -251,6 +259,7 @@ GEM request_store (1.0.8) responders (1.1.2) railties (>= 3.2, < 4.2) + rexml (3.2.5) rmagick (5.1.0) pkg-config (~> 1.4) rqrcode (0.10.1) @@ -272,10 +281,21 @@ GEM rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) + rubocop (0.80.1) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.7.0.1) + rainbow (>= 2.2.2, < 4.0) + rexml + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 1.7) + rubocop-performance (1.5.2) + rubocop (>= 0.71.0) ruby-duration (3.2.3) activesupport (>= 3.0.0) i18n iso8601 + ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby_parser (3.10.1) sexp_processor (~> 4.9) @@ -325,6 +345,9 @@ GEM activesupport (>= 3.0) polyamorous (~> 1.1.0) ssrf_filter (1.0.8) + standard (0.2.5) + rubocop (~> 0.80.1) + rubocop-performance (~> 1.5.2) statsd-ruby (1.4.0) strong_attributes (0.0.2) activesupport (>= 3.0) @@ -356,6 +379,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) + unicode-display_width (1.6.1) unicode_utils (1.4.0) vegas (0.1.11) rack (>= 1.0.0) @@ -431,6 +455,7 @@ DEPENDENCIES sinatra spring squeel + standard strong_presenter (~> 0.2.2) superfish-rails (~> 1.6.0) therubyracer (~> 0.11)