mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 19:13:13 +01:00
479 lines
8.9 KiB
YAML
479 lines
8.9 KiB
YAML
require:
|
|
- rubocop-rails
|
|
- rubocop-rspec
|
|
- rubocop-performance
|
|
|
|
AllCops:
|
|
TargetRubyVersion: 2.7
|
|
DisplayCopNames: true
|
|
DisplayStyleGuide: true
|
|
ExtraDetails: true
|
|
UseCache: true
|
|
CacheRootDirectory: tmp
|
|
NewCops: enable
|
|
Exclude:
|
|
- db/schema.rb
|
|
- 'app/views/**/*'
|
|
- 'config/**/*'
|
|
- 'bin/*'
|
|
- 'Rakefile'
|
|
- 'node_modules/**/*'
|
|
- 'Vagrantfile'
|
|
- 'vendor/**/*'
|
|
- 'lib/json_ld/*'
|
|
- 'lib/templates/**/*'
|
|
|
|
Bundler/OrderedGems:
|
|
Enabled: false
|
|
|
|
Layout/AccessModifierIndentation:
|
|
EnforcedStyle: indent
|
|
|
|
Layout/EmptyLineAfterMagicComment:
|
|
Enabled: false
|
|
|
|
Layout/EmptyLineAfterGuardClause:
|
|
Enabled: false
|
|
|
|
Layout/EmptyLineBetweenDefs:
|
|
AllowAdjacentOneLineDefs: true
|
|
|
|
Layout/EmptyLinesAroundAttributeAccessor:
|
|
Enabled: true
|
|
|
|
Layout/FirstHashElementIndentation:
|
|
EnforcedStyle: consistent
|
|
|
|
Layout/HashAlignment:
|
|
Enabled: false
|
|
|
|
Layout/SpaceAroundMethodCallOperator:
|
|
Enabled: true
|
|
|
|
Layout/SpaceInsideHashLiteralBraces:
|
|
EnforcedStyle: space
|
|
|
|
Lint/DeprecatedOpenSSLConstant:
|
|
Enabled: true
|
|
|
|
Lint/DuplicateElsifCondition:
|
|
Enabled: true
|
|
|
|
Lint/MixedRegexpCaptureTypes:
|
|
Enabled: true
|
|
|
|
Lint/RaiseException:
|
|
Enabled: true
|
|
|
|
Lint/StructNewOverride:
|
|
Enabled: true
|
|
|
|
Lint/UselessAccessModifier:
|
|
ContextCreatingMethods:
|
|
- class_methods
|
|
|
|
Metrics/AbcSize:
|
|
Max: 34 # RuboCop default 17
|
|
Exclude:
|
|
- 'lib/**/*cli*.rb'
|
|
- db/*migrate/**/*
|
|
- lib/paperclip/color_extractor.rb
|
|
- app/workers/scheduler/follow_recommendations_scheduler.rb
|
|
- app/services/activitypub/fetch*_service.rb
|
|
- lib/paperclip/**/*
|
|
CountRepeatedAttributes: false
|
|
AllowedMethods:
|
|
- update_media_attachments!
|
|
- account_link_to
|
|
- attempt_oembed
|
|
- build_crutches
|
|
- calculate_scores
|
|
- cc
|
|
- dump_actor!
|
|
- filter_from_home?
|
|
- hydrate
|
|
- import_bookmarks!
|
|
- import_relationships!
|
|
- initialize
|
|
- link_to_mention
|
|
- log_target
|
|
- matches_time_window?
|
|
- parse_metadata
|
|
- perform_statuses_search!
|
|
- privatize_media_attachments!
|
|
- process_update
|
|
- publish_media_attachments!
|
|
- remotable_attachment
|
|
- render_initial_state
|
|
- render_with_cache
|
|
- searchable_by
|
|
- self.cached_filters_for
|
|
- set_fetchable_attributes!
|
|
- signed_request_actor
|
|
- statuses_to_delete
|
|
- update_poll!
|
|
|
|
Metrics/BlockLength:
|
|
Max: 55
|
|
Exclude:
|
|
- 'lib/mastodon/*_cli.rb'
|
|
CountComments: false
|
|
CountAsOne: [array, heredoc]
|
|
AllowedMethods:
|
|
- task
|
|
- namespace
|
|
- class_methods
|
|
- included
|
|
|
|
Metrics/BlockNesting:
|
|
Max: 3
|
|
Exclude:
|
|
- 'lib/mastodon/*_cli.rb'
|
|
|
|
Metrics/ClassLength:
|
|
CountComments: false
|
|
Max: 500
|
|
CountAsOne: [array, heredoc]
|
|
Exclude:
|
|
- 'lib/mastodon/*_cli.rb'
|
|
|
|
Metrics/CyclomaticComplexity:
|
|
Max: 12
|
|
Exclude:
|
|
- lib/mastodon/*cli*.rb
|
|
- db/*migrate/**/*
|
|
AllowedMethods:
|
|
- attempt_oembed
|
|
- blocked?
|
|
- build_crutches
|
|
- calculate_scores
|
|
- cc
|
|
- discover_endpoint!
|
|
- filter_from_home?
|
|
- hydrate
|
|
- klass
|
|
- link_to_mention
|
|
- log_target
|
|
- matches_time_window?
|
|
- patch_for_forwarding!
|
|
- preprocess_attributes!
|
|
- process_update
|
|
- remotable_attachment
|
|
- scan_text!
|
|
- self.cached_filters_for
|
|
- set_fetchable_attributes!
|
|
- setup_redis_env_url
|
|
- update_media_attachments!
|
|
|
|
Layout/LineLength:
|
|
Max: 140 # RuboCop default 120
|
|
AllowHeredoc: true
|
|
AllowURI: true
|
|
IgnoreCopDirectives: true
|
|
AllowedPatterns:
|
|
# Allow comments to be long lines
|
|
- !ruby/regexp / \# .*$/
|
|
- !ruby/regexp /^\# .*$/
|
|
Exclude:
|
|
- lib/**/*cli*.rb
|
|
- db/*migrate/**/*
|
|
- db/seeds/**/*
|
|
|
|
Metrics/MethodLength:
|
|
CountComments: false
|
|
CountAsOne: [array, heredoc]
|
|
Max: 25 # RuboCop default 10
|
|
Exclude:
|
|
- 'lib/mastodon/*_cli.rb'
|
|
AllowedMethods:
|
|
- account_link_to
|
|
- attempt_oembed
|
|
- body_with_limit
|
|
- build_crutches
|
|
- cached_filters_for
|
|
- calculate_scores
|
|
- check_webfinger!
|
|
- clean_feeds!
|
|
- collection_items
|
|
- collection_presenter
|
|
- copy_account_notes!
|
|
- deduplicate_accounts!
|
|
- deduplicate_conversations!
|
|
- deduplicate_local_accounts!
|
|
- deduplicate_statuses!
|
|
- deduplicate_tags!
|
|
- deduplicate_users!
|
|
- discover_endpoint!
|
|
- extract_extra_uris_with_indices
|
|
- extract_hashtags_with_indices
|
|
- extract_mentions_or_lists_with_indices
|
|
- filter_from_home?
|
|
- from_elasticsearch
|
|
- handle_explicit_update!
|
|
- handle_mark_as_sensitive!
|
|
- hsl_to_rgb
|
|
- import_bookmarks!
|
|
- import_domain_blocks!
|
|
- import_relationships!
|
|
- ldap_options
|
|
- matches_time_window?
|
|
- outbox_presenter
|
|
- pam_get_user
|
|
- parallelize_with_progress
|
|
- parse_and_transform
|
|
- patch_for_forwarding!
|
|
- populate_home
|
|
- post_process_style
|
|
- preload_cache_collection_target_statuses
|
|
- privatize_media_attachments!
|
|
- provides_callback_for
|
|
- publish_media_attachments!
|
|
- relevant_account_timestamp
|
|
- remotable_attachment
|
|
- rgb_to_hsl
|
|
- rss_status_content_format
|
|
- set_fetchable_attributes!
|
|
- setup_redis_env_url
|
|
- signed_request_actor
|
|
- to_preview_card_attributes
|
|
- upgrade_storage_filesystem
|
|
- upgrade_storage_s3
|
|
- user_settings_params
|
|
- hydrate
|
|
- cc
|
|
- self_destruct
|
|
|
|
Metrics/ModuleLength:
|
|
CountComments: false
|
|
Max: 200
|
|
CountAsOne: [array, heredoc]
|
|
|
|
Metrics/ParameterLists:
|
|
Max: 5 # RuboCop default 5
|
|
CountKeywordArgs: true # RuboCop default true
|
|
MaxOptionalParameters: 3 # RuboCop default 3
|
|
Exclude:
|
|
- app/models/concerns/account_interactions.rb
|
|
- app/services/activitypub/fetch_remote_account_service.rb
|
|
- app/services/activitypub/fetch_remote_actor_service.rb
|
|
|
|
Metrics/PerceivedComplexity:
|
|
Max: 16 # RuboCop default 8
|
|
AllowedMethods:
|
|
- attempt_oembed
|
|
- build_crutches
|
|
- calculate_scores
|
|
- deduplicate_users!
|
|
- discover_endpoint!
|
|
- filter_from_home?
|
|
- hydrate
|
|
- patch_for_forwarding!
|
|
- process_update
|
|
- remove_orphans
|
|
- update_media_attachments!
|
|
|
|
Naming/MemoizedInstanceVariableName:
|
|
Enabled: false
|
|
|
|
Naming/MethodParameterName:
|
|
Enabled: true
|
|
|
|
Rails:
|
|
Enabled: true
|
|
|
|
Rails/ApplicationController:
|
|
Enabled: false
|
|
Exclude:
|
|
- 'app/controllers/well_known/**/*.rb'
|
|
|
|
Rails/BelongsTo:
|
|
Enabled: false
|
|
|
|
Rails/ContentTag:
|
|
Enabled: false
|
|
|
|
Rails/EnumHash:
|
|
Enabled: false
|
|
|
|
Rails/Exit:
|
|
Exclude:
|
|
- 'lib/mastodon/*'
|
|
- 'lib/cli.rb'
|
|
|
|
Rails/FilePath:
|
|
Enabled: false
|
|
|
|
Rails/HasAndBelongsToMany:
|
|
Enabled: false
|
|
|
|
Rails/HasManyOrHasOneDependent:
|
|
Enabled: false
|
|
|
|
Rails/HelperInstanceVariable:
|
|
Enabled: false
|
|
|
|
Rails/HttpStatus:
|
|
Enabled: false
|
|
|
|
Rails/IndexBy:
|
|
Enabled: false
|
|
|
|
Rails/InverseOf:
|
|
Enabled: false
|
|
|
|
Rails/LexicallyScopedActionFilter:
|
|
Enabled: false
|
|
|
|
Rails/OutputSafety:
|
|
Enabled: true
|
|
|
|
Rails/RakeEnvironment:
|
|
Enabled: false
|
|
|
|
Rails/RedundantForeignKey:
|
|
Enabled: false
|
|
|
|
Rails/SkipsModelValidations:
|
|
Enabled: false
|
|
|
|
Rails/UniqueValidationWithoutIndex:
|
|
Enabled: false
|
|
|
|
Style/AccessorGrouping:
|
|
Enabled: true
|
|
|
|
Style/AccessModifierDeclarations:
|
|
Enabled: false
|
|
|
|
Style/ArrayCoercion:
|
|
Enabled: true
|
|
|
|
Style/BisectedAttrAccessor:
|
|
Enabled: true
|
|
|
|
Style/CaseLikeIf:
|
|
Enabled: false
|
|
|
|
Style/ClassAndModuleChildren:
|
|
Enabled: false
|
|
|
|
Style/CollectionMethods:
|
|
Enabled: true
|
|
PreferredMethods:
|
|
find_all: 'select'
|
|
|
|
Style/Documentation:
|
|
Enabled: false
|
|
|
|
Style/DoubleNegation:
|
|
Enabled: true
|
|
|
|
Style/ExpandPathArguments:
|
|
Enabled: false
|
|
|
|
Style/ExponentialNotation:
|
|
Enabled: true
|
|
|
|
Style/FormatString:
|
|
Enabled: false
|
|
|
|
Style/FormatStringToken:
|
|
Enabled: false
|
|
|
|
Style/FrozenStringLiteralComment:
|
|
Enabled: true
|
|
|
|
Style/GuardClause:
|
|
Enabled: false
|
|
|
|
Style/HashAsLastArrayItem:
|
|
Enabled: false
|
|
|
|
Style/HashEachMethods:
|
|
Enabled: true
|
|
|
|
Style/HashLikeCase:
|
|
Enabled: true
|
|
|
|
Style/HashTransformKeys:
|
|
Enabled: true
|
|
|
|
Style/HashTransformValues:
|
|
Enabled: false
|
|
|
|
Style/HashSyntax:
|
|
Enabled: true
|
|
EnforcedStyle: ruby19_no_mixed_keys
|
|
|
|
Style/IfUnlessModifier:
|
|
Enabled: false
|
|
|
|
Style/InverseMethods:
|
|
Enabled: false
|
|
|
|
Style/Lambda:
|
|
Enabled: false
|
|
|
|
Style/MutableConstant:
|
|
Enabled: false
|
|
|
|
Style/PercentLiteralDelimiters:
|
|
PreferredDelimiters:
|
|
'%i': '()'
|
|
'%w': '()'
|
|
|
|
Style/PerlBackrefs:
|
|
AutoCorrect: false
|
|
|
|
Style/RedundantFetchBlock:
|
|
Enabled: true
|
|
|
|
Style/RedundantFileExtensionInRequire:
|
|
Enabled: true
|
|
|
|
Style/RedundantRegexpCharacterClass:
|
|
Enabled: false
|
|
|
|
Style/RedundantRegexpEscape:
|
|
Enabled: false
|
|
|
|
Style/RedundantReturn:
|
|
Enabled: true
|
|
|
|
Style/RedundantBegin:
|
|
Enabled: false
|
|
|
|
Style/RegexpLiteral:
|
|
Enabled: false
|
|
|
|
Style/RescueStandardError:
|
|
Enabled: true
|
|
|
|
Style/SignalException:
|
|
Enabled: false
|
|
|
|
Style/SlicingWithRange:
|
|
Enabled: true
|
|
|
|
Style/SymbolArray:
|
|
Enabled: false
|
|
|
|
Style/TrailingCommaInArrayLiteral:
|
|
EnforcedStyleForMultiline: 'comma'
|
|
|
|
Style/TrailingCommaInHashLiteral:
|
|
EnforcedStyleForMultiline: 'comma'
|
|
|
|
Style/UnpackFirst:
|
|
Enabled: false
|
|
|
|
RSpec/ScatteredSetup:
|
|
Enabled: false
|
|
RSpec/ImplicitExpect:
|
|
Enabled: false
|
|
RSpec/NamedSubject:
|
|
Enabled: false
|
|
RSpec/DescribeClass:
|
|
Enabled: false
|
|
RSpec/LetSetup:
|
|
Enabled: false
|