rubocop-discourse 3.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +7 -12
- data/lib/rubocop/cop/discourse/time_eq_matcher.rb +1 -1
- data/rubocop-core.yml +0 -7
- data/rubocop-discourse.gemspec +1 -1
- data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +27 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 891bf23985f5f43eb7c159ea17d37796d1506bda70d0543ee8db898b4959117d
|
4
|
+
data.tar.gz: 4f6070c33571f3366a15d855af0cf54bfbbd17fc25fb1d81a6117945057500c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 325c00e05fab4174022dfe6a2f01f20be7d259050fe2585ea928382cad408199d0801eb3a1f10ac8608321d42437b13db05e7dad8dcac87b70789f014e49702f
|
7
|
+
data.tar.gz: 8fabe70bb7af7c15459a434f2f54b79e074c2f4e8e254853f9d1fd6cd9d248046388b47431c9832c907882d9516b4530d5cf2e733570e001a9620871c2a07f09
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,25 +4,20 @@ on:
|
|
4
4
|
pull_request:
|
5
5
|
push:
|
6
6
|
branches:
|
7
|
-
- master
|
8
7
|
- main
|
8
|
+
|
9
9
|
jobs:
|
10
10
|
build:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
|
13
13
|
steps:
|
14
|
-
- uses: actions/checkout@
|
14
|
+
- uses: actions/checkout@v3
|
15
15
|
|
16
16
|
- name: Setup ruby
|
17
|
-
uses:
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
18
|
with:
|
19
|
-
ruby-version: 2.6
|
20
|
-
|
21
|
-
- name: Setup bundler
|
22
|
-
run: gem install bundler
|
23
|
-
|
24
|
-
- name: Setup gems
|
25
|
-
run: bundle install
|
19
|
+
ruby-version: '2.6'
|
20
|
+
bundler-cache: true
|
26
21
|
|
27
22
|
- name: Rubocop
|
28
23
|
run: bundle exec rubocop
|
@@ -31,12 +26,12 @@ jobs:
|
|
31
26
|
run: bundle exec rspec spec
|
32
27
|
|
33
28
|
publish:
|
34
|
-
if: github.event_name == 'push' &&
|
29
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
35
30
|
needs: build
|
36
31
|
runs-on: ubuntu-latest
|
37
32
|
|
38
33
|
steps:
|
39
|
-
- uses: actions/checkout@
|
34
|
+
- uses: actions/checkout@v3
|
40
35
|
|
41
36
|
- name: Release Gem
|
42
37
|
uses: discourse/publish-rubygems-action@v2
|
data/rubocop-core.yml
CHANGED
@@ -50,10 +50,3 @@ Lint/ShadowingOuterLocalVariable:
|
|
50
50
|
|
51
51
|
Bundler/OrderedGems:
|
52
52
|
Enabled: false
|
53
|
-
|
54
|
-
# Enable Layout/LineLength because certain cops that most projects use
|
55
|
-
# (e.g. Style/IfUnlessModifier) require Layout/LineLength to be enabled.
|
56
|
-
# By leaving it disabled, those rules will mis-fire.
|
57
|
-
Layout/LineLength:
|
58
|
-
Enabled: true
|
59
|
-
Max: 240
|
data/rubocop-discourse.gemspec
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RuboCop::Cop::Discourse::TimeEqMatcher, :config do
|
6
|
+
subject(:cop) { described_class.new(config) }
|
7
|
+
|
8
|
+
let(:config) do
|
9
|
+
RuboCop::Config.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "raises an offense if a timestamp is compared using `eq`" do
|
13
|
+
inspect_source(<<~RUBY)
|
14
|
+
expect(user.created_at).to eq(Time.zone.now)
|
15
|
+
RUBY
|
16
|
+
|
17
|
+
expect(cop.offenses.first.message).to eq(described_class::MSG)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "passes if a timestamp is compared using `eq_time`" do
|
21
|
+
inspect_source(<<~RUBY)
|
22
|
+
expect(user.created_at).to eq_time(Time.zone.now)
|
23
|
+
RUBY
|
24
|
+
|
25
|
+
expect(cop.offenses).to be_empty
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-discourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb
|
107
107
|
- spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb
|
108
108
|
- spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb
|
109
|
+
- spec/lib/rubocop/cop/time_eq_matcher_spec.rb
|
109
110
|
- spec/spec_helper.rb
|
110
111
|
- stree-compat.yml
|
111
112
|
homepage: https://github.com/discourse/rubocop-discourse
|