rimless 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfed89b34243fa4fd3232152dfd848d95bafc3b4d4a8190708b2d1679e052457
4
- data.tar.gz: 4d2186084e65445e3ebc300ecdf229afe35d602c91e39422ee6010ce43a8ead3
3
+ metadata.gz: e1b5957c80f5acbd1e6325410fa95f4765bfee153d509781074b9a680047c342
4
+ data.tar.gz: f19fe3dd85d3b8b4aa050fefdb7f73d764c5223be72a8db6adce7862635e2446
5
5
  SHA512:
6
- metadata.gz: 2c15140a5b0f189dce414dd00e40a678c7f345dc3d91ccf9fbde5476aa4075569ff0edbadbfcc5d0f6bbc1f6a5141b9df1f54ff609638038e60272775f65ffbf
7
- data.tar.gz: 54b265581fbacbdd6486212d1867946f472295af8002e8a60f63a21a73f784fc2684c6502ac5369edb69fd3b0148473c17ea340f8dded94577ed7e71f0fbb7dc
6
+ metadata.gz: 4aa33a161c9f008523781c426aea9943a7295bd4bff73049edcbcdae8b4a9bc7eb9c3c6b0e58ebd1792bf8c4b5d6cba35ad886b716532ef917a92d2f599cd328
7
+ data.tar.gz: 837b9ee7470ab9a55fc1cb452558cfce631e530986f3bb7a7772ec381dabf8f423bce029f7bcdb026b921f4414465791da389fff8d2a832b4b75f702670c5dbe
data/.rubocop.yml CHANGED
@@ -1,3 +1,7 @@
1
+ inherit_from:
2
+ - https://potpourri.hausgold.de/config/rubocop.yml
3
+ - https://potpourri.hausgold.de/config/rubocop-gem.yml
4
+
1
5
  plugins:
2
6
  - rubocop-rspec
3
7
  - rubocop-rails
@@ -5,9 +9,6 @@ plugins:
5
9
  Rails:
6
10
  Enabled: true
7
11
 
8
- Style/Documentation:
9
- Enabled: true
10
-
11
12
  AllCops:
12
13
  NewCops: enable
13
14
  SuggestExtensions: false
@@ -21,43 +22,12 @@ AllCops:
21
22
  - gemfiles/**/*
22
23
  - doc/kafka-playground/**/*
23
24
 
24
- Metrics/BlockLength:
25
- Exclude:
26
- - Rakefile
27
- - '*.gemspec'
28
- - spec/**/*.rb
29
- - '**/*.rake'
30
- - doc/**/*.rb
31
-
32
- # MFA is not yet enabled for our gems yet.
33
- Gemspec/RequireMFA:
34
- Enabled: false
35
-
36
- # We stay with the original Ruby Style Guide recommendation.
37
- Layout/LineLength:
38
- Max: 80
39
-
40
- # Document all the things.
41
- Style/DocumentationMethod:
42
- Enabled: true
43
- RequireForNonPublicMethods: true
44
-
45
25
  # It's a deliberate idiom in RSpec.
46
26
  # See: https://github.com/bbatsov/rubocop/issues/4222
47
27
  Lint/AmbiguousBlockAssociation:
48
28
  Exclude:
49
29
  - "spec/**/*"
50
30
 
51
- # Because +expect_any_instance_of().to have_received()+ is not
52
- # supported with the +with(hash_including)+ matchers
53
- RSpec/MessageSpies:
54
- EnforcedStyle: receive
55
-
56
- # Because nesting makes sense here to group the feature tests
57
- # more effective. This increases maintainability.
58
- RSpec/NestedGroups:
59
- Max: 4
60
-
61
31
  # Disable regular Rails spec paths.
62
32
  Rails/FilePath:
63
33
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 2.2.0 (19 December 2025)
6
+
7
+ * Migrated to a shared Rubocop configuration for HAUSGOLD gems ([#62](https://github.com/hausgold/rimless/pull/62))
8
+
5
9
  ### 2.1.0 (23 October 2025)
6
10
 
7
11
  * Added support for Rails 8.1 ([#60](https://github.com/hausgold/rimless/pull/60))
data/Envfile CHANGED
@@ -1,3 +1,4 @@
1
1
  LANG=en_US.UTF-8
2
2
  LANGUAGE=en_US.UTF-8
3
3
  LC_ALL=en_US.UTF-8
4
+ RUBOCOP_CACHE_ROOT=/app/tmp
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 HAUSGOLD | talocasa GmbH
3
+ Copyright (c) 2025 HAUSGOLD | talocasa GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -132,7 +132,7 @@ Registry. The subject naming convention is mostly the same as the Apache Kafka
132
132
  Topic convention, except the allowed characters. [Apache
133
133
  Avro](https://avro.apache.org/docs/1.8.2/spec.html#namespace) just allows
134
134
  `[A-Za-z0-9_]` and no numbers on the first char. The application environment
135
- prefix allows the usage of the very same Schema Registry instance for multipe
135
+ prefix allows the usage of the very same Schema Registry instance for multiple
136
136
  environments and the application name just reflects the schema origin.
137
137
  Convention rules:
138
138
 
@@ -167,7 +167,7 @@ Each schema template MUST end with the `.avsc.erb` extension to be picked up,
167
167
  even in recursive directory structures. You can make use of the ERB templating
168
168
  or not, but rimless just looks for these templates. When it comes to
169
169
  structuring the Avro Schemas it is important that the file path reflects the
170
- embeded schema namespace correctly. So when `$(pwd)/config/avro_schemas` is our
170
+ embedded schema namespace correctly. So when `$(pwd)/config/avro_schemas` is our
171
171
  schema namespace root, then the `production.identity_api.user_v1` schema
172
172
  converts to the
173
173
  `$(pwd)/config/avro_schemas/compiled/production/identity_api/user_v1.avsc`
@@ -456,7 +456,7 @@ were the user (eg. a frontend client) just can add whatever comes to his mind
456
456
  for later processing. Its not searchable, its never touched by the backend, but
457
457
  its present.
458
458
 
459
- Thats a case we're experienced and kind of solved on the rimless gem. You can
459
+ That's a case we're experienced and kind of solved on the rimless gem. You can
460
460
  make use of the `Rimless.avro_schemaless_h` method to [sparsify the data
461
461
  recursively](https://github.com/simplymeasured/sparsify). Say you have the
462
462
  following metadata hash:
@@ -476,7 +476,7 @@ metadata = {
476
476
 
477
477
  It's messy, by design. From the Apache Avro perspective you just can define a
478
478
  map. The map keys are assumed to be strings - and the most hitting value data
479
- type is a string, too. Thats where hash sparsification comes in. The resulting
479
+ type is a string, too. That's where hash sparsification comes in. The resulting
480
480
  metadata hash looks like this and can be encoded by Apache Avro:
481
481
 
482
482
  ```ruby
@@ -500,10 +500,10 @@ Avro schema to be a string. Choice is yours.
500
500
  ### Writing tests for your messages
501
501
 
502
502
  Producing messages is a bliss with the rimless gem, but producing code needs to
503
- be tested as well. Thats why the gem ships some RSpec helpers and matchers for
503
+ be tested as well. That's why the gem ships some RSpec helpers and matchers for
504
504
  this purpose. A common situation is also handled by the RSpec extension: on the
505
505
  test environment (eg. a continuous integration service) its not likely to have
506
- a Apache Kafka/Confluent Schema Registry cluster available. Thats why actual
506
+ a Apache Kafka/Confluent Schema Registry cluster available. That's why actual
507
507
  calls to Kafka/Schema Registry are mocked away.
508
508
 
509
509
  First of all, just add `require 'rimless/rspec'` to your `spec_helper.rb` or
@@ -73,7 +73,7 @@ the creation of the `/etc/mdns.allow` file.
73
73
 
74
74
  ## What's in the box
75
75
 
76
- After the installation and bootup processes are finished you should have a
76
+ After the installation and boot-up processes are finished you should have a
77
77
  working Apache Kafka setup which includes the following:
78
78
 
79
79
  * A single node [Apache Kafka](https://kafka.apache.org/) (without Zookeeper,
@@ -108,7 +108,7 @@ Metadata for all topics (from broker 1001: kafka.playground.local:9092/1001):
108
108
  topic "test" with 1 partitions:
109
109
  ```
110
110
 
111
- Now start a second teminal playground container with `$ make shell` and run:
111
+ Now start a second terminal playground container with `$ make shell` and run:
112
112
 
113
113
  ```shell
114
114
  # Terminal B
@@ -17,9 +17,6 @@ module Karafka
17
17
  # This method is a wrapper to way Thor defines its commands.
18
18
  #
19
19
  # @param cli_class [Karafka::Cli] the class to bind to
20
- #
21
- # rubocop:disable Metrics/MethodLength -- because of the
22
- # monkey-patching logic
23
20
  def bind_to(cli_class)
24
21
  @aliases ||= []
25
22
  @options ||= []
@@ -49,7 +46,6 @@ module Karafka
49
46
  cli_class.map cmd_alias => name.to_s
50
47
  end
51
48
  end
52
- # rubocop:enable Metrics/MethodLength
53
49
  end
54
50
  end
55
51
  end
@@ -4,8 +4,6 @@ module Rimless
4
4
  # The top-level configuration handling.
5
5
  #
6
6
  # rubocop:disable Style/ClassVars -- because we split module code
7
- # rubocop:disable Metrics/BlockLength -- because this is how an
8
- # +ActiveSupport::Concern+ looks like
9
7
  module ConfigurationHandling
10
8
  extend ActiveSupport::Concern
11
9
 
@@ -81,5 +79,4 @@ module Rimless
81
79
  end
82
80
  end
83
81
  # rubocop:enable Style/ClassVars
84
- # rubocop:enable Metrics/BlockLength
85
82
  end
@@ -76,9 +76,6 @@ module Rimless
76
76
  end
77
77
 
78
78
  # Configure the pure basics on the Karafka application.
79
- #
80
- # rubocop:disable Metrics/MethodLength -- because of the various settings
81
- # rubocop:disable Metrics/AbcSize -- ditto
82
79
  def initialize_karafka!
83
80
  setup do |config|
84
81
  mapper = Rimless::Karafka::PassthroughMapper.new
@@ -93,8 +90,6 @@ module Rimless
93
90
  config.shutdown_timeout = 10
94
91
  end
95
92
  end
96
- # rubocop:enable Metrics/MethodLength
97
- # rubocop:enable Metrics/AbcSize
98
93
 
99
94
  # When we run in development mode, we want to write the logs
100
95
  # to file and to stdout.
@@ -147,8 +142,6 @@ module Rimless
147
142
  #
148
143
  # @param topics [Hash{Hash => Class}] the topic to consumer mapping
149
144
  # @yield the given block on the routing table
150
- #
151
- # rubocop:disable Metrics/MethodLength -- because of the Karafka DSL
152
145
  def topics(topics = [], &block)
153
146
  consumer_groups.draw do
154
147
  consumer_group(Rimless.configuration.client_id) do
@@ -168,7 +161,6 @@ module Rimless
168
161
 
169
162
  self
170
163
  end
171
- # rubocop:enable Metrics/MethodLength
172
164
 
173
165
  # Build the conventional Apache Kafka topic names from the given parts.
174
166
  # This allows various forms like single strings/symbols and a hash in the
@@ -2,9 +2,6 @@
2
2
 
3
3
  module Rimless
4
4
  # The top-level dependencies helpers.
5
- #
6
- # rubocop:disable Metrics/BlockLength -- because its an Active Support
7
- # concern
8
5
  module Dependencies
9
6
  extend ActiveSupport::Concern
10
7
 
@@ -18,8 +15,6 @@ module Rimless
18
15
  end
19
16
 
20
17
  # Set sensible defaults for the +WaterDrop+ gem.
21
- #
22
- # rubocop:disable Metrics/AbcSize -- because of the configuration mapping
23
18
  def configure_waterdrop
24
19
  # Skip WaterDrop configuration when no brokers/client id is available,
25
20
  # because it will raise. Its fine to have none available for situations
@@ -46,7 +41,6 @@ module Rimless
46
41
  config.kafka.required_acks = -1
47
42
  end
48
43
  end
49
- # rubocop:enable Metrics/AbcSize
50
44
 
51
45
  # Set sensible defaults for the +AvroTurf+ gem and (re)compile the Apache
52
46
  # Avro schema templates (ERB), so the gem can handle them properly.
@@ -72,5 +66,4 @@ module Rimless
72
66
  end
73
67
  end
74
68
  end
75
- # rubocop:enable Metrics/BlockLength
76
69
  end
@@ -5,8 +5,6 @@ module Rimless
5
5
  module KafkaHelpers
6
6
  extend ActiveSupport::Concern
7
7
 
8
- # rubocop:disable Metrics/BlockLength -- because its an Active Support
9
- # concern
10
8
  class_methods do
11
9
  # Generate a common topic name for Apache Kafka while taking care of
12
10
  # configured prefixes.
@@ -22,12 +20,6 @@ module Rimless
22
20
  # Rimless.topic(name: 'test', app: :fancy_app)
23
21
  # @example Full name - use as is
24
22
  # Rimless.topic(full_name: 'my.custom.topic.name')
25
- #
26
- # rubocop:disable Metrics/MethodLength -- because of the usage
27
- # flexibility
28
- # rubocop:disable Metrics/AbcSize -- ditto
29
- # rubocop:disable Metrics/CyclomaticComplexity -- ditto
30
- # rubocop:disable Metrics/PerceivedComplexity -- ditto
31
23
  def topic(*args)
32
24
  opts = args.last
33
25
  name = args.first if [String, Symbol].member?(args.first.class)
@@ -47,10 +39,6 @@ module Rimless
47
39
 
48
40
  "#{Rimless.topic_prefix(app)}#{name}".tr('_', '-')
49
41
  end
50
- # rubocop:enable Metrics/MethodLength
51
- # rubocop:enable Metrics/AbcSize
52
- # rubocop:enable Metrics/CyclomaticComplexity
53
- # rubocop:enable Metrics/PerceivedComplexity
54
42
 
55
43
  # Send a single message to Apache Kafka. The data is encoded according to
56
44
  # the given Apache Avro schema. The destination Kafka topic may be a
@@ -112,6 +100,5 @@ module Rimless
112
100
  WaterDrop::AsyncProducer.call(data, **args)
113
101
  end
114
102
  end
115
- # rubocop:enable Metrics/BlockLength
116
103
  end
117
104
  end
@@ -14,9 +14,9 @@ module Rimless
14
14
  return if params.raw_payload.nil?
15
15
 
16
16
  # We use sparsed hashes inside of Apache Avro messages for schema-less
17
- # blobs of data, such as loosely structured metadata blobs. Thats a
17
+ # blobs of data, such as loosely structured metadata blobs. That's a
18
18
  # somewhat bad idea on strictly typed and defined messages, but their
19
- # occurence should be rare.
19
+ # occurrence should be rare.
20
20
  Rimless
21
21
  .decode(params.raw_payload)
22
22
  .then { |data| Sparsify(data, sparse_array: true) }
@@ -21,11 +21,6 @@ module Rimless
21
21
  # @param topic [String, Hash{Symbol => Mixed}] the actual message
22
22
  # topic (full as string, or parts via hash)
23
23
  # @return [OpenStruct] the fake deserialized Kafka message
24
- #
25
- # rubocop:disable Metrics/MethodLength -- because of the various
26
- # properties
27
- # rubocop:disable Style/OpenStructUse -- because existing specs may rely
28
- # on this data type
29
24
  def kafka_message(topic: nil, headers: {}, **payload)
30
25
  OpenStruct.new(
31
26
  topic: Rimless.topic(topic),
@@ -40,8 +35,6 @@ module Rimless
40
35
  deserialized: true
41
36
  )
42
37
  end
43
- # rubocop:enable Metrics/MethodLength
44
- # rubocop:enable Style/OpenStructUse
45
38
 
46
39
  # Capture all Apache Kafka messages of the given block.
47
40
  #
@@ -6,9 +6,6 @@ module Rimless
6
6
  # A set of Rimless/RSpec matchers.
7
7
  module Matchers
8
8
  # The Apache Kafka message expectation.
9
- #
10
- # rubocop:disable Metrics/ClassLength -- because its almost RSpec API
11
- # code
12
9
  class HaveSentKafkaMessage < ::RSpec::Matchers::BuiltIn::BaseMatcher
13
10
  include ::RSpec::Mocks::ExampleMethods
14
11
 
@@ -220,7 +217,6 @@ module Rimless
220
217
 
221
218
  # Setup the +WaterDrop+ spies and record each sent message.
222
219
  # because of the message decoding
223
- # rubocop:disable Metrics/MethodLength -- ditto
224
220
  def listen_to_messages
225
221
  decode = proc do |encoded|
226
222
  { encoded_data: encoded, data: Rimless.avro.decode(encoded) }
@@ -236,7 +232,6 @@ module Rimless
236
232
  nil
237
233
  end
238
234
  end
239
- # rubocop:enable Metrics/MethodLength
240
235
 
241
236
  # Serve the RSpec API and return the positive failure message.
242
237
  #
@@ -289,7 +284,6 @@ module Rimless
289
284
  result.join
290
285
  end
291
286
  end
292
- # rubocop:enable Metrics/ClassLength
293
287
 
294
288
  # Check for messages which were sent to Apache Kafka by the given block.
295
289
  #
data/lib/rimless/rspec.rb CHANGED
@@ -11,7 +11,7 @@ require 'karafka/testing/rspec/helpers'
11
11
  # this dependency as runtime, just as development. Therefore we added it.
12
12
  require 'avro_turf/test/fake_confluent_schema_registry_server'
13
13
 
14
- # Add a monkey patch to add propper Sinatra 4.x support
14
+ # Add a monkey patch to add proper Sinatra 4.x support
15
15
  class FakeConfluentSchemaRegistryServer
16
16
  # Allow any host name on tests
17
17
  set :host_authorization, { permitted_hosts: [] }
@@ -23,8 +23,6 @@ end
23
23
  raise 'No RSPEC_CONFIGURER is defined, webmock is missing?' \
24
24
  unless defined?(RSPEC_CONFIGURER)
25
25
 
26
- # rubocop:disable Metrics/BlockLength -- because we have to configure RSpec
27
- # properly
28
26
  RSPEC_CONFIGURER.configure do |config|
29
27
  config.include Rimless::RSpec::Helpers
30
28
  config.include Rimless::RSpec::Matchers
@@ -83,4 +81,3 @@ RSPEC_CONFIGURER.configure do |config|
83
81
  Rimless.consumer.initialize! if example.metadata[:type] == :consumer
84
82
  end
85
83
  end
86
- # rubocop:enable Metrics/BlockLength
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Rimless
5
5
  # The version of the +rimless+ gem
6
- VERSION = '2.1.0'
6
+ VERSION = '2.2.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rimless
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer