mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Rubocop: Consistent spacing
This commit is contained in:
parent
bdfe13c527
commit
228cc1c92a
@ -1,5 +1,6 @@
|
|||||||
# This configuration was generated by `rubocop --auto-gen-config`
|
# This configuration was generated by
|
||||||
# on 2015-08-30 23:03:50 -0500 using RuboCop version 0.31.0.
|
# `rubocop --auto-gen-config`
|
||||||
|
# on 2015-08-31 04:23:33 -0500 using RuboCop version 0.33.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
@ -8,67 +9,74 @@
|
|||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: AllowSafeAssignment.
|
# Configuration parameters: AllowSafeAssignment.
|
||||||
Lint/AssignmentInCondition:
|
Lint/AssignmentInCondition:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Lint/EmptyEnsure:
|
Lint/EmptyEnsure:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/serializers/adapter_for_test.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Lint/HandleExceptions:
|
Lint/HandleExceptions:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'Rakefile'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Lint/UnusedBlockArgument:
|
Lint/UnusedBlockArgument:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 9
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Lint/UnusedMethodArgument:
|
Lint/UnusedMethodArgument:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter/null.rb'
|
||||||
|
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
||||||
|
- 'test/fixtures/poro.rb'
|
||||||
|
- 'test/lint_test.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Lint/UselessAccessModifier:
|
Lint/UselessAccessModifier:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializable_resource.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
Lint/UselessAssignment:
|
Lint/UselessAssignment:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'bench/perf.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
|
||||||
|
- 'test/test_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/fixtures/poro.rb'
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 8
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Rails/TimeZone:
|
Rails/TimeZone:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/action_controller/serialization_test.rb'
|
||||||
# Offense count: 1
|
- 'test/fixtures/poro.rb'
|
||||||
# Cop supports --auto-correct.
|
- 'test/serializers/cache_test.rb'
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/AccessModifierIndentation:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 16
|
# Offense count: 16
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
|
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
|
||||||
Style/AlignHash:
|
Style/AlignHash:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/action_controller/json_api/pagination_test.rb'
|
||||||
# Offense count: 6
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/AlignParameters:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/AndOr:
|
Style/AndOr:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/lint.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -80,63 +88,51 @@ Style/BlockDelimiters:
|
|||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/BracesAroundHashParameters:
|
Style/BracesAroundHashParameters:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/action_controller/adapter_selector_test.rb'
|
||||||
|
- 'test/action_controller/json_api/pagination_test.rb'
|
||||||
|
- 'test/action_controller/serialization_test.rb'
|
||||||
|
- 'test/adapter/json_api/linked_test.rb'
|
||||||
|
- 'test/adapter/json_api/pagination_links_test.rb'
|
||||||
|
- 'test/adapter/null_test.rb'
|
||||||
|
- 'test/adapter_test.rb'
|
||||||
|
- 'test/array_serializer_test.rb'
|
||||||
|
- 'test/serializable_resource_test.rb'
|
||||||
|
- 'test/serializers/associations_test.rb'
|
||||||
|
- 'test/serializers/attribute_test.rb'
|
||||||
|
- 'test/serializers/attributes_test.rb'
|
||||||
|
- 'test/serializers/fieldset_test.rb'
|
||||||
|
- 'test/serializers/root_test.rb'
|
||||||
|
- 'test/serializers/urls_test.rb'
|
||||||
|
|
||||||
# Offense count: 167
|
# Offense count: 167
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 5
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/CommentIndentation:
|
Style/CommentIndentation:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'active_model_serializers.gemspec'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/DoubleNegation:
|
Style/DoubleNegation:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializable_resource.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/EachWithObject:
|
Style/EachWithObject:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/fieldset.rb'
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EmptyLines:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EmptyLinesAroundAccessModifier:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/EmptyLinesAroundBlockBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 16
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/EmptyLinesAroundClassBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EmptyLinesAroundMethodBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/EmptyLinesAroundModuleBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Configuration parameters: MinBodyLength.
|
# Configuration parameters: MinBodyLength.
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api.rb'
|
||||||
|
- 'test/capture_warnings.rb'
|
||||||
|
|
||||||
# Offense count: 12
|
# Offense count: 12
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -147,7 +143,11 @@ Style/HashSyntax:
|
|||||||
# Offense count: 9
|
# Offense count: 9
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/IndentArray:
|
Style/IndentArray:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/adapter/json/has_many_test.rb'
|
||||||
|
- 'test/adapter/json_api/json_api_test.rb'
|
||||||
|
- 'test/adapter/json_api/pagination_links_test.rb'
|
||||||
|
- 'test/adapter/json_test.rb'
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 8
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -159,23 +159,29 @@ Style/IndentHash:
|
|||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/IndentationConsistency:
|
Style/IndentationConsistency:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/action_controller/serialization_scope_name_test.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: Width.
|
# Configuration parameters: Width.
|
||||||
Style/IndentationWidth:
|
Style/IndentationWidth:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializable_resource.rb'
|
||||||
|
- 'lib/active_model/serializer/fieldset.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/Lambda:
|
Style/Lambda:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/MethodCallParentheses:
|
Style/MethodCallParentheses:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter/json.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -192,12 +198,14 @@ Style/MultilineOperationIndentation:
|
|||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/NegatedIf:
|
Style/NegatedIf:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/action_controller/serialization.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
||||||
Style/Next:
|
Style/Next:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -208,95 +216,56 @@ Style/NumericLiterals:
|
|||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: PreferredDelimiters.
|
# Configuration parameters: PreferredDelimiters.
|
||||||
Style/PercentLiteralDelimiters:
|
Style/PercentLiteralDelimiters:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'active_model_serializers.gemspec'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/PerlBackrefs:
|
Style/PerlBackrefs:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/fixtures/poro.rb'
|
||||||
|
- 'test/serializers/associations_test.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
||||||
Style/PredicateName:
|
Style/PredicateName:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/adapter.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter/json_api.rb'
|
||||||
|
- 'lib/active_model/serializer/associations.rb'
|
||||||
|
- 'test/action_controller/json_api/linked_test.rb'
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 7
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/RedundantSelf:
|
Style/RedundantSelf:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer.rb'
|
||||||
|
- 'lib/active_model/serializer/associations.rb'
|
||||||
|
- 'test/fixtures/poro.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowAsExpressionSeparator.
|
# Configuration parameters: AllowAsExpressionSeparator.
|
||||||
Style/Semicolon:
|
Style/Semicolon:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/fieldset.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/SignalException:
|
Style/SignalException:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer.rb'
|
||||||
|
- 'lib/active_model/serializer/adapter.rb'
|
||||||
|
- 'lib/active_model/serializer/fieldset.rb'
|
||||||
|
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowIfMethodIsEmpty.
|
# Configuration parameters: AllowIfMethodIsEmpty.
|
||||||
Style/SingleLineMethods:
|
Style/SingleLineMethods:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/serializers/serializer_for_test.rb'
|
||||||
# Offense count: 26
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SpaceAfterColon:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 7
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SpaceAfterComma:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SpaceAfterNot:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/SpaceAroundEqualsInParameterDefault:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 39
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: MultiSpaceAllowedForOperators.
|
|
||||||
Style/SpaceAroundOperators:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/SpaceBeforeBlockBraces:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 8
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
||||||
Style/SpaceInsideBlockBraces:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 20
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SpaceInsideBrackets:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 179
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
|
||||||
Style/SpaceInsideHashLiteralBraces:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SpaceInsideParens:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@ -306,42 +275,41 @@ Style/StringLiteralsInInterpolation:
|
|||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/StructInheritance:
|
Style/StructInheritance:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'bench/perf.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: IgnoredMethods.
|
# Configuration parameters: IgnoredMethods.
|
||||||
Style/SymbolProc:
|
Style/SymbolProc:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/generators/serializer/serializer_generator.rb'
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 8
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
Style/TrailingBlankLines:
|
Style/TrailingBlankLines:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
||||||
|
- 'lib/generators/serializer/serializer_generator.rb'
|
||||||
|
- 'test/adapter/fragment_cache_test.rb'
|
||||||
|
- 'test/adapter/json_api/json_api_test.rb'
|
||||||
|
- 'test/adapter/null_test.rb'
|
||||||
|
- 'test/serializers/cache_test.rb'
|
||||||
|
- 'test/serializers/fieldset_test.rb'
|
||||||
|
- 'test/support/stream_capture.rb'
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
||||||
Style/TrailingComma:
|
Style/TrailingComma:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'test/action_controller/adapter_selector_test.rb'
|
||||||
# Offense count: 2
|
- 'test/action_controller/serialization_test.rb'
|
||||||
# Cop supports --auto-correct.
|
- 'test/adapter/json_api/belongs_to_test.rb'
|
||||||
Style/TrailingWhitespace:
|
- 'test/adapter/json_api/linked_test.rb'
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/UnlessElse:
|
Style/UnlessElse:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'lib/active_model/serializer.rb'
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/UnneededPercentQ:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: WordRegex.
|
|
||||||
Style/WordArray:
|
|
||||||
MinSize: 2
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|||||||
spec.platform = Gem::Platform::RUBY
|
spec.platform = Gem::Platform::RUBY
|
||||||
spec.authors = ['Steve Klabnik']
|
spec.authors = ['Steve Klabnik']
|
||||||
spec.email = ['steve@steveklabnik.com']
|
spec.email = ['steve@steveklabnik.com']
|
||||||
spec.summary = %q{Conventions-based JSON generation for Rails.}
|
spec.summary = 'Conventions-based JSON generation for Rails.'
|
||||||
spec.description = %q{ActiveModel::Serializers allows you to generate your JSON in an object-oriented and convention-driven manner.}
|
spec.description = 'ActiveModel::Serializers allows you to generate your JSON in an object-oriented and convention-driven manner.'
|
||||||
spec.homepage = 'https://github.com/rails-api/active_model_serializers'
|
spec.homepage = 'https://github.com/rails-api/active_model_serializers'
|
||||||
spec.license = 'MIT'
|
spec.license = 'MIT'
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
require 'set'
|
require 'set'
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class SerializableResource
|
class SerializableResource
|
||||||
|
|
||||||
ADAPTER_OPTION_KEYS = Set.new([:include, :fields, :adapter])
|
ADAPTER_OPTION_KEYS = Set.new([:include, :fields, :adapter])
|
||||||
|
|
||||||
def initialize(resource, options = {})
|
def initialize(resource, options = {})
|
||||||
@ -79,6 +78,5 @@ module ActiveModel
|
|||||||
ActiveModelSerializers.silence_warnings do
|
ActiveModelSerializers.silence_warnings do
|
||||||
attr_reader :resource, :adapter_opts, :serializer_opts
|
attr_reader :resource, :adapter_opts, :serializer_opts
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,7 +13,6 @@ module ActiveModel
|
|||||||
include Configuration
|
include Configuration
|
||||||
include Associations
|
include Associations
|
||||||
|
|
||||||
|
|
||||||
# Matches
|
# Matches
|
||||||
# "c:/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>'"
|
# "c:/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>'"
|
||||||
# AND
|
# AND
|
||||||
|
|||||||
@ -2,7 +2,6 @@ module ActiveModel
|
|||||||
class Serializer
|
class Serializer
|
||||||
class Adapter
|
class Adapter
|
||||||
class FragmentCache
|
class FragmentCache
|
||||||
|
|
||||||
attr_reader :serializer
|
attr_reader :serializer
|
||||||
|
|
||||||
def initialize(adapter, serializer, options)
|
def initialize(adapter, serializer, options)
|
||||||
|
|||||||
@ -46,7 +46,6 @@ module ActiveModel
|
|||||||
def fragment_cache(cached_hash, non_cached_hash)
|
def fragment_cache(cached_hash, non_cached_hash)
|
||||||
Json::FragmentCache.new().fragment_cache(cached_hash, non_cached_hash)
|
Json::FragmentCache.new().fragment_cache(cached_hash, non_cached_hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,11 +4,9 @@ module ActiveModel
|
|||||||
class Adapter
|
class Adapter
|
||||||
class Json < Adapter
|
class Json < Adapter
|
||||||
class FragmentCache
|
class FragmentCache
|
||||||
|
|
||||||
def fragment_cache(cached_hash, non_cached_hash)
|
def fragment_cache(cached_hash, non_cached_hash)
|
||||||
non_cached_hash.merge cached_hash
|
non_cached_hash.merge cached_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -4,7 +4,6 @@ module ActiveModel
|
|||||||
class Adapter
|
class Adapter
|
||||||
class JsonApi < Adapter
|
class JsonApi < Adapter
|
||||||
class FragmentCache
|
class FragmentCache
|
||||||
|
|
||||||
def fragment_cache(root, cached_hash, non_cached_hash)
|
def fragment_cache(root, cached_hash, non_cached_hash)
|
||||||
hash = {}
|
hash = {}
|
||||||
core_cached = cached_hash.first
|
core_cached = cached_hash.first
|
||||||
@ -16,7 +15,6 @@ module ActiveModel
|
|||||||
|
|
||||||
hash.deep_merge no_root_non_cache.deep_merge no_root_cache
|
hash.deep_merge no_root_non_cache.deep_merge no_root_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,7 +10,6 @@ module ActiveModel
|
|||||||
# Association.new(:comments, CommentSummarySerializer)
|
# Association.new(:comments, CommentSummarySerializer)
|
||||||
#
|
#
|
||||||
Association = Struct.new(:name, :serializer, :options) do
|
Association = Struct.new(:name, :serializer, :options) do
|
||||||
|
|
||||||
# @return [Symbol]
|
# @return [Symbol]
|
||||||
#
|
#
|
||||||
def key
|
def key
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class Fieldset
|
class Fieldset
|
||||||
|
|
||||||
def initialize(fields, root = nil)
|
def initialize(fields, root = nil)
|
||||||
@root = root
|
@root = root
|
||||||
@raw_fields = fields
|
@raw_fields = fields
|
||||||
@ -36,7 +35,6 @@ module ActiveModel
|
|||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,7 +15,6 @@ module ActiveModel::Serializer::Lint
|
|||||||
# always return +{}+, and the tests would pass. It is up to you to ensure
|
# always return +{}+, and the tests would pass. It is up to you to ensure
|
||||||
# that the values are semantically meaningful.
|
# that the values are semantically meaningful.
|
||||||
module Tests
|
module Tests
|
||||||
|
|
||||||
# Passes if the object responds to <tt>serializable_hash</tt> and if it takes
|
# Passes if the object responds to <tt>serializable_hash</tt> and if it takes
|
||||||
# zero or one arguments.
|
# zero or one arguments.
|
||||||
# Fails otherwise.
|
# Fails otherwise.
|
||||||
@ -126,6 +125,5 @@ module ActiveModel::Serializer::Lint
|
|||||||
def assert_instance_of(result, name)
|
def assert_instance_of(result, name)
|
||||||
assert result.instance_of?(name), "#{result} should be an instance of #{name}"
|
assert result.instance_of?(name), "#{result} should be an instance of #{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,7 +8,6 @@ module ActiveModelSerializers
|
|||||||
ensure
|
ensure
|
||||||
$VERBOSE = verbose
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'active_model'
|
require 'active_model'
|
||||||
|
|||||||
@ -75,7 +75,7 @@ module ActionController
|
|||||||
|
|
||||||
def render_collection_with_include
|
def render_collection_with_include
|
||||||
setup_post
|
setup_post
|
||||||
render json: [@post], include: ['author', 'comments'], adapter: :json_api
|
render json: [@post], include: %w(author comments), adapter: :json_api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,6 @@ module ActionController
|
|||||||
|
|
||||||
def render_array_using_implicit_serializer_and_meta
|
def render_array_using_implicit_serializer_and_meta
|
||||||
with_adapter ActiveModel::Serializer::Adapter::JsonApi do
|
with_adapter ActiveModel::Serializer::Adapter::JsonApi do
|
||||||
|
|
||||||
@profiles = [
|
@profiles = [
|
||||||
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||||
]
|
]
|
||||||
@ -138,6 +137,7 @@ module ActionController
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_cached_serializer(obj)
|
def generate_cached_serializer(obj)
|
||||||
ActiveModel::SerializableResource.new(obj).to_json
|
ActiveModel::SerializableResource.new(obj).to_json
|
||||||
end
|
end
|
||||||
|
|||||||
@ -108,7 +108,7 @@ module ActiveModel
|
|||||||
|
|
||||||
def test_include_linked_resources_with_type_name
|
def test_include_linked_resources_with_type_name
|
||||||
serializer = BlogSerializer.new(@blog)
|
serializer = BlogSerializer.new(@blog)
|
||||||
adapter = ActiveModel::Serializer::Adapter::JsonApi.new(serializer, include: ['writer', 'articles'])
|
adapter = ActiveModel::Serializer::Adapter::JsonApi.new(serializer, include: %w(writer articles))
|
||||||
linked = adapter.serializable_hash[:included]
|
linked = adapter.serializable_hash[:included]
|
||||||
expected = [
|
expected = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -88,7 +88,6 @@ module ActiveModel
|
|||||||
]
|
]
|
||||||
assert_equal(expected, @adapter.serializable_hash[:data])
|
assert_equal(expected, @adapter.serializable_hash[:data])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -24,7 +24,7 @@ module ActiveModel
|
|||||||
@serializer = PostPreviewSerializer.new(@post)
|
@serializer = PostPreviewSerializer.new(@post)
|
||||||
@adapter = ActiveModel::Serializer::Adapter::JsonApi.new(
|
@adapter = ActiveModel::Serializer::Adapter::JsonApi.new(
|
||||||
@serializer,
|
@serializer,
|
||||||
include: ['comments', 'author']
|
include: %w(comments author)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,6 @@ module ActiveModel
|
|||||||
@post.author = @author
|
@post.author = @author
|
||||||
@blog = Blog.new(id: 1, name: 'My Blog!!')
|
@blog = Blog.new(id: 1, name: 'My Blog!!')
|
||||||
@post.blog = @blog
|
@post.blog = @blog
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_custom_keys
|
def test_custom_keys
|
||||||
|
|||||||
@ -53,5 +53,6 @@ class CaptureWarnings
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
attr_reader :stderr_file, :app_root, :output_dir, :bundle_dir, :fail_on_warnings
|
attr_reader :stderr_file, :app_root, :output_dir, :bundle_dir, :fail_on_warnings
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,27 +7,21 @@ module ActiveModel
|
|||||||
|
|
||||||
class CompliantResource
|
class CompliantResource
|
||||||
def serializable_hash(options = nil)
|
def serializable_hash(options = nil)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_attribute_for_serialization(name)
|
def read_attribute_for_serialization(name)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(options = nil)
|
def as_json(options = nil)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_json(options = nil)
|
def to_json(options = nil)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cache_key
|
def cache_key
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.model_name
|
def self.model_name
|
||||||
@ -38,7 +32,6 @@ module ActiveModel
|
|||||||
def setup
|
def setup
|
||||||
@resource = CompliantResource.new
|
@resource = CompliantResource.new
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -20,7 +20,6 @@ module ActiveModel
|
|||||||
adapter = ActiveModel::Serializer.adapter
|
adapter = ActiveModel::Serializer.adapter
|
||||||
assert_equal ActiveModel::Serializer::Adapter::Null, adapter
|
assert_equal ActiveModel::Serializer::Adapter::Null, adapter
|
||||||
ensure
|
ensure
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_overwrite_adapter_with_class
|
def test_overwrite_adapter_with_class
|
||||||
|
|||||||
@ -26,7 +26,6 @@ module ActiveModel
|
|||||||
def test_required_fields
|
def test_required_fields
|
||||||
assert_equal({ name: 'Name 1', description: 'Description 1' },
|
assert_equal({ name: 'Name 1', description: 'Description 1' },
|
||||||
@profile_serializer.attributes(fields: [:name, :description], required_fields: [:name]))
|
@profile_serializer.attributes(fields: [:name, :description], required_fields: [:name]))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_attributes_inheritance_definition
|
def test_attributes_inheritance_definition
|
||||||
|
|||||||
@ -155,6 +155,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def render_object_with_cache(obj)
|
def render_object_with_cache(obj)
|
||||||
ActiveModel::SerializableResource.new(obj).serializable_hash
|
ActiveModel::SerializableResource.new(obj).serializable_hash
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,9 +3,8 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class FieldsetTest < Minitest::Test
|
class FieldsetTest < Minitest::Test
|
||||||
|
|
||||||
def test_fieldset_with_hash
|
def test_fieldset_with_hash
|
||||||
fieldset = ActiveModel::Serializer::Fieldset.new({'post' => ['id', 'title'], 'coment' => ['body']})
|
fieldset = ActiveModel::Serializer::Fieldset.new({ 'post' => %w(id title), 'coment' => ['body'] })
|
||||||
|
|
||||||
assert_equal(
|
assert_equal(
|
||||||
{ :post => [:id, :title], :coment => [:body] },
|
{ :post => [:id, :title], :coment => [:body] },
|
||||||
|
|||||||
@ -3,7 +3,6 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class RootTest < Minitest::Test
|
class RootTest < Minitest::Test
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@virtual_value = VirtualValue.new(id: 1)
|
@virtual_value = VirtualValue.new(id: 1)
|
||||||
end
|
end
|
||||||
@ -17,7 +16,6 @@ module ActiveModel
|
|||||||
serializer = VirtualValueSerializer.new(@virtual_value)
|
serializer = VirtualValueSerializer.new(@virtual_value)
|
||||||
assert_equal('virtual_value', serializer.json_key)
|
assert_equal('virtual_value', serializer.json_key)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,7 +3,6 @@ require 'test_helper'
|
|||||||
module ActiveModel
|
module ActiveModel
|
||||||
class Serializer
|
class Serializer
|
||||||
class UrlsTest < Minitest::Test
|
class UrlsTest < Minitest::Test
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||||
@post = Post.new({ title: 'New Post', body: 'Body' })
|
@post = Post.new({ title: 'New Post', body: 'Body' })
|
||||||
|
|||||||
@ -13,7 +13,6 @@ require 'minitest/autorun'
|
|||||||
# Ensure backward compatibility with Minitest 4
|
# Ensure backward compatibility with Minitest 4
|
||||||
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
||||||
|
|
||||||
|
|
||||||
require 'capture_warnings'
|
require 'capture_warnings'
|
||||||
@capture_warnings = CaptureWarnings.new(fail_build = true)
|
@capture_warnings = CaptureWarnings.new(fail_build = true)
|
||||||
@capture_warnings.before_tests
|
@capture_warnings.before_tests
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user