gitlab-styles 6.6.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab/changelog_config.yml +13 -0
  3. data/.gitlab/merge_request_templates/Release.md +9 -31
  4. data/.gitlab-ci.yml +3 -1
  5. data/Dangerfile +5 -0
  6. data/gitlab-styles.gemspec +1 -0
  7. data/lib/gitlab/styles/common/banned_constants.rb +28 -0
  8. data/lib/gitlab/styles/rubocop/model_helpers.rb +1 -1
  9. data/lib/gitlab/styles/rubocop.rb +2 -2
  10. data/lib/gitlab/styles/version.rb +1 -1
  11. data/lib/rubocop/cop/active_record_dependent.rb +32 -0
  12. data/lib/rubocop/cop/active_record_serialize.rb +20 -0
  13. data/lib/rubocop/cop/avoid_return_from_blocks.rb +77 -0
  14. data/lib/rubocop/cop/code_reuse/active_record.rb +80 -0
  15. data/lib/rubocop/cop/custom_error_class.rb +69 -0
  16. data/lib/rubocop/cop/fips/md5.rb +27 -0
  17. data/lib/rubocop/cop/fips/open_ssl.rb +31 -0
  18. data/lib/rubocop/cop/fips/sha1.rb +27 -0
  19. data/lib/rubocop/cop/gem_fetcher.rb +37 -0
  20. data/lib/rubocop/cop/in_batches.rb +18 -0
  21. data/lib/rubocop/cop/internal_affairs/deprecate_cop_helper.rb +39 -0
  22. data/lib/rubocop/cop/line_break_after_guard_clauses.rb +100 -0
  23. data/lib/rubocop/cop/line_break_around_conditional_block.rb +128 -0
  24. data/lib/rubocop/cop/migration/update_large_table.rb +60 -0
  25. data/lib/rubocop/cop/performance/rubyzip.rb +35 -0
  26. data/lib/rubocop/cop/polymorphic_associations.rb +25 -0
  27. data/lib/rubocop/cop/rails/include_url_helper.rb +27 -0
  28. data/lib/rubocop/cop/redirect_with_status.rb +46 -0
  29. data/lib/rubocop/cop/rspec/base.rb +14 -0
  30. data/lib/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb +47 -0
  31. data/lib/rubocop/cop/rspec/empty_line_after_let_block.rb +61 -0
  32. data/lib/rubocop/cop/rspec/empty_line_after_shared_example.rb +61 -0
  33. data/lib/rubocop/cop/rspec/example_starting_character.rb +120 -0
  34. data/lib/rubocop/cop/rspec/have_link_parameters.rb +44 -0
  35. data/lib/rubocop/cop/rspec/single_line_hook.rb +41 -0
  36. data/lib/rubocop/cop/rspec/verbose_include_metadata.rb +71 -0
  37. data/lib/rubocop/cop/style/hash_transformation.rb +83 -0
  38. data/lib/rubocop/cop/style/open_struct_use.rb +39 -0
  39. data/lib/rubocop/cop/without_reactive_cache.rb +16 -0
  40. data/rubocop-default.yml +1 -0
  41. data/rubocop-fips.yml +15 -0
  42. data/rubocop-rspec.yml +3 -2
  43. metadata +49 -27
  44. data/lib/gitlab/styles/rubocop/cop/active_record_dependent.rb +0 -32
  45. data/lib/gitlab/styles/rubocop/cop/active_record_serialize.rb +0 -24
  46. data/lib/gitlab/styles/rubocop/cop/code_reuse/active_record.rb +0 -130
  47. data/lib/gitlab/styles/rubocop/cop/custom_error_class.rb +0 -73
  48. data/lib/gitlab/styles/rubocop/cop/gem_fetcher.rb +0 -41
  49. data/lib/gitlab/styles/rubocop/cop/in_batches.rb +0 -22
  50. data/lib/gitlab/styles/rubocop/cop/internal_affairs/deprecate_cop_helper.rb +0 -43
  51. data/lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb +0 -104
  52. data/lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb +0 -132
  53. data/lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb +0 -64
  54. data/lib/gitlab/styles/rubocop/cop/performance/rubyzip.rb +0 -39
  55. data/lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb +0 -29
  56. data/lib/gitlab/styles/rubocop/cop/rails/include_url_helper.rb +0 -31
  57. data/lib/gitlab/styles/rubocop/cop/redirect_with_status.rb +0 -50
  58. data/lib/gitlab/styles/rubocop/cop/rspec/base.rb +0 -18
  59. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb +0 -51
  60. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_let_block.rb +0 -65
  61. data/lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_shared_example.rb +0 -65
  62. data/lib/gitlab/styles/rubocop/cop/rspec/example_starting_character.rb +0 -124
  63. data/lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb +0 -48
  64. data/lib/gitlab/styles/rubocop/cop/rspec/single_line_hook.rb +0 -45
  65. data/lib/gitlab/styles/rubocop/cop/rspec/verbose_include_metadata.rb +0 -75
  66. data/lib/gitlab/styles/rubocop/cop/style/hash_transformation.rb +0 -87
  67. data/lib/gitlab/styles/rubocop/cop/style/open_struct_use.rb +0 -43
  68. data/lib/gitlab/styles/rubocop/cop/without_reactive_cache.rb +0 -20
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gitlab
4
- module Styles
5
- module Rubocop
6
- module Cop
7
- module Style
8
- # This cop flags uses of OpenStruct, as it is now officially discouraged
9
- # to be used for performance, version compatibility, and potential security issues.
10
- #
11
- # See also:
12
- # - https://rubyreferences.github.io/rubychanges/3.0.html#standard-library
13
- # - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
14
- # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67855
15
- class OpenStructUse < RuboCop::Cop::Cop
16
- MSG = 'Avoid using `OpenStruct`. It is officially discouraged. ' \
17
- 'Replace it with `Struct`, `Hash`, or RSpec doubles. ' \
18
- 'See https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats'
19
-
20
- def_node_matcher :uses_open_struct?, <<-PATTERN
21
- (const {nil? (cbase)} :OpenStruct)
22
- PATTERN
23
-
24
- def on_const(node)
25
- return unless uses_open_struct?(node)
26
- return if custom_class_or_module_definition?(node)
27
-
28
- add_offense(node)
29
- end
30
-
31
- private
32
-
33
- def custom_class_or_module_definition?(node)
34
- parent = node.parent
35
-
36
- (parent.class_type? || parent.module_type?) && node.left_siblings.empty?
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gitlab
4
- module Styles
5
- module Rubocop
6
- module Cop
7
- # Cop that prevents the use of `without_reactive_cache`
8
- class WithoutReactiveCache < RuboCop::Cop::Cop
9
- MSG = 'without_reactive_cache is for debugging purposes only. Please use with_reactive_cache.'
10
-
11
- def on_send(node)
12
- return unless node.children[1] == :without_reactive_cache
13
-
14
- add_offense(node, location: :selector)
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end