rubocop-discourse 2.6.0 → 3.0.1
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 +4 -4
- data/.github/workflows/ci.yml +7 -12
- data/default.yml +4 -19
- data/lib/rubocop/cop/discourse/time_eq_matcher.rb +1 -1
- data/rubocop-core.yml +7 -77
- data/rubocop-discourse.gemspec +1 -1
- data/rubocop-layout.yml +76 -0
- data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +27 -0
- data/stree-compat.yml +21 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3d65cb32d6a544fd2b03dee2c2b423d865bf3b9c1957087038beb1ec1de1e08
|
4
|
+
data.tar.gz: 7beaaa46315bf22a20a11eed14e1ee8a787cf23026a974be936533cbee6e3da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1126149b306f738ef8874dbe94cd4f9c816fc9b3d50617a1677ce3b1755950e72f21d436e0f6896817c91fcfa044c597ac230c5a37b1c787132d9d1f4c9ac9e
|
7
|
+
data.tar.gz: 5b3f747371f9eecd0f26ec04c0158eda78be9539d03a7e1a7a6893b6383f14884a7ae29ea3e858bbd08e32522d04ab637bbcc22d661a8186d2bd12b33a8a96bf
|
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/default.yml
CHANGED
@@ -1,21 +1,6 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-discourse
|
3
|
-
|
4
1
|
inherit_from:
|
5
|
-
- ./
|
6
|
-
- ./rubocop-
|
7
|
-
|
8
|
-
AllCops:
|
9
|
-
TargetRubyVersion: 2.6
|
10
|
-
DisabledByDefault: true
|
11
|
-
Exclude:
|
12
|
-
- "db/schema.rb"
|
13
|
-
- "bundle/**/*"
|
14
|
-
- "vendor/**/*"
|
15
|
-
- "**/node_modules/**/*"
|
16
|
-
- "public/**/*"
|
17
|
-
- "plugins/**/gems/**/*"
|
18
|
-
- "plugins/**/vendor/**/*"
|
2
|
+
- ./stree-compat.yml
|
3
|
+
- ./rubocop-layout.yml
|
19
4
|
|
20
|
-
|
21
|
-
Enabled:
|
5
|
+
Layout/LineLength:
|
6
|
+
Enabled: false
|
data/rubocop-core.yml
CHANGED
@@ -38,83 +38,6 @@ Style/GlobalVars:
|
|
38
38
|
- 'spec/**/*.rb'
|
39
39
|
- 'plugins/*/spec/**/*'
|
40
40
|
|
41
|
-
# Align `when` with `case`.
|
42
|
-
Layout/CaseIndentation:
|
43
|
-
Enabled: true
|
44
|
-
|
45
|
-
# Align comments with method definitions.
|
46
|
-
Layout/CommentIndentation:
|
47
|
-
Enabled: true
|
48
|
-
|
49
|
-
# No extra empty lines.
|
50
|
-
Layout/EmptyLines:
|
51
|
-
Enabled: true
|
52
|
-
|
53
|
-
# Two spaces, no tabs (for indentation).
|
54
|
-
Layout/IndentationWidth:
|
55
|
-
Enabled: true
|
56
|
-
|
57
|
-
Layout/SpaceAfterColon:
|
58
|
-
Enabled: true
|
59
|
-
|
60
|
-
Layout/SpaceAfterComma:
|
61
|
-
Enabled: true
|
62
|
-
|
63
|
-
Layout/SpaceAroundEqualsInParameterDefault:
|
64
|
-
Enabled: true
|
65
|
-
|
66
|
-
Layout/SpaceAroundKeyword:
|
67
|
-
Enabled: true
|
68
|
-
|
69
|
-
Layout/SpaceAroundOperators:
|
70
|
-
Enabled: true
|
71
|
-
|
72
|
-
Layout/SpaceBeforeFirstArg:
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
# Use `foo {}` not `foo{}`.
|
76
|
-
Layout/SpaceBeforeBlockBraces:
|
77
|
-
Enabled: true
|
78
|
-
|
79
|
-
# Use `foo { bar }` not `foo {bar}`.
|
80
|
-
Layout/SpaceInsideBlockBraces:
|
81
|
-
Enabled: true
|
82
|
-
|
83
|
-
# Use `{ a: 1 }` not `{a:1}`.
|
84
|
-
Layout/SpaceInsideHashLiteralBraces:
|
85
|
-
Enabled: true
|
86
|
-
|
87
|
-
Layout/SpaceInsideParens:
|
88
|
-
Enabled: true
|
89
|
-
|
90
|
-
# Detect hard tabs, no hard tabs.
|
91
|
-
Layout/IndentationStyle:
|
92
|
-
Enabled: true
|
93
|
-
|
94
|
-
# Blank lines should not have any spaces.
|
95
|
-
Layout/TrailingEmptyLines:
|
96
|
-
Enabled: true
|
97
|
-
|
98
|
-
# No trailing whitespace.
|
99
|
-
Layout/TrailingWhitespace:
|
100
|
-
Enabled: true
|
101
|
-
|
102
|
-
Layout/BlockAlignment:
|
103
|
-
Enabled: true
|
104
|
-
|
105
|
-
# Align `end` with the matching keyword or starting expression except for
|
106
|
-
# assignments, where it should be aligned with the LHS.
|
107
|
-
Layout/EndAlignment:
|
108
|
-
Enabled: true
|
109
|
-
EnforcedStyleAlignWith: variable
|
110
|
-
|
111
|
-
Layout/MultilineMethodCallIndentation:
|
112
|
-
Enabled: true
|
113
|
-
EnforcedStyle: indented
|
114
|
-
|
115
|
-
Layout/HashAlignment:
|
116
|
-
Enabled: true
|
117
|
-
|
118
41
|
Lint/Debugger:
|
119
42
|
Enabled: true
|
120
43
|
|
@@ -127,3 +50,10 @@ Lint/ShadowingOuterLocalVariable:
|
|
127
50
|
|
128
51
|
Bundler/OrderedGems:
|
129
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
data/rubocop-layout.yml
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Align `when` with `case`.
|
2
|
+
Layout/CaseIndentation:
|
3
|
+
Enabled: true
|
4
|
+
|
5
|
+
# Align comments with method definitions.
|
6
|
+
Layout/CommentIndentation:
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
# No extra empty lines.
|
10
|
+
Layout/EmptyLines:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
# Two spaces, no tabs (for indentation).
|
14
|
+
Layout/IndentationWidth:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Layout/SpaceAfterColon:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Layout/SpaceAfterComma:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
Layout/SpaceAroundKeyword:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
Layout/SpaceAroundOperators:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
Layout/SpaceBeforeFirstArg:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# Use `foo {}` not `foo{}`.
|
36
|
+
Layout/SpaceBeforeBlockBraces:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# Use `foo { bar }` not `foo {bar}`.
|
40
|
+
Layout/SpaceInsideBlockBraces:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
44
|
+
Layout/SpaceInsideHashLiteralBraces:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Layout/SpaceInsideParens:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
# Detect hard tabs, no hard tabs.
|
51
|
+
Layout/IndentationStyle:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
# Blank lines should not have any spaces.
|
55
|
+
Layout/TrailingEmptyLines:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# No trailing whitespace.
|
59
|
+
Layout/TrailingWhitespace:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Layout/BlockAlignment:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
# Align `end` with the matching keyword or starting expression except for
|
66
|
+
# assignments, where it should be aligned with the LHS.
|
67
|
+
Layout/EndAlignment:
|
68
|
+
Enabled: true
|
69
|
+
EnforcedStyleAlignWith: variable
|
70
|
+
|
71
|
+
Layout/MultilineMethodCallIndentation:
|
72
|
+
Enabled: true
|
73
|
+
EnforcedStyle: indented
|
74
|
+
|
75
|
+
Layout/HashAlignment:
|
76
|
+
Enabled: true
|
@@ -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
|
data/stree-compat.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-discourse
|
3
|
+
|
4
|
+
inherit_from:
|
5
|
+
- ./rubocop-core.yml
|
6
|
+
- ./rubocop-rspec.yml
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
TargetRubyVersion: 2.6
|
10
|
+
DisabledByDefault: true
|
11
|
+
Exclude:
|
12
|
+
- "db/schema.rb"
|
13
|
+
- "bundle/**/*"
|
14
|
+
- "vendor/**/*"
|
15
|
+
- "**/node_modules/**/*"
|
16
|
+
- "public/**/*"
|
17
|
+
- "plugins/**/gems/**/*"
|
18
|
+
- "plugins/**/vendor/**/*"
|
19
|
+
|
20
|
+
Discourse:
|
21
|
+
Enabled: true
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -99,13 +99,16 @@ files:
|
|
99
99
|
- lib/rubocop/discourse/inject.rb
|
100
100
|
- rubocop-core.yml
|
101
101
|
- rubocop-discourse.gemspec
|
102
|
+
- rubocop-layout.yml
|
102
103
|
- rubocop-rspec.yml
|
103
104
|
- spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb
|
104
105
|
- spec/lib/rubocop/cop/no_mixing_multisite_and_standard_specs_spec.rb
|
105
106
|
- spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb
|
106
107
|
- spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb
|
107
108
|
- spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb
|
109
|
+
- spec/lib/rubocop/cop/time_eq_matcher_spec.rb
|
108
110
|
- spec/spec_helper.rb
|
111
|
+
- stree-compat.yml
|
109
112
|
homepage: https://github.com/discourse/rubocop-discourse
|
110
113
|
licenses:
|
111
114
|
- MIT
|