Skip to content

Commit 0221a90

Browse files
committed
Lint: Fix simple offenses
These changes were all done with `standardrb --fix`.
1 parent 3db45d3 commit 0221a90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+668
-829
lines changed

.standard_todo.yml

Lines changed: 0 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -2,202 +2,37 @@
22
# Remove from this list as you refactor files.
33
---
44
ignore:
5-
- Rakefile:
6-
- Style/HashSyntax
7-
- Style/PercentLiteralDelimiters
85
- lib/zendesk_api/actions.rb:
96
- Lint/AssignmentInCondition
10-
- Style/HashSyntax
117
- lib/zendesk_api/association.rb:
12-
- Style/HashSyntax
138
- Lint/AssignmentInCondition
149
- Lint/ShadowedArgument
1510
- Style/SafeNavigation
1611
- lib/zendesk_api/associations.rb:
17-
- Style/HashSyntax
18-
- Style/EachWithObject
1912
- Lint/AssignmentInCondition
2013
- Performance/RedundantMerge
2114
- lib/zendesk_api/client.rb:
2215
- Style/MissingRespondToMissing
23-
- Style/HashSyntax
2416
- Lint/AssignmentInCondition
2517
- lib/zendesk_api/collection.rb:
26-
- Style/PercentLiteralDelimiters
2718
- Performance/RedundantMerge
28-
- Style/HashSyntax
2919
- Style/SafeNavigation
30-
- Style/Alias
31-
- Performance/StringIdentifierArgument
32-
- Style/ParenthesesAroundCondition
33-
- lib/zendesk_api/configuration.rb:
34-
- Style/HashSyntax
35-
- lib/zendesk_api/middleware/request/encode_json.rb:
36-
- Lint/Void
37-
- lib/zendesk_api/middleware/request/etag_cache.rb:
38-
- Style/HashSyntax
3920
- lib/zendesk_api/middleware/request/retry.rb:
40-
- Style/TernaryParentheses
41-
- Style/RescueStandardError
4221
- Style/SafeNavigation
43-
- lib/zendesk_api/middleware/response/logger.rb:
44-
- Lint/RedundantStringCoercion
45-
- lib/zendesk_api/pagination.rb:
46-
- Style/Alias
4722
- lib/zendesk_api/resource.rb:
48-
- Style/Alias
4923
- Style/TrivialAccessors
50-
- Style/HashSyntax
5124
- Lint/DuplicateMethods
52-
- Performance/Caller
5325
- lib/zendesk_api/resources.rb:
54-
- Style/Alias
55-
- Style/HashSyntax
56-
- Style/PercentLiteralDelimiters
5726
- Lint/AssignmentInCondition
58-
- lib/zendesk_api/search.rb:
59-
- Style/Alias
60-
- lib/zendesk_api/track_changes.rb:
61-
- Style/Alias
62-
- spec/core/association_spec.rb:
63-
- Style/HashSyntax
64-
- spec/core/bulk_actions_spec.rb:
65-
- Style/HashSyntax
66-
- spec/core/client_spec.rb:
67-
- Style/HashSyntax
6827
- spec/core/collection_spec.rb:
69-
- Style/HashSyntax
7028
- Lint/ConstantDefinitionInBlock
7129
- Lint/InheritException
72-
- Style/Proc
73-
- Style/PercentLiteralDelimiters
74-
- Style/TernaryParentheses
75-
- spec/core/configuration_spec.rb:
76-
- Style/HashSyntax
77-
- spec/core/create_resource_spec.rb:
78-
- Style/HashSyntax
79-
- spec/core/data_resource_spec.rb:
80-
- Style/HashSyntax
81-
- spec/core/middleware/request/encode_json_spec.rb:
82-
- Style/HashSyntax
83-
- spec/core/middleware/request/etag_cache_spec.rb:
84-
- Style/HashSyntax
85-
- Style/PercentLiteralDelimiters
86-
- spec/core/middleware/request/retry_spec.rb:
87-
- Style/HashSyntax
88-
- spec/core/middleware/request/upload_spec.rb:
89-
- Style/HashSyntax
90-
- spec/core/middleware/response/callback_spec.rb:
91-
- Style/HashSyntax
92-
- spec/core/middleware/response/deflate_spec.rb:
93-
- Style/HashSyntax
94-
- spec/core/middleware/response/gzip_spec.rb:
95-
- Style/HashSyntax
96-
- spec/core/middleware/response/parse_json_spec.rb:
97-
- Style/HashSyntax
98-
- spec/core/middleware/response/raise_error_spec.rb:
99-
- Style/HashSyntax
100-
- spec/core/read_resource_spec.rb:
101-
- Style/HashSyntax
10230
- spec/core/resource_spec.rb:
103-
- Style/HashSyntax
10431
- Lint/ConstantDefinitionInBlock
105-
- Style/PercentLiteralDelimiters
106-
- spec/core/resources/automation_spec.rb:
107-
- Style/HashSyntax
108-
- spec/core/resources/macro_spec.rb:
109-
- Style/HashSyntax
110-
- spec/core/resources/trigger_spec.rb:
111-
- Style/HashSyntax
112-
- spec/core/resources/view_spec.rb:
113-
- Style/HashSyntax
114-
- Style/PercentLiteralDelimiters
11532
- spec/core/spec_helper.rb:
11633
- Style/GlobalVars
117-
- Style/HashSyntax
11834
- Style/MixinUsage
119-
- spec/core/trackie_spec.rb:
120-
- Style/BlockComments
121-
- spec/fixtures/zendesk.rb:
122-
- Style/HashSyntax
123-
- spec/live/app_installation_spec.rb:
124-
- Style/HashSyntax
125-
- Style/PercentLiteralDelimiters
126-
- spec/live/app_spec.rb:
127-
- Style/HashSyntax
128-
- Style/PercentLiteralDelimiters
129-
- spec/live/article_spec.rb:
130-
- Style/HashSyntax
131-
- spec/live/automation_spec.rb:
132-
- Style/HashSyntax
133-
- spec/live/bookmark_spec.rb:
134-
- Style/HashSyntax
135-
- spec/live/brand_spec.rb:
136-
- Style/HashSyntax
137-
- spec/live/category_spec.rb:
138-
- Style/HashSyntax
139-
- spec/live/dynamic_content/item_spec.rb:
140-
- Style/HashSyntax
141-
- spec/live/dynamic_content/variant_spec.rb:
142-
- Style/HashSyntax
143-
- spec/live/group_membership_spec.rb:
144-
- Style/HashSyntax
145-
- spec/live/group_spec.rb:
146-
- Style/HashSyntax
147-
- spec/live/identity_spec.rb:
148-
- Style/HashSyntax
149-
- spec/live/macro_spec.rb:
150-
- Style/HashSyntax
151-
- Lint/RedundantStringCoercion
152-
- spec/live/organization_field_spec.rb:
153-
- Style/HashSyntax
154-
- spec/live/organization_membership_spec.rb:
155-
- Style/HashSyntax
156-
- spec/live/organization_spec.rb:
157-
- Style/HashSyntax
158-
- spec/live/organization_subscription_spec.rb:
159-
- Style/HashSyntax
160-
- spec/live/push_notification_device_spec.rb:
161-
- Style/PercentLiteralDelimiters
162-
- spec/live/request_spec.rb:
163-
- Style/HashSyntax
164-
- spec/live/section_spec.rb:
165-
- Style/HashSyntax
166-
- spec/live/setting_spec.rb:
167-
- Style/HashSyntax
168-
- spec/live/suspended_ticket_spec.rb:
169-
- Style/HashSyntax
170-
- spec/live/tag_spec.rb:
171-
- Style/PercentLiteralDelimiters
172-
- Style/HashSyntax
17335
- spec/live/target_spec.rb:
174-
- Style/HashSyntax
17536
- Lint/BooleanSymbol
176-
- spec/live/ticket_field_spec.rb:
177-
- Style/HashSyntax
178-
- spec/live/ticket_form_spec.rb:
179-
- Style/HashSyntax
180-
- spec/live/ticket_spec.rb:
181-
- Style/HashSyntax
182-
- Style/PercentLiteralDelimiters
183-
- spec/live/topic_spec.rb:
184-
- Style/HashSyntax
185-
- spec/live/trigger_category_spec.rb:
186-
- Style/HashSyntax
187-
- spec/live/trigger_spec.rb:
188-
- Style/HashSyntax
189-
- spec/live/upload_spec.rb:
190-
- Style/HashSyntax
191-
- spec/live/user_field_spec.rb:
192-
- Style/HashSyntax
193-
- spec/live/user_spec.rb:
194-
- Style/HashSyntax
195-
- spec/live/user_view_spec.rb:
196-
- Style/HashSyntax
197-
- spec/live/view_spec.rb:
198-
- Style/HashSyntax
19937
- spec/macros/resource_macros.rb:
200-
- Lint/RedundantStringCoercion
201-
- Style/HashSyntax
20238
- Performance/RedundantMerge
203-
- Style/MultilineIfModifier

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ if defined?(RSpec)
3333
end
3434

3535
desc "Default: run specs."
36-
task :default => "spec"
36+
task default: "spec"
3737
end
3838

3939
# extracted from https://github.com/grosser/project_template
4040
rule(/^version:bump:.*/) do |t|
4141
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
42-
index = %w(major minor patch).index(t.name.split(":").last)
42+
index = %w[major minor patch].index(t.name.split(":").last)
4343
file = "lib/zendesk_api/version.rb"
4444

4545
version_file = File.read(file)

lib/zendesk_api/actions.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def find!(client, options = {})
110110
@client = client # so we can use client.logger in rescue
111111

112112
raise ArgumentError, "No :id given" unless options[:id] || options["id"] || ancestors.include?(SingularResource)
113-
association = options.delete(:association) || Association.new(:class => self)
113+
association = options.delete(:association) || Association.new(class: self)
114114

115115
includes = Array(options[:include])
116116
options[:include] = includes.join(",") if includes.any?
@@ -170,7 +170,7 @@ module CreateMany
170170
# @param [Client] client The {Client} object to be used
171171
# @param [Array] attributes_array An array of resources to be created.
172172
# @return [JobStatus] the {JobStatus} instance for this create job
173-
def create_many!(client, attributes_array, association = Association.new(:class => self))
173+
def create_many!(client, attributes_array, association = Association.new(class: self))
174174
response = client.connection.post("#{association.generate_path}/create_many") do |req|
175175
req.body = {resource_name => attributes_array}
176176

@@ -185,7 +185,7 @@ module CreateOrUpdate
185185
# Creates or updates resource using the create_or_update endpoint.
186186
# @param [Client] client The {Client} object to be used
187187
# @param [Hash] attributes The attributes to create.
188-
def create_or_update!(client, attributes, association = Association.new(:class => self))
188+
def create_or_update!(client, attributes, association = Association.new(class: self))
189189
response = client.connection.post("#{association.generate_path}/create_or_update") do |req|
190190
req.body = {singular_resource_name => attributes}
191191

@@ -204,7 +204,7 @@ module CreateOrUpdateMany
204204
#
205205
# @return [JobStatus] the {JobStatus} instance for this destroy job
206206
def create_or_update_many!(client, attributes)
207-
association = Association.new(:class => self)
207+
association = Association.new(class: self)
208208

209209
response = client.connection.post("#{association.generate_path}/create_or_update_many") do |req|
210210
req.body = {resource_name => attributes}
@@ -269,9 +269,9 @@ module DestroyMany
269269
# @param [Client] client The {Client} object to be used
270270
# @param [Array] ids An array of ids to destroy
271271
# @return [JobStatus] the {JobStatus} instance for this destroy job
272-
def destroy_many!(client, ids, association = Association.new(:class => self))
272+
def destroy_many!(client, ids, association = Association.new(class: self))
273273
response = client.connection.delete("#{association.generate_path}/destroy_many") do |req|
274-
req.params = {:ids => ids.join(",")}
274+
req.params = {ids: ids.join(",")}
275275

276276
yield req if block_given?
277277
end
@@ -300,9 +300,9 @@ def update(client, attributes = {}, &)
300300
# @param [Hash] attributes The attributes to update. Default to {
301301
def update!(client, attributes = {}, &)
302302
ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name
303-
resource = new(client, :id => attributes.delete(:id), :global => attributes.delete(:global), :association => attributes.delete(:association))
303+
resource = new(client, id: attributes.delete(:id), global: attributes.delete(:global), association: attributes.delete(:association))
304304
resource.attributes.merge!(attributes)
305-
resource.save!(:force_update => resource.is_a?(SingularResource), &)
305+
resource.save!(force_update: resource.is_a?(SingularResource), &)
306306
resource
307307
end
308308
end
@@ -315,13 +315,13 @@ module UpdateMany
315315
# @param [Hash] attributes The attributes to update resources with
316316
# @return [JobStatus] the {JobStatus} instance for this destroy job
317317
def update_many!(client, ids_or_attributes, attributes = {})
318-
association = attributes.delete(:association) || Association.new(:class => self)
318+
association = attributes.delete(:association) || Association.new(class: self)
319319

320320
response = client.connection.put("#{association.generate_path}/update_many") do |req|
321321
if attributes == {}
322322
req.body = {resource_name => ids_or_attributes}
323323
else
324-
req.params = {:ids => ids_or_attributes.join(",")}
324+
req.params = {ids: ids_or_attributes.join(",")}
325325
req.body = {singular_resource_name => attributes}
326326
end
327327

lib/zendesk_api/association.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def initialize(options = {})
4343
# * with_parent - Include the parent path (false by default)
4444
# * with_id - Include the instance id, if possible (true)
4545
def generate_path(*args)
46-
options = SilentMash.new(:with_id => true)
46+
options = SilentMash.new(with_id: true)
4747
if args.last.is_a?(Hash)
4848
original_options = args.pop
4949
options.merge!(original_options)

0 commit comments

Comments
 (0)