rubocop-google_ads 0.1.0 → 1.0.0

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: 9fa293a81fb19cf2a475155458f2b4cd378927e392950a47641f46924d9bb333
4
- data.tar.gz: 584a02dcdd660daaf8b2975b3851c5e6f13ec24b09c5cb9af68d74795369ece7
3
+ metadata.gz: d4e0a865b3338073d426c12dd819ae2bcd577bf0faf3ac3da55db8beae2c94d1
4
+ data.tar.gz: 62aff4f7cdf5ad5ec9b4b7335ff79e14165e7c7121d93122aabf303afe9f959c
5
5
  SHA512:
6
- metadata.gz: f76d1a6c8bc82a06b96e3bcb53ddaf297579c5e87b5e01a9125c50f4c873f1c6e5cdcaee74e5e08dd5eeb6b10efbea2ae5f161e3651fc7c45dd9e1a8c3afdc1b
7
- data.tar.gz: a2f39debec957f3284626fdd0615e1685c12556e0b36248143a6ea4456d2cd72fb9037055ae01902c3a3a9bd4c3e85a8b31e8428831b69e32707afb5c846d333
6
+ metadata.gz: 7d1cc12fcf7108e4d43acb96a34477d8a8f60e76e7d87b095f2a3c6080a44fb0d55481456cfd12473c79aa97ff80be20d6310f86aa25405be11792aa01fe178f
7
+ data.tar.gz: 661115b7ccace975324c1d4f26fd5416208e4bad730a854e6c996bf3417bf69092befa07a27501eea7bd22102a95690c4daa1623873b6c3d63ccc6e5bed071b2
@@ -0,0 +1,14 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@1.1.0
4
+
5
+ jobs:
6
+ build:
7
+ docker:
8
+ - image: circleci/ruby:2.7.1
9
+ executor: ruby/default
10
+ steps:
11
+ - checkout
12
+ - ruby/install-deps
13
+ - ruby/rspec-test
14
+ - ruby/rubocop-check
@@ -0,0 +1,27 @@
1
+ name: Auto update get methods with dependabot
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'dependabot/bundler/google-ads-googleads-**'
7
+
8
+ jobs:
9
+ main:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6
16
+ - name: Install dependencies
17
+ run: bundle install
18
+ - name: Generate new list file of deprecated get methods
19
+ run: bin/deprecated_methods_generator
20
+ - name: Check diff, commit and push
21
+ run: |
22
+ git config --local user.email "hanocha.peter@gmail.com"
23
+ git config --local user.name "hanocha"
24
+ git add lib/rubocop/cop/google_ads/deprecated_get_methods.yml
25
+ if git commit -m 'Generate new list file of deprecated get methods'; then
26
+ git push
27
+ fi
data/Gemfile CHANGED
@@ -7,5 +7,6 @@ gemspec
7
7
 
8
8
  gem 'google-ads-googleads'
9
9
  gem 'pry-byebug'
10
- gem 'rake', '~> 12.0'
10
+ gem 'rake', '~> 13.0'
11
11
  gem 'rspec'
12
+ gem 'rspec_junit_formatter'
@@ -9,56 +9,58 @@ GEM
9
9
  specs:
10
10
  addressable (2.7.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
- ast (2.4.0)
13
- byebug (11.1.1)
12
+ ast (2.4.1)
13
+ byebug (11.1.3)
14
14
  coderay (1.1.2)
15
15
  diff-lcs (1.3)
16
- faraday (0.17.3)
16
+ faraday (1.0.1)
17
17
  multipart-post (>= 1.2, < 3)
18
- google-ads-googleads (4.0.0)
18
+ google-ads-googleads (6.0.0)
19
19
  google-gax (~> 1.6)
20
+ google-protobuf (= 3.11.4)
20
21
  google-gax (1.8.1)
21
22
  google-protobuf (~> 3.9)
22
23
  googleapis-common-protos (>= 1.3.9, < 2.0)
23
24
  googleauth (~> 0.9)
24
25
  grpc (~> 1.24)
25
26
  rly (~> 0.2.3)
26
- google-protobuf (3.11.3)
27
- googleapis-common-protos (1.3.9)
28
- google-protobuf (~> 3.0)
29
- googleapis-common-protos-types (~> 1.0)
30
- grpc (~> 1.0)
31
- googleapis-common-protos-types (1.0.4)
32
- google-protobuf (~> 3.0)
33
- googleauth (0.10.0)
34
- faraday (~> 0.12)
27
+ google-protobuf (3.11.4)
28
+ googleapis-common-protos (1.3.10)
29
+ google-protobuf (~> 3.11)
30
+ googleapis-common-protos-types (>= 1.0.5, < 2.0)
31
+ grpc (~> 1.27)
32
+ googleapis-common-protos-types (1.0.5)
33
+ google-protobuf (~> 3.11)
34
+ googleauth (0.13.0)
35
+ faraday (>= 0.17.3, < 2.0)
35
36
  jwt (>= 1.4, < 3.0)
36
37
  memoist (~> 0.16)
37
38
  multi_json (~> 1.11)
38
39
  os (>= 0.9, < 2.0)
39
- signet (~> 0.12)
40
- grpc (1.27.0)
40
+ signet (~> 0.14)
41
+ grpc (1.28.0)
41
42
  google-protobuf (~> 3.11)
42
43
  googleapis-common-protos-types (~> 1.0)
43
- jaro_winkler (1.5.4)
44
44
  jwt (2.2.1)
45
45
  memoist (0.16.2)
46
- method_source (0.9.2)
47
- multi_json (1.14.1)
46
+ method_source (1.0.0)
47
+ multi_json (1.15.0)
48
48
  multipart-post (2.1.1)
49
- os (1.0.1)
50
- parallel (1.19.1)
51
- parser (2.7.0.2)
52
- ast (~> 2.4.0)
53
- pry (0.12.2)
54
- coderay (~> 1.1.0)
55
- method_source (~> 0.9.0)
56
- pry-byebug (3.8.0)
49
+ os (1.1.0)
50
+ parallel (1.19.2)
51
+ parser (2.7.1.4)
52
+ ast (~> 2.4.1)
53
+ pry (0.13.1)
54
+ coderay (~> 1.1)
55
+ method_source (~> 1.0)
56
+ pry-byebug (3.9.0)
57
57
  byebug (~> 11.0)
58
- pry (~> 0.10)
59
- public_suffix (4.0.3)
58
+ pry (~> 0.13.0)
59
+ public_suffix (4.0.5)
60
60
  rainbow (3.0.0)
61
- rake (12.3.3)
61
+ rake (13.0.1)
62
+ regexp_parser (1.7.1)
63
+ rexml (3.2.4)
62
64
  rly (0.2.3)
63
65
  rspec (3.9.0)
64
66
  rspec-core (~> 3.9.0)
@@ -73,20 +75,26 @@ GEM
73
75
  diff-lcs (>= 1.2.0, < 2.0)
74
76
  rspec-support (~> 3.9.0)
75
77
  rspec-support (3.9.2)
76
- rubocop (0.79.0)
77
- jaro_winkler (~> 1.5.1)
78
+ rspec_junit_formatter (0.4.1)
79
+ rspec-core (>= 2, < 4, != 2.12.0)
80
+ rubocop (0.89.0)
78
81
  parallel (~> 1.10)
79
- parser (>= 2.7.0.1)
82
+ parser (>= 2.7.1.1)
80
83
  rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.7)
85
+ rexml
86
+ rubocop-ast (>= 0.1.0, < 1.0)
81
87
  ruby-progressbar (~> 1.7)
82
- unicode-display_width (>= 1.4.0, < 1.7)
88
+ unicode-display_width (>= 1.4.0, < 2.0)
89
+ rubocop-ast (0.3.0)
90
+ parser (>= 2.7.1.4)
83
91
  ruby-progressbar (1.10.1)
84
- signet (0.12.0)
92
+ signet (0.14.0)
85
93
  addressable (~> 2.3)
86
- faraday (~> 0.9)
94
+ faraday (>= 0.17.3, < 2.0)
87
95
  jwt (>= 1.5, < 3.0)
88
96
  multi_json (~> 1.10)
89
- unicode-display_width (1.6.1)
97
+ unicode-display_width (1.7.0)
90
98
 
91
99
  PLATFORMS
92
100
  ruby
@@ -94,8 +102,9 @@ PLATFORMS
94
102
  DEPENDENCIES
95
103
  google-ads-googleads
96
104
  pry-byebug
97
- rake (~> 12.0)
105
+ rake (~> 13.0)
98
106
  rspec
107
+ rspec_junit_formatter
99
108
  rubocop-google_ads!
100
109
 
101
110
  BUNDLED WITH
data/README.md CHANGED
@@ -36,6 +36,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
36
36
 
37
37
  Bug reports and pull requests are welcome on GitHub at https://github.com/hanocha/rubocop-google_ads.
38
38
 
39
+ ### Update deprecated get methods list
40
+
41
+ When Google Ads API is updated, maybe we also should to update target deprecated methods information.
42
+
43
+ You can run `$ bin/deprecated_methods_generator` command, it updates `lib/rubocop/cop/google_ads/deprecated_get_methods.yml` file,
44
+ which is the list of deprecated get methods. Also you can commit it and make a pull request! :)
39
45
 
40
46
  ## License
41
47
 
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'google/ads/google_ads'
5
+ client = Google::Ads::GoogleAds::GoogleAdsClient.new {}
6
+
7
+ methods = client.service.methods
8
+
9
+ get_methods = []
10
+
11
+ methods.each do |m|
12
+ begin
13
+ get_method_name = client.service.send(m).instance_variables.find { |v| v.to_s.include?('@get_') }
14
+
15
+ if get_method_name
16
+ get_methods << get_method_name
17
+ puts get_method_name
18
+ end
19
+ rescue StandardError
20
+ puts "#{m} is not google ads API method. Skipping..."
21
+ end
22
+ end
23
+
24
+ get_methods.sort!
25
+
26
+ File.open('lib/rubocop/cop/google_ads/deprecated_get_methods.yml', 'w') do |f|
27
+ f.puts YAML.dump(get_methods.map { |m| m.to_s.delete_prefix('@') })
28
+ end
@@ -0,0 +1,105 @@
1
+ ---
2
+ - get_account_budget
3
+ - get_account_budget_proposal
4
+ - get_account_link
5
+ - get_ad
6
+ - get_ad_group
7
+ - get_ad_group_ad
8
+ - get_ad_group_ad_asset_view
9
+ - get_ad_group_ad_label
10
+ - get_ad_group_audience_view
11
+ - get_ad_group_bid_modifier
12
+ - get_ad_group_criterion
13
+ - get_ad_group_criterion_label
14
+ - get_ad_group_criterion_simulation
15
+ - get_ad_group_extension_setting
16
+ - get_ad_group_feed
17
+ - get_ad_group_label
18
+ - get_ad_group_simulation
19
+ - get_ad_parameter
20
+ - get_ad_schedule_view
21
+ - get_age_range_view
22
+ - get_asset
23
+ - get_batch_job
24
+ - get_bidding_strategy
25
+ - get_billing_setup
26
+ - get_campaign
27
+ - get_campaign_audience_view
28
+ - get_campaign_bid_modifier
29
+ - get_campaign_budget
30
+ - get_campaign_criterion
31
+ - get_campaign_criterion_simulation
32
+ - get_campaign_draft
33
+ - get_campaign_experiment
34
+ - get_campaign_extension_setting
35
+ - get_campaign_feed
36
+ - get_campaign_label
37
+ - get_campaign_shared_set
38
+ - get_carrier_constant
39
+ - get_change_status
40
+ - get_click_view
41
+ - get_conversion_action
42
+ - get_currency_constant
43
+ - get_custom_interest
44
+ - get_customer
45
+ - get_customer_client
46
+ - get_customer_client_link
47
+ - get_customer_extension_setting
48
+ - get_customer_feed
49
+ - get_customer_label
50
+ - get_customer_manager_link
51
+ - get_customer_negative_criterion
52
+ - get_detail_placement_view
53
+ - get_display_keyword_view
54
+ - get_distance_view
55
+ - get_domain_category
56
+ - get_dynamic_search_ads_search_term_view
57
+ - get_expanded_landing_page_view
58
+ - get_extension_feed_item
59
+ - get_feed
60
+ - get_feed_item
61
+ - get_feed_item_target
62
+ - get_feed_mapping
63
+ - get_feed_placeholder_view
64
+ - get_gender_view
65
+ - get_geo_target_constant
66
+ - get_geographic_view
67
+ - get_google_ads_field
68
+ - get_group_placement_view
69
+ - get_hotel_group_view
70
+ - get_hotel_performance_view
71
+ - get_income_range_view
72
+ - get_keyword_plan
73
+ - get_keyword_plan_ad_group
74
+ - get_keyword_plan_ad_group_keyword
75
+ - get_keyword_plan_campaign
76
+ - get_keyword_plan_campaign_keyword
77
+ - get_keyword_view
78
+ - get_label
79
+ - get_landing_page_view
80
+ - get_language_constant
81
+ - get_location_view
82
+ - get_managed_placement_view
83
+ - get_media_file
84
+ - get_merchant_center_link
85
+ - get_mobile_app_category_constant
86
+ - get_mobile_device_constant
87
+ - get_offline_user_data_job
88
+ - get_operating_system_version_constant
89
+ - get_paid_organic_search_term_view
90
+ - get_parental_status_view
91
+ - get_product_bidding_category_constant
92
+ - get_product_group_view
93
+ - get_recommendation
94
+ - get_remarketing_action
95
+ - get_search_term_view
96
+ - get_shared_criterion
97
+ - get_shared_set
98
+ - get_shopping_performance_view
99
+ - get_third_party_app_analytics_link
100
+ - get_topic_constant
101
+ - get_topic_view
102
+ - get_user_interest
103
+ - get_user_list
104
+ - get_user_location_view
105
+ - get_video
@@ -14,108 +14,8 @@ module RuboCop
14
14
  # client.service.google_ads.search(customer_id, query_to_retrive_resource)
15
15
  #
16
16
  class DoNotGetResourceMethods < Cop
17
- DEPRECATED_GET_METHODS = %i[
18
- get_ad_group_bid_modifier
19
- get_group_placement_view
20
- get_campaign_budget
21
- get_extension_feed_item
22
- get_customer_manager_link
23
- get_search_term_view
24
- get_keyword_plan_ad_group
25
- get_billing_setup
26
- get_click_view
27
- get_shared_criterion
28
- get_campaign_draft
29
- get_ad_group_simulation
30
- get_product_group_view
31
- get_landing_page_view
32
- get_campaign_shared_set
33
- get_keyword_plan_keyword
34
- get_location_view
35
- get_custom_interest
36
- get_merchant_center_link
37
- get_detail_placement_view
38
- get_customer_negative_criterion
39
- get_keyword_plan_campaign
40
- get_paid_organic_search_term_view
41
- get_age_range_view
42
- get_campaign_label
43
- get_ad_group_audience_view
44
- get_mobile_app_category_constant
45
- get_topic_constant
46
- get_parental_status_view
47
- get_bidding_strategy
48
- get_geo_target_constant
49
- get_ad_parameter
50
- get_mobile_device_constant
51
- get_ad_group_ad_asset_view
52
- get_ad_group_feed
53
- get_ad_group_criterion_simulation
54
- get_ad_group_criterion
55
- get_distance_view
56
- get_media_file
57
- get_user_location_view
58
- get_feed_item_target
59
- get_carrier_constant
60
- get_campaign_audience_view
61
- get_hotel_group_view
62
- get_feed_item
63
- get_campaign_criterion_simulation
64
- get_customer_client
65
- get_ad_group_label
66
- get_recommendation
67
- get_ad_schedule_view
68
- get_domain_category
69
- get_keyword_plan_negative_keyword
70
- get_ad_group_extension_setting
71
- get_ad
72
- get_ad_group_ad
73
- get_keyword_plan
74
- get_feed_placeholder_view
75
- get_customer_client_link
76
- get_mutate_job
77
- get_dynamic_search_ads_search_term_view
78
- get_feed_mapping
79
- get_language_constant
80
- get_feed
81
- get_hotel_performance_view
82
- get_campaign_criterion
83
- get_campaign_bid_modifier
84
- get_customer
85
- get_remarketing_action
86
- get_ad_group
87
- get_label
88
- get_customer_feed
89
- get_shared_set
90
- get_customer_extension_setting
91
- get_account_budget
92
- get_campaign_feed
93
- get_gender_view
94
- get_video
95
- get_keyword_view
96
- get_user_list
97
- get_product_bidding_category_constant
98
- get_topic_view
99
- get_asset
100
- get_campaign_experiment
101
- get_conversion_action
102
- get_ad_group_ad_label
103
- get_change_status
104
- get_campaign_extension_setting
105
- get_operating_system_version_constant
106
- get_ad_group_criterion_label
107
- get_geographic_view
108
- get_google_ads_field
109
- get_campaign
110
- get_user_interest
111
- get_shopping_performance_view
112
- get_expanded_landing_page_view
113
- get_customer_label
114
- get_display_keyword_view
115
- get_managed_placement_view
116
- get_account_budget_proposal
117
- ].freeze
118
-
17
+ deprecated_get_methods_file_path = File.open(File.expand_path('deprecated_get_methods.yml', __dir__))
18
+ DEPRECATED_GET_METHODS = YAML.parse(deprecated_get_methods_file_path).to_ruby.map(&:to_sym).freeze
119
19
  MSG = 'Use `GoogleAdsService.search`, instead of get methods.'
120
20
 
121
21
  def on_send(node)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module GoogleAds
5
- VERSION = '0.1.0'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ]
5
+ }
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Custom cops for Google Ads API Ruby Client Library'
12
12
  spec.homepage = 'https://github.com/hanocha/rubocop-google_ads'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.5')
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = spec.homepage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-google_ads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hanocha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-09 00:00:00.000000000 Z
11
+ date: 2020-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -31,6 +31,8 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".circleci/config.yml"
35
+ - ".github/workflows/auto-update-get-methods.yml"
34
36
  - ".gitignore"
35
37
  - ".rspec"
36
38
  - ".rubocop.yml"
@@ -42,14 +44,17 @@ files:
42
44
  - README.md
43
45
  - Rakefile
44
46
  - bin/console
47
+ - bin/deprecated_methods_generator
45
48
  - bin/setup
46
49
  - config/default.yml
47
50
  - lib/rubocop-google_ads.rb
51
+ - lib/rubocop/cop/google_ads/deprecated_get_methods.yml
48
52
  - lib/rubocop/cop/google_ads/do_not_get_resource_methods.rb
49
53
  - lib/rubocop/cop/google_ads_cops.rb
50
54
  - lib/rubocop/google_ads.rb
51
55
  - lib/rubocop/google_ads/inject.rb
52
56
  - lib/rubocop/google_ads/version.rb
57
+ - renovate.json
53
58
  - rubocop-google_ads.gemspec
54
59
  homepage: https://github.com/hanocha/rubocop-google_ads
55
60
  licenses:
@@ -65,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
70
  requirements:
66
71
  - - ">="
67
72
  - !ruby/object:Gem::Version
68
- version: 2.6.5
73
+ version: 2.4.0
69
74
  required_rubygems_version: !ruby/object:Gem::Requirement
70
75
  requirements:
71
76
  - - ">="