rubocop-yast 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: d341fded19f14ab6e0eb77ab182837c58d2721e3
4
- data.tar.gz: 6616bbcc871f6476a4d7f68c4866e876ff6da0c6
3
+ metadata.gz: 440ff0688d1a756f31597e9a7bead83c60682fbb
4
+ data.tar.gz: 1e7593995a22e3ddd79838378aab1d20e848709c
5
5
  SHA512:
6
- metadata.gz: 75e240206d5269e760688b2a369b221ba6f75a9e88385249a8721648549876c51daf9485d110e7488a98a34e025de6dd0b555594c76e8fd5df6f8a727c935ac7
7
- data.tar.gz: 59999ea017b585fc7db161977a9627bf835c1c8bb5e0e26109fadbfc9ec3ae096bb15e9bbd56c673665f04abf12f0774ca0d12a549268324a4a3ababe98cb6bd
6
+ metadata.gz: d5465be57775161e935f2a29adf12a91f24dcb17a8f654000d2e39b157e8e3b6483129a6c597b0de87ee5579c26718d9031c4a39887c8bb27de546cd4c10a186
7
+ data.tar.gz: 851a3358159679e9b4e10404b12e31a402a4e83ad94b3a9d3734b3b95fc87cffd522cb33096083bc54da7df78c71d93e2b48e6d8519e3e7b1176f636faf20805
@@ -12,12 +12,20 @@ module RuboCop
12
12
  # white list of allowed Builtins calls
13
13
  ALLOWED_FUNCTIONS = [
14
14
  # locale dependent sorting in not available in Ruby stdlib
15
- :lsort
15
+ :lsort,
16
+ # gettext helpers
17
+ :dgettext,
18
+ :dngettext,
19
+ :dpgettext
16
20
  ]
17
21
 
18
22
  BUILTINS_NODES = [
23
+ # Builtins.*
19
24
  s(:const, nil, :Builtins),
20
- s(:const, s(:cbase), :Builtins)
25
+ # Yast::Builtins.*
26
+ s(:const, s(:const, nil, :Yast), :Builtins),
27
+ # ::Yast::Builtins.*
28
+ s(:const, s(:const, s(:cbase), :Yast), :Builtins)
21
29
  ]
22
30
 
23
31
  def on_send(node)
@@ -3,6 +3,6 @@
3
3
  module RuboCop
4
4
  # Yast plugin settings
5
5
  module Yast
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.3"
7
7
  end
8
8
  end
@@ -2,16 +2,32 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
+ def expect_y2milestone_offense(cop)
6
+ expect(cop.offenses.size).to eq(1)
7
+ expect(cop.offenses.first.line).to eq(1)
8
+ expect(cop.messages).to eq(["Builtin call `y2milestone` is obsolete, " \
9
+ "use native Ruby function instead."])
10
+ end
11
+
5
12
  describe RuboCop::Cop::Yast::Builtins do
6
13
  subject(:cop) { described_class.new }
7
14
 
8
- it "reports Builtins.* call" do
15
+ it "reports Builtins.* calls" do
9
16
  inspect_source(cop, ['Builtins.y2milestone("foo")'])
10
17
 
11
- expect(cop.offenses.size).to eq(1)
12
- expect(cop.offenses.first.line).to eq(1)
13
- expect(cop.messages).to eq(["Builtin call `y2milestone` is obsolete, " \
14
- "use native Ruby function instead."])
18
+ expect_y2milestone_offense(cop)
19
+ end
20
+
21
+ it "reports Yast::Builtins.* calls" do
22
+ inspect_source(cop, ['Yast::Builtins.y2milestone("foo")'])
23
+
24
+ expect_y2milestone_offense(cop)
25
+ end
26
+
27
+ it "reports ::Yast::Builtins.* calls" do
28
+ inspect_source(cop, ['::Yast::Builtins.y2milestone("foo")'])
29
+
30
+ expect_y2milestone_offense(cop)
15
31
  end
16
32
 
17
33
  it "ignores lsort builtin" do
@@ -20,4 +36,16 @@ describe RuboCop::Cop::Yast::Builtins do
20
36
  expect(cop.offenses).to be_empty
21
37
  end
22
38
 
39
+ it "ignores ::Builtins calls" do
40
+ inspect_source(cop, ['::Builtins.y2milestone("foo")'])
41
+
42
+ expect(cop.offenses).to be_empty
43
+ end
44
+
45
+ it "ignores Foo::Builtins calls" do
46
+ inspect_source(cop, ['Foo::Builtins.y2milestone("foo")'])
47
+
48
+ expect(cop.offenses).to be_empty
49
+ end
50
+
23
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-yast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ladislav Slezák