rubocop-obsession 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d3c586b21811a0a13b55a84253df3c26febb690ea9585b960c9c93d08a982e
4
- data.tar.gz: 00e2f95178bd563b816a8b961b25470115ad2d25249c5b0c9f2921cd23d6df74
3
+ metadata.gz: d393d8af056f32d108c9c0f272cf6a6ccf2158d33caf91a950ca317f9da2a9cb
4
+ data.tar.gz: 822e9f0697a1559eb91755d9f2702a9d121727c89e9715e9c48ab447ff702220
5
5
  SHA512:
6
- metadata.gz: 5c5f2748fc138701c397c0952250f3a42a7f810e2830ba2421b7cfc526511bd31ad1f788ab7863ef86546848c8c18586d9e45feef025d14bdec12b232304a401
7
- data.tar.gz: 07c03a46b82ee6038f9ed5cdc7cb1358c58334a183827bb4b8908c2634a819aec88cc938dd451fc2b8182d734765dc284ce4059ea70d4e87a8b8b8e8ed3b98b6
6
+ metadata.gz: 9dc017470f824de21567bf7ec06ea9e372f5edc147932f715e8bdb3a8b60ef6cdfb1a84905b33c9ae0e340cf8515455e59374ec22121c6b4b36296204527918d
7
+ data.tar.gz: d4a5f84c5714d34ae2733e4f13fb58a089955d83c546ff411a34614bf2178a749f8acd1fc31bd4cbacb3d6fd5d85b24a0648fb7545f44a7a60110d1aa194494f
@@ -11,8 +11,8 @@ module RuboCop
11
11
  # - For small loops, you can just use normal conditions instead of `next`.
12
12
  # `break` is allowed.
13
13
  #
14
- # Note: Sometimes loops can also be rethought, like transforming a `loop`
15
- # + `break` into a `while`.
14
+ # Note: Sometimes loops can also be rethought, like transforming a
15
+ # `loop` + `break` into a `while`.
16
16
  #
17
17
  # @example
18
18
  #
@@ -11,6 +11,19 @@ module RuboCop
11
11
  # stale TODOs. Sometimes developers really mean to work on their TODOs
12
12
  # soon, but then Product re-prioritizes their work, or the developer
13
13
  # leaves the company, and never gets a chance to tackle them.
14
+ #
15
+ # @example
16
+ #
17
+ # # bad
18
+ # # TODO: remove this method when we ship the new signup flow
19
+ # def my_method
20
+ # ...
21
+ # end
22
+ #
23
+ # # good
24
+ # def my_method
25
+ # ...
26
+ # end
14
27
  class NoTodos < Base
15
28
  MSG = 'Avoid TODO comment, create a task in your project management tool instead.'
16
29
  KEYWORD_REGEX = /(^|[^\w])(TODO|FIXME|OPTIMIZE|HACK)($|[^\w])/i
@@ -18,14 +18,18 @@ module RuboCop
18
18
  # @example
19
19
  #
20
20
  # # bad
21
- # add_column :languages, :items, :jsonb
21
+ # def change
22
+ # add_column :languages, :items, :jsonb
23
+ # end
22
24
  #
23
25
  # # good
24
- # add_column :languages,
25
- # :items,
26
- # :jsonb,
27
- # default: [],
28
- # comment: "Example: [{ 'name': 'ruby' }, { 'name': 'python' }]"
26
+ # def change
27
+ # add_column :languages,
28
+ # :items,
29
+ # :jsonb,
30
+ # default: [],
31
+ # comment: "Example: [{ 'name': 'ruby' }, { 'name': 'python' }]"
32
+ # end
29
33
  class FullyDefinedJsonField < Base
30
34
  def_node_matcher :json_field?, <<~PATTERN
31
35
  (send nil? :add_column _ _ (sym {:json :jsonb}) ...)
@@ -19,12 +19,14 @@ module RuboCop
19
19
  #
20
20
  # # bad
21
21
  # after_update_commit :crawl_rss, if: :rss_changed?
22
+ #
22
23
  # def crawl_rss
23
24
  # ...
24
25
  # end
25
26
  #
26
27
  # # good
27
28
  # after_update_commit :crawl_rss
29
+ #
28
30
  # def crawl_rss
29
31
  # return if !rss_changed?
30
32
  # ...
@@ -13,6 +13,23 @@ module RuboCop
13
13
  # of the DB migration. The reason should be detailed and reviewed by a
14
14
  # knowledgeable PR reviewer. Failure to follow instructions may bring your
15
15
  # app down.
16
+ #
17
+ # @example
18
+ #
19
+ # # bad
20
+ # class RemoveSourceUrlFromBlogPosts < ActiveRecord::Migration[8.0]
21
+ # def change
22
+ # safety_assured { remove_column :blog_posts, :source_url }
23
+ # end
24
+ # end
25
+ #
26
+ # # good
27
+ # class RemoveSourceUrlFromBlogPosts < ActiveRecord::Migration[8.0]
28
+ # # Safe because this column was ignored with self.ignored_columns in PR #1234
29
+ # def change
30
+ # safety_assured { remove_column :blog_posts, :source_url }
31
+ # end
32
+ # end
16
33
  class SafetyAssuredComment < Base
17
34
  MSG =
18
35
  'Add `# Safe because <reason>` comment above safety_assured. ' \
@@ -8,15 +8,17 @@ if defined?(RuboCop::RSpec)
8
8
  #
9
9
  # @example
10
10
  #
11
- # describe '#domain' do
12
- # context do
13
- # let(:url) { Url.new('http://www.some-site.com/some-page') }
14
- # it { expect(url.domain).to eq 'some-site.com' }
15
- # end
11
+ # describe Url do
12
+ # describe '#domain' do
13
+ # context do
14
+ # let(:url) { Url.new('http://www.some-site.com/some-page') }
15
+ # it { expect(url.domain).to eq 'some-site.com' }
16
+ # end
16
17
  #
17
- # context do
18
- # let(:url) { Url.new('some-site.com') }
19
- # it { expect(url.domain).to eq 'some-site.com' }
18
+ # context do
19
+ # let(:url) { Url.new('some-site.com') }
20
+ # it { expect(url.domain).to eq 'some-site.com' }
21
+ # end
20
22
  # end
21
23
  # end
22
24
  class EmptyLineAfterFinalLet < RSpec::EmptyLineAfterFinalLet
@@ -1,5 +1,5 @@
1
1
  module Rubocop
2
2
  module Obsession
3
- VERSION = '0.1.7'
3
+ VERSION = '0.1.8'
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require 'active_support'
2
2
  require 'active_support/core_ext/object/blank'
3
+ require 'active_support/core_ext/string/inflections'
3
4
  require 'rubocop'
4
5
 
5
6
  require_relative 'cop/mixin/helpers'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-obsession
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerome Dalbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-03 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport