diff --git a/.rubocop.yml b/.rubocop.yml index 4f4c98dc93..9e9240636f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,7 @@ require: - rubocop-rails - rubocop-rspec - rubocop-performance + - rubocop-capybara AllCops: TargetRubyVersion: 2.7 @@ -19,7 +20,6 @@ AllCops: NewCops: enable Exclude: - db/schema.rb - - 'config/**/*' - 'bin/*' - 'Rakefile' - 'node_modules/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e41c10e1c3..a3536e2023 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,6 +13,81 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'config/initializers/cors.rb' + - 'config/initializers/session_store.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'config/routes.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'config/initializers/omniauth.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'config/boot.rb' + - 'config/environments/production.rb' + - 'config/initializers/rack_attack.rb' + - 'config/routes.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Width, AllowedPatterns. +Layout/IndentationWidth: + Exclude: + - 'config/initializers/ffmpeg.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +Layout/LeadingCommentSpace: + Exclude: + - 'config/application.rb' + - 'config/initializers/omniauth.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'config/initializers/paperclip.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_no_space, require_space +Layout/SpaceInLambdaLiteral: + Exclude: + - 'config/environments/production.rb' + - 'config/initializers/content_security_policy.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideStringInterpolation: + Exclude: + - 'config/initializers/webauthn.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'config/initializers/paperclip.rb' + # Configuration parameters: AllowedMethods, AllowedPatterns. Lint/AmbiguousBlockAssociation: Exclude: @@ -26,6 +101,11 @@ Lint/AmbiguousBlockAssociation: - 'spec/services/unsuspend_account_service_spec.rb' - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' +# This cop supports safe autocorrection (--autocorrect). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'config/initializers/rack_attack.rb' + # Configuration parameters: AllowedMethods. # AllowedMethods: enums Lint/ConstantDefinitionInBlock: @@ -109,9 +189,24 @@ Lint/OrAssignmentToConstant: Exclude: - 'lib/sanitize_ext/sanitize_config.rb' +# This cop supports safe autocorrection (--autocorrect). +Lint/SendWithMixinArgument: + Exclude: + - 'config/application.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'config/initializers/content_security_policy.rb' + - 'config/initializers/doorkeeper.rb' + - 'config/initializers/paperclip.rb' + - 'config/initializers/simple_form.rb' + Lint/UselessAssignment: Exclude: - 'app/services/activitypub/process_status_update_service.rb' + - 'config/initializers/omniauth.rb' - 'db/migrate/20190511134027_add_silenced_at_suspended_at_to_accounts.rb' - 'db/post_migrate/20190511152737_remove_suspended_silenced_account_fields.rb' - 'spec/controllers/api/v1/bookmarks_controller_spec.rb' @@ -141,7 +236,7 @@ Metrics/AbcSize: # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: - Max: 433 + Max: 544 # Configuration parameters: CountBlocks, Max. Metrics/BlockNesting: @@ -185,6 +280,13 @@ Naming/AccessorMethodName: Exclude: - 'app/controllers/auth/sessions_controller.rb' +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'config/locales/sr-Latn.rb' + # Configuration parameters: EnforcedStyleForLeadingUnderscores. # SupportedStylesForLeadingUnderscores: disallowed, required, optional Naming/MemoizedInstanceVariableName: @@ -195,6 +297,7 @@ Naming/MemoizedInstanceVariableName: - 'app/lib/activitypub/activity.rb' - 'app/services/resolve_url_service.rb' - 'app/services/search_service.rb' + - 'config/initializers/rack_attack.rb' # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. # SupportedStyles: snake_case, normalcase, non_integer @@ -227,6 +330,7 @@ Performance/CollectionLiteralInLoop: - 'app/services/fetch_resource_service.rb' - 'app/services/suspend_account_service.rb' - 'app/services/unsuspend_account_service.rb' + - 'config/deploy.rb' - 'lib/mastodon/media_cli.rb' # This cop supports unsafe autocorrection (--autocorrect-all). @@ -279,6 +383,12 @@ Performance/RedundantEqualityComparisonBlock: Exclude: - 'spec/requests/link_headers_spec.rb' +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: MaxKeyValuePairs. +Performance/RedundantMerge: + Exclude: + - 'config/initializers/paperclip.rb' + # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SafeMultiline. Performance/StartWith: @@ -679,6 +789,29 @@ RSpec/LetSetup: - 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb' - 'spec/workers/scheduler/user_cleanup_scheduler_spec.rb' +# This cop supports safe autocorrection (--autocorrect). +RSpec/MatchArray: + Exclude: + - 'spec/controllers/activitypub/followers_synchronizations_controller_spec.rb' + - 'spec/controllers/admin/export_domain_blocks_controller_spec.rb' + - 'spec/controllers/api/v1/accounts/follower_accounts_controller_spec.rb' + - 'spec/controllers/api/v1/accounts/following_accounts_controller_spec.rb' + - 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb' + - 'spec/controllers/api/v1/bookmarks_controller_spec.rb' + - 'spec/controllers/api/v1/favourites_controller_spec.rb' + - 'spec/controllers/api/v1/reports_controller_spec.rb' + - 'spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb' + - 'spec/controllers/api/v1/statuses/reblogged_by_accounts_controller_spec.rb' + - 'spec/models/account_filter_spec.rb' + - 'spec/models/account_spec.rb' + - 'spec/models/account_statuses_cleanup_policy_spec.rb' + - 'spec/models/custom_emoji_filter_spec.rb' + - 'spec/models/status_spec.rb' + - 'spec/models/user_spec.rb' + - 'spec/presenters/familiar_followers_presenter_spec.rb' + - 'spec/services/activitypub/fetch_featured_collection_service_spec.rb' + - 'spec/services/update_status_service_spec.rb' + RSpec/MessageChain: Exclude: - 'spec/controllers/api/v1/media_controller_spec.rb' @@ -962,8 +1095,9 @@ RSpec/NoExpectationExample: RSpec/PendingWithoutReason: Exclude: + - 'spec/controllers/statuses_controller_spec.rb' - 'spec/models/account_spec.rb' - - 'spec/support/examples/lib/settings/scoped_settings.rb' + - 'spec/models/user_spec.rb' # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers. @@ -1348,6 +1482,7 @@ Rails/CompactBlank: - 'app/models/poll.rb' - 'app/models/user.rb' - 'app/services/import_service.rb' + - 'config/initializers/paperclip.rb' # This cop supports safe autocorrection (--autocorrect). Rails/ContentTag: @@ -1369,16 +1504,24 @@ Rails/CreateTableWithTimestamps: - 'db/migrate/20221006061337_create_preview_card_trends.rb' # This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Severity. Rails/DeprecatedActiveModelErrorsMethods: Exclude: - 'lib/mastodon/accounts_cli.rb' # This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity. Rails/DuplicateAssociation: Exclude: - 'app/serializers/activitypub/collection_serializer.rb' - 'app/serializers/activitypub/note_serializer.rb' +# Configuration parameters: Include. +# Include: app/**/*.rb, config/**/*.rb, lib/**/*.rb +Rails/Exit: + Exclude: + - 'config/boot.rb' + # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments Rails/FilePath: @@ -1386,6 +1529,7 @@ Rails/FilePath: - 'app/lib/themes.rb' - 'app/models/setting.rb' - 'app/validators/reaction_validator.rb' + - 'config/environments/test.rb' - 'db/migrate/20170716191202_add_hide_notifications_to_mute.rb' - 'db/migrate/20170918125918_ids_to_bigints.rb' - 'db/migrate/20171005171936_add_disabled_to_custom_emojis.rb' @@ -1558,6 +1702,16 @@ Rails/Output: Exclude: - 'lib/mastodon/ip_blocks_cli.rb' +Rails/OutputSafety: + Exclude: + - 'config/initializers/simple_form.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. +Rails/Present: + Exclude: + - 'config/initializers/content_security_policy.rb' + # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. # Include: **/Rakefile, **/*.rake @@ -1570,6 +1724,15 @@ Rails/RakeEnvironment: - 'lib/tasks/repo.rake' - 'lib/tasks/statistics.rake' +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Include. +# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb +Rails/ResponseParsedBody: + Exclude: + - 'spec/controllers/follower_accounts_controller_spec.rb' + - 'spec/controllers/following_accounts_controller_spec.rb' + - 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb' + # Configuration parameters: Include. # Include: db/**/*.rb Rails/ReversibleMigration: @@ -1718,6 +1881,12 @@ Rails/WhereExists: - 'spec/services/purge_domain_service_spec.rb' - 'spec/services/unallow_domain_service_spec.rb' +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnConstant, AllowOnSelfClass. +Style/CaseEquality: + Exclude: + - 'config/initializers/trusted_proxies.rb' + # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: MinBranchesCount. Style/CaseLikeIf: @@ -1732,6 +1901,10 @@ Style/ClassEqualityComparison: - 'app/helpers/jsonld_helper.rb' - 'app/serializers/activitypub/outbox_serializer.rb' +Style/ClassVars: + Exclude: + - 'config/initializers/devise.rb' + Style/CombinableLoops: Exclude: - 'app/models/form/custom_emoji_batch.rb' @@ -1749,6 +1922,16 @@ Style/FetchEnvVar: - 'app/helpers/application_helper.rb' - 'app/lib/redis_configuration.rb' - 'app/lib/translation_service.rb' + - 'config/environments/development.rb' + - 'config/environments/production.rb' + - 'config/initializers/2_whitelist_mode.rb' + - 'config/initializers/blacklists.rb' + - 'config/initializers/cache_buster.rb' + - 'config/initializers/content_security_policy.rb' + - 'config/initializers/devise.rb' + - 'config/initializers/omniauth.rb' + - 'config/initializers/paperclip.rb' + - 'config/initializers/vapid.rb' - 'lib/mastodon/premailer_webpack_strategy.rb' - 'lib/mastodon/redis_config.rb' - 'lib/tasks/repo.rake' @@ -1757,9 +1940,11 @@ Style/FetchEnvVar: # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. # SupportedStyles: annotated, template, unannotated +# AllowedMethods: redirect Style/FormatStringToken: Exclude: - 'app/models/privacy_policy.rb' + - 'config/initializers/devise.rb' - 'lib/mastodon/maintenance_cli.rb' - 'lib/paperclip/color_extractor.rb' @@ -1771,6 +1956,52 @@ Style/FrozenStringLiteralComment: - 'app/views/accounts/show.rss.ruby' - 'app/views/tags/show.rss.ruby' - 'app/views/well_known/host_meta/show.xml.ruby' + - 'config/application.rb' + - 'config/boot.rb' + - 'config/environment.rb' + - 'config/environments/development.rb' + - 'config/environments/production.rb' + - 'config/environments/test.rb' + - 'config/initializers/0_post_deployment_migrations.rb' + - 'config/initializers/active_model_serializers.rb' + - 'config/initializers/application_controller_renderer.rb' + - 'config/initializers/assets.rb' + - 'config/initializers/backtrace_silencers.rb' + - 'config/initializers/cache_logging.rb' + - 'config/initializers/chewy.rb' + - 'config/initializers/content_security_policy.rb' + - 'config/initializers/cookies_serializer.rb' + - 'config/initializers/cors.rb' + - 'config/initializers/devise.rb' + - 'config/initializers/doorkeeper.rb' + - 'config/initializers/fast_blank.rb' + - 'config/initializers/ffmpeg.rb' + - 'config/initializers/filter_parameter_logging.rb' + - 'config/initializers/http_client_proxy.rb' + - 'config/initializers/httplog.rb' + - 'config/initializers/inflections.rb' + - 'config/initializers/mail_delivery_job.rb' + - 'config/initializers/makara.rb' + - 'config/initializers/mime_types.rb' + - 'config/initializers/oj.rb' + - 'config/initializers/omniauth.rb' + - 'config/initializers/open_uri_redirection.rb' + - 'config/initializers/permissions_policy.rb' + - 'config/initializers/pghero.rb' + - 'config/initializers/preload_link_headers.rb' + - 'config/initializers/premailer_rails.rb' + - 'config/initializers/rack_attack_logging.rb' + - 'config/initializers/redis.rb' + - 'config/initializers/session_store.rb' + - 'config/initializers/simple_form.rb' + - 'config/initializers/stoplight.rb' + - 'config/initializers/trusted_proxies.rb' + - 'config/initializers/twitter_regex.rb' + - 'config/initializers/webauthn.rb' + - 'config/initializers/wrap_parameters.rb' + - 'config/locales/sr-Latn.rb' + - 'config/locales/sr.rb' + - 'config/puma.rb' - 'db/migrate/20160220174730_create_accounts.rb' - 'db/migrate/20160220211917_create_statuses.rb' - 'db/migrate/20160221003140_create_users.rb' @@ -2117,6 +2348,18 @@ Style/FrozenStringLiteralComment: - 'lib/tasks/branding.rake' - 'spec/fabricators_spec.rb' +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'config/boot.rb' + - 'config/environments/development.rb' + - 'config/environments/production.rb' + +# Configuration parameters: AllowedVariables. +Style/GlobalVars: + Exclude: + - 'config/initializers/statsd.rb' + # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: @@ -2143,6 +2386,7 @@ Style/GuardClause: - 'app/workers/redownload_header_worker.rb' - 'app/workers/redownload_media_worker.rb' - 'app/workers/remote_account_refresh_worker.rb' + - 'config/initializers/devise.rb' - 'db/migrate/20170901141119_truncate_preview_cards.rb' - 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb' - 'lib/devise/two_factor_ldap_authenticatable.rb' @@ -2187,14 +2431,48 @@ Style/HashTransformValues: - 'app/serializers/rest/web_push_subscription_serializer.rb' - 'app/services/import_service.rb' +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/IdenticalConditionalBranches: + Exclude: + - 'config/initializers/content_security_policy.rb' + +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Exclude: + - 'config/environments/production.rb' + - 'config/initializers/devise.rb' + - 'config/initializers/ffmpeg.rb' + # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: InverseMethods, InverseBlocks. Style/InverseMethods: Exclude: + - 'app/controllers/concerns/signature_verification.rb' + - 'app/helpers/jsonld_helper.rb' + - 'app/lib/activitypub/activity/create.rb' + - 'app/lib/activitypub/activity/move.rb' + - 'app/lib/feed_manager.rb' + - 'app/lib/link_details_extractor.rb' + - 'app/models/concerns/attachmentable.rb' + - 'app/models/concerns/remotable.rb' - 'app/models/custom_filter.rb' + - 'app/models/webhook.rb' + - 'app/services/activitypub/process_status_update_service.rb' + - 'app/services/fetch_link_card_service.rb' + - 'app/services/search_service.rb' - 'app/services/update_account_service.rb' + - 'app/workers/web/push_notification_worker.rb' + - 'lib/paperclip/color_extractor.rb' - 'spec/controllers/activitypub/replies_controller_spec.rb' +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: line_count_dependent, lambda, literal +Style/Lambda: + Exclude: + - 'config/initializers/simple_form.rb' + - 'config/routes.rb' + # This cop supports unsafe autocorrection (--autocorrect-all). Style/MapToHash: Exclude: @@ -2213,9 +2491,21 @@ Style/MutableConstant: - 'app/services/delete_account_service.rb' - 'app/services/fetch_link_card_service.rb' - 'app/services/resolve_url_service.rb' + - 'config/initializers/twitter_regex.rb' - 'lib/mastodon/snowflake.rb' - 'spec/controllers/api/base_controller_spec.rb' +# This cop supports safe autocorrection (--autocorrect). +Style/NilLambda: + Exclude: + - 'config/initializers/paperclip.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinDigits, Strict, AllowedNumbers, AllowedPatterns. +Style/NumericLiterals: + Exclude: + - 'config/initializers/strong_migrations.rb' + # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: @@ -2231,6 +2521,44 @@ Style/OptionalBooleanParameter: - 'app/workers/unfollow_follow_worker.rb' - 'lib/mastodon/redis_config.rb' +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'config/deploy.rb' + - 'config/initializers/doorkeeper.rb' + +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: short, verbose +Style/PreferredHashMethods: + Exclude: + - 'config/initializers/paperclip.rb' + +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantBegin: + Exclude: + - 'config/initializers/simple_form.rb' + +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantConstantBase: + Exclude: + - 'config/environments/production.rb' + - 'config/initializers/sidekiq.rb' + - 'config/initializers/statsd.rb' + - 'config/locales/sr-Latn.rb' + - 'config/locales/sr.rb' + +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: SafeForConstants. +Style/RedundantFetchBlock: + Exclude: + - 'config/initializers/1_hosts.rb' + - 'config/initializers/chewy.rb' + - 'config/initializers/devise.rb' + - 'config/initializers/paperclip.rb' + - 'config/puma.rb' + # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpCharacterClass: Exclude: @@ -2239,6 +2567,7 @@ Style/RedundantRegexpCharacterClass: - 'app/models/domain_allow.rb' - 'app/models/domain_block.rb' - 'app/services/fetch_oembed_service.rb' + - 'config/initializers/rack_attack.rb' - 'lib/tasks/emojis.rake' - 'lib/tasks/mastodon.rake' @@ -2249,6 +2578,7 @@ Style/RedundantRegexpEscape: - 'app/models/account.rb' - 'app/models/tag.rb' - 'app/services/fetch_link_card_service.rb' + - 'config/initializers/twitter_regex.rb' - 'lib/paperclip/color_extractor.rb' - 'lib/tasks/mastodon.rake' @@ -2270,6 +2600,9 @@ Style/RegexpLiteral: - 'app/services/backup_service.rb' - 'app/services/fetch_oembed_service.rb' - 'app/services/search_service.rb' + - 'config/initializers/rack_attack.rb' + - 'config/initializers/twitter_regex.rb' + - 'config/routes.rb' - 'lib/mastodon/premailer_webpack_strategy.rb' - 'lib/tasks/mastodon.rake' @@ -2317,6 +2650,73 @@ Style/SlicingWithRange: - 'lib/mastodon/premailer_webpack_strategy.rb' - 'lib/tasks/repo.rake' +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, require_no_parentheses +Style/StabbyLambdaParentheses: + Exclude: + - 'config/environments/production.rb' + - 'config/initializers/content_security_policy.rb' + +# This cop supports safe autocorrection (--autocorrect). +Style/StderrPuts: + Exclude: + - 'config/boot.rb' + +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'config/initializers/paperclip.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'config/environments/production.rb' + - 'config/initializers/backtrace_silencers.rb' + - 'config/initializers/http_client_proxy.rb' + - 'config/initializers/rack_attack.rb' + - 'config/initializers/webauthn.rb' + - 'config/routes.rb' + +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. +# AllowedMethods: define_method, mail, respond_to +Style/SymbolProc: + Exclude: + - 'config/initializers/omniauth.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'config/environments/development.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'config/initializers/paperclip.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'config/environments/production.rb' + - 'config/environments/test.rb' + +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: percent + MinSize: 6 + # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/Gemfile b/Gemfile index e5353a08c9..b5669582bf 100644 --- a/Gemfile +++ b/Gemfile @@ -105,6 +105,8 @@ group :development, :test do gem 'i18n-tasks', '~> 1.0', require: false gem 'rspec-rails', '~> 6.0' gem 'rspec_chunked', '~> 0.6' + + gem 'rubocop-capybara', require: false gem 'rubocop-performance', require: false gem 'rubocop-rails', require: false gem 'rubocop-rspec', require: false diff --git a/Gemfile.lock b/Gemfile.lock index c7e1d17504..8b16b9308b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -613,19 +613,19 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.27.0) parser (>= 3.2.1.0) - rubocop-capybara (2.17.0) + rubocop-capybara (2.17.1) rubocop (~> 1.41) rubocop-performance (1.16.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.4) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.18.1) + rubocop-rspec (2.19.0) rubocop (~> 1.33) rubocop-capybara (~> 2.17) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby-saml (1.13.0) nokogiri (>= 1.10.5) rexml @@ -864,6 +864,7 @@ DEPENDENCIES rspec_chunked (~> 0.6) rspec_junit_formatter (~> 0.6) rubocop + rubocop-capybara rubocop-performance rubocop-rails rubocop-rspec diff --git a/app/helpers/languages_helper.rb b/app/helpers/languages_helper.rb index 5843947584..bbf0a97fc3 100644 --- a/app/helpers/languages_helper.rb +++ b/app/helpers/languages_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop:disable Metrics/ModuleLength, Style/WordArray +# rubocop:disable Metrics/ModuleLength module LanguagesHelper ISO_639_1 = { @@ -275,4 +275,4 @@ module LanguagesHelper end end -# rubocop:enable Metrics/ModuleLength, Style/WordArray +# rubocop:enable Metrics/ModuleLength