allscripts_unity_client 4.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/allscripts_unity_client.rb +4 -0
- data/lib/allscripts_unity_client/client.rb +11 -4
- data/lib/allscripts_unity_client/client_driver.rb +15 -5
- data/lib/allscripts_unity_client/client_options.rb +13 -4
- data/lib/allscripts_unity_client/json_client_driver.rb +37 -3
- data/lib/allscripts_unity_client/unity_request.rb +9 -2
- data/lib/allscripts_unity_client/version.rb +1 -1
- metadata +20 -59
- data/.gitignore +0 -21
- data/.rspec +0 -2
- data/.rubocop.yml +0 -340
- data/.travis.yml +0 -11
- data/Gemfile +0 -2
- data/LICENSE +0 -22
- data/README.md +0 -347
- data/Rakefile +0 -7
- data/allscripts_unity_client.gemspec +0 -40
- data/spec/allscripts_unity_client_spec.rb +0 -30
- data/spec/client_driver_spec.rb +0 -23
- data/spec/client_options_spec.rb +0 -185
- data/spec/client_spec.rb +0 -471
- data/spec/factories/allscripts_unity_client_parameters_factory.rb +0 -18
- data/spec/factories/client_driver_factory.rb +0 -20
- data/spec/factories/client_factory.rb +0 -9
- data/spec/factories/client_options.rb +0 -18
- data/spec/factories/magic_request_factory.rb +0 -37
- data/spec/factories/unity_request_factory.rb +0 -13
- data/spec/factories/unity_response_factory.rb +0 -12
- data/spec/fixtures/attributes_hash.yml +0 -15
- data/spec/fixtures/date_hash.yml +0 -8
- data/spec/fixtures/date_string_hash.yml +0 -8
- data/spec/fixtures/error.json +0 -3
- data/spec/fixtures/get_providers.json +0 -69
- data/spec/fixtures/get_providers.xml +0 -119
- data/spec/fixtures/get_providers_json.yml +0 -65
- data/spec/fixtures/get_providers_xml.yml +0 -270
- data/spec/fixtures/get_security_token.json +0 -1
- data/spec/fixtures/get_security_token.xml +0 -7
- data/spec/fixtures/get_server_info.json +0 -10
- data/spec/fixtures/get_server_info.xml +0 -40
- data/spec/fixtures/get_server_info_json.yml +0 -8
- data/spec/fixtures/get_server_info_xml.yml +0 -55
- data/spec/fixtures/no_attributes_hash.yml +0 -7
- data/spec/fixtures/retire_security_token.json +0 -1
- data/spec/fixtures/retire_security_token.xml +0 -5
- data/spec/fixtures/soap_fault.xml +0 -13
- data/spec/fixtures/string_keyed_hash.yml +0 -8
- data/spec/fixtures/symbol_keyed_hash.yml +0 -8
- data/spec/json_client_driver_spec.rb +0 -152
- data/spec/json_unity_request_spec.rb +0 -37
- data/spec/json_unity_response_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -85
- data/spec/support/factory_bot.rb +0 -10
- data/spec/support/fixture_loader.rb +0 -20
- data/spec/support/shared_examples_for_client_driver.rb +0 -118
- data/spec/support/shared_examples_for_unity_request.rb +0 -114
- data/spec/support/shared_examples_for_unity_response.rb +0 -26
- data/spec/unity_request_spec.rb +0 -37
- data/spec/unity_response_spec.rb +0 -36
- data/spec/utilities_spec.rb +0 -144
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b116562b821aba2354693ae0c558db8fb45d7854b4da7167a5159f0069308049
|
4
|
+
data.tar.gz: dce828cd7de3875c3b165fca31625c3b084d6970bb2e3edd6232d8a44cb37075
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f4a8e409752a922352ea4465f23b468fc264df61d913ad2f11f337090d9a527d8dd105737448bad5e1bad462ea18d821813402bcf5ce8dda3a7ad24e8bb426
|
7
|
+
data.tar.gz: 852a4ad6fb74b4d089a5fe5bc178321589ffd4bb9c468e4c015856b38b77fd44f3d761466c2392ef9eea5eb7510a5110632d080ae5cf482e92dab8f768fc9852
|
@@ -21,6 +21,9 @@ module AllscriptsUnityClient
|
|
21
21
|
class GetSecurityTokenError < RuntimeError
|
22
22
|
end
|
23
23
|
|
24
|
+
# Raised when user attempts to make unauthenticated calls.
|
25
|
+
class UnauthenticatedError < StandardError; end
|
26
|
+
|
24
27
|
# Create an instance of the Unity client.
|
25
28
|
#
|
26
29
|
# options:: See ClientOptions.
|
@@ -28,6 +31,7 @@ module AllscriptsUnityClient
|
|
28
31
|
# Returns an instance of Client.
|
29
32
|
def self.create(options = {})
|
30
33
|
options[:mode] ||= :json
|
34
|
+
options[:raw_dates] ||= false
|
31
35
|
if options[:log] != false # explicitly
|
32
36
|
options[:log] = true
|
33
37
|
end
|
@@ -552,7 +552,7 @@ module AllscriptsUnityClient
|
|
552
552
|
end
|
553
553
|
|
554
554
|
def get_user_authentication
|
555
|
-
|
555
|
+
@client_driver.get_user_authentication
|
556
556
|
end
|
557
557
|
|
558
558
|
def get_user_id
|
@@ -711,7 +711,7 @@ module AllscriptsUnityClient
|
|
711
711
|
|
712
712
|
def save_task(userid, patientid, task_type = nil, target_user = nil, work_object_id = nil, comments = nil)
|
713
713
|
if task_type.nil? && target_user.nil? && work_object_id.nil? && comments.nil?
|
714
|
-
raise
|
714
|
+
raise ArgumentError, 'task_type, target_user, work_object_id, and comments can not all be nil'
|
715
715
|
end
|
716
716
|
|
717
717
|
magic_parameters = {
|
@@ -728,7 +728,7 @@ module AllscriptsUnityClient
|
|
728
728
|
|
729
729
|
def save_task_status(userid, transaction_id = nil, status = nil, delegate_id = nil, comment = nil, taskchanges = nil, patient_id = nil)
|
730
730
|
if transaction_id.nil? && delegate_id.nil? && comment.nil?
|
731
|
-
raise
|
731
|
+
raise ArgumentError, 'transaction_id, delegate_id, and comment can not all be nil'
|
732
732
|
end
|
733
733
|
|
734
734
|
# Generate XML structure for rxxml
|
@@ -745,6 +745,13 @@ module AllscriptsUnityClient
|
|
745
745
|
}
|
746
746
|
end
|
747
747
|
|
748
|
+
new_status =
|
749
|
+
if taskchanges.nil?
|
750
|
+
""
|
751
|
+
else
|
752
|
+
nokogiri_to_string(builder)
|
753
|
+
end
|
754
|
+
|
748
755
|
magic_parameters = {
|
749
756
|
action: 'SaveTaskStatus',
|
750
757
|
userid: userid,
|
@@ -752,7 +759,7 @@ module AllscriptsUnityClient
|
|
752
759
|
parameter2: status,
|
753
760
|
parameter3: delegate_id,
|
754
761
|
parameter4: comment,
|
755
|
-
parameter6:
|
762
|
+
parameter6: new_status
|
756
763
|
}
|
757
764
|
|
758
765
|
if patient_id
|
@@ -60,11 +60,11 @@ module AllscriptsUnityClient
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def log_info(message)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
log(:info, message)
|
64
|
+
end
|
65
|
+
|
66
|
+
def log_warn(message)
|
67
|
+
log(:warn, message)
|
68
68
|
end
|
69
69
|
|
70
70
|
def start_timer
|
@@ -85,5 +85,15 @@ module AllscriptsUnityClient
|
|
85
85
|
|
86
86
|
GetSecurityTokenError.new(error_message)
|
87
87
|
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def log(level, message)
|
92
|
+
if @options.logger? && !message.nil?
|
93
|
+
message += " #{@timer} seconds" unless @timer.nil?
|
94
|
+
@timer = nil
|
95
|
+
@options.logger.send(level, message)
|
96
|
+
end
|
97
|
+
end
|
88
98
|
end
|
89
99
|
end
|
@@ -2,15 +2,15 @@ module AllscriptsUnityClient
|
|
2
2
|
|
3
3
|
# Contains various options for Unity configuration.
|
4
4
|
class ClientOptions
|
5
|
-
attr_accessor :proxy, :logger, :ca_file, :ca_path, :timeout
|
6
|
-
attr_reader :base_unity_url, :username, :password, :appname, :timezone
|
5
|
+
attr_accessor :proxy, :logger, :ca_file, :ca_path, :timeout, :ehr_userid, :ehr_password
|
6
|
+
attr_reader :base_unity_url, :username, :password, :appname, :timezone, :raw_dates
|
7
7
|
|
8
8
|
# Constructor.
|
9
9
|
#
|
10
10
|
# options::
|
11
11
|
#
|
12
|
-
# - :username - Unity license username __(required)__.
|
13
|
-
# - :password - Unity license password __(required)__.
|
12
|
+
# - :username - Unity license username for security token __(required)__.
|
13
|
+
# - :password - Unity license password for security token __(required)__.
|
14
14
|
# - :appname - Unity license appname __(required)__.
|
15
15
|
# - :proxy - A string URL pointing to an HTTP proxy (optional, primarily for debugging)
|
16
16
|
# - :logger - A Ruby object that adheres to the same interface as Logger.
|
@@ -18,6 +18,8 @@ module AllscriptsUnityClient
|
|
18
18
|
# - :cs_path - A string path for a CA directory (JSON only).
|
19
19
|
# - :timeout - The number of seconds to set the HTTP response timeout and keepalive timeout (JSON only).
|
20
20
|
# - :base_unity_url - The URL where a Unity server is located (i.e. https://unity.server.com) __(required)__
|
21
|
+
# - :ehr_userid - Allscripts EHR Username for user authentication __(required)__.
|
22
|
+
# - :ehr_password - EHR Password for user authentication __(required)__.
|
21
23
|
def initialize(options = {})
|
22
24
|
@username = options[:username]
|
23
25
|
@password = options[:password]
|
@@ -27,9 +29,12 @@ module AllscriptsUnityClient
|
|
27
29
|
@ca_file = options[:ca_file]
|
28
30
|
@ca_path = options[:ca_path]
|
29
31
|
@timeout = options[:timeout]
|
32
|
+
@ehr_userid = options[:ehr_userid]
|
33
|
+
@ehr_password = options[:ehr_password]
|
30
34
|
|
31
35
|
self.timezone = options[:timezone]
|
32
36
|
self.base_unity_url = options[:base_unity_url]
|
37
|
+
self.raw_dates = options[:raw_dates]
|
33
38
|
|
34
39
|
validate_options
|
35
40
|
end
|
@@ -92,6 +97,10 @@ module AllscriptsUnityClient
|
|
92
97
|
end
|
93
98
|
end
|
94
99
|
|
100
|
+
def raw_dates=(raw_dates)
|
101
|
+
@raw_dates = raw_dates || false
|
102
|
+
end
|
103
|
+
|
95
104
|
# Return true if proxy is set and not empty.
|
96
105
|
def proxy?
|
97
106
|
!@proxy.to_s.strip.empty?
|
@@ -8,6 +8,7 @@ module AllscriptsUnityClient
|
|
8
8
|
attr_accessor :json_base_url, :connection
|
9
9
|
|
10
10
|
UNITY_JSON_ENDPOINT = '/Unity/UnityService.svc/json'
|
11
|
+
TOKEN_REGEX = /^"?(\w|-)+"?$/
|
11
12
|
|
12
13
|
def initialize(options)
|
13
14
|
super
|
@@ -47,7 +48,11 @@ module AllscriptsUnityClient
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def magic(parameters = {})
|
50
|
-
|
51
|
+
unless user_authenticated? || parameters[:action] == 'GetUserAuthentication'
|
52
|
+
raise UnauthenticatedError, "#{parameters[:action]} for #{@options.base_unity_url}"
|
53
|
+
end
|
54
|
+
|
55
|
+
request = JSONUnityRequest.new(parameters, @options.timezone, @options.appname, @security_token, @options.raw_dates)
|
51
56
|
request_hash = request.to_hash
|
52
57
|
request_data = MultiJson.dump(request_hash)
|
53
58
|
|
@@ -70,6 +75,26 @@ module AllscriptsUnityClient
|
|
70
75
|
response.to_hash
|
71
76
|
end
|
72
77
|
|
78
|
+
# See Client#get_user_authentication.
|
79
|
+
def get_user_authentication(parameters = {})
|
80
|
+
response = magic({
|
81
|
+
action: 'GetUserAuthentication',
|
82
|
+
userid: parameters[:ehr_userid] || @options.ehr_userid,
|
83
|
+
parameter1: parameters[:ehr_password] || @options.ehr_password
|
84
|
+
})
|
85
|
+
|
86
|
+
if response[:valid_user] == 'YES'
|
87
|
+
@user_authentication = response
|
88
|
+
log_info("allscripts_unity_client authentication attempt: success #{@options.base_unity_url}")
|
89
|
+
return true
|
90
|
+
elsif response[:valid_user] == 'NO'
|
91
|
+
log_warn("allscripts_unity_client authentication attempt: failure #{@options.base_unity_url}")
|
92
|
+
return false
|
93
|
+
else
|
94
|
+
raise StandardError.new('Unexpected response from the server')
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
73
98
|
# See Client#get_security_token!.
|
74
99
|
def get_security_token!(parameters = {})
|
75
100
|
username = parameters[:username] || @options.username
|
@@ -89,10 +114,10 @@ module AllscriptsUnityClient
|
|
89
114
|
log_get_security_token
|
90
115
|
log_info("Response Status: #{response.status}")
|
91
116
|
|
92
|
-
if response.status != 200
|
117
|
+
if response.status != 200 || TOKEN_REGEX.match(response.body).nil?
|
93
118
|
raise make_get_security_token_error
|
94
119
|
else
|
95
|
-
raise_if_response_error(response)
|
120
|
+
raise_if_response_error(response.body)
|
96
121
|
|
97
122
|
@security_token = response.body
|
98
123
|
end
|
@@ -116,6 +141,15 @@ module AllscriptsUnityClient
|
|
116
141
|
log_retire_security_token
|
117
142
|
|
118
143
|
@security_token = nil
|
144
|
+
revoke_authentication
|
145
|
+
end
|
146
|
+
|
147
|
+
def user_authenticated?
|
148
|
+
@user_authentication.present?
|
149
|
+
end
|
150
|
+
|
151
|
+
def revoke_authentication
|
152
|
+
@user_authentication = nil
|
119
153
|
end
|
120
154
|
|
121
155
|
private
|
@@ -2,7 +2,7 @@ module AllscriptsUnityClient
|
|
2
2
|
|
3
3
|
# Transform a Unity request into a Hash suitable for sending using Savon.
|
4
4
|
class UnityRequest
|
5
|
-
attr_accessor :parameters, :appname, :security_token, :timezone
|
5
|
+
attr_accessor :parameters, :appname, :security_token, :timezone, :raw_dates
|
6
6
|
|
7
7
|
# Constructor.
|
8
8
|
#
|
@@ -26,7 +26,7 @@ module AllscriptsUnityClient
|
|
26
26
|
# timezone:: An ActiveSupport::TimeZone instance.
|
27
27
|
# appname:: The Unity license appname.
|
28
28
|
# security_token:: A security token from the Unity GetSecurityToken call.
|
29
|
-
def initialize(parameters, timezone, appname, security_token)
|
29
|
+
def initialize(parameters, timezone, appname, security_token, raw_dates=false)
|
30
30
|
raise ArgumentError, 'parameters can not be nil' if parameters.nil?
|
31
31
|
raise ArgumentError, 'timezone can not be nil' if timezone.nil?
|
32
32
|
raise ArgumentError, 'appname can not be nil' if appname.nil?
|
@@ -36,6 +36,7 @@ module AllscriptsUnityClient
|
|
36
36
|
@security_token = security_token
|
37
37
|
@parameters = parameters
|
38
38
|
@timezone = timezone
|
39
|
+
@raw_dates = raw_dates
|
39
40
|
end
|
40
41
|
|
41
42
|
# Convert the parameters to a Hash for Savon with all possible dates
|
@@ -72,11 +73,17 @@ module AllscriptsUnityClient
|
|
72
73
|
|
73
74
|
protected
|
74
75
|
|
76
|
+
def use_raw_dates?
|
77
|
+
@raw_dates || false
|
78
|
+
end
|
79
|
+
|
75
80
|
def process_date(value)
|
76
81
|
if value && (value.is_a?(Time) || value.is_a?(DateTime) || value.is_a?(ActiveSupport::TimeWithZone))
|
77
82
|
return value.in_time_zone(@timezone).iso8601
|
78
83
|
end
|
79
84
|
|
85
|
+
return value if use_raw_dates?
|
86
|
+
|
80
87
|
date = Utilities::try_to_encode_as_date(ActiveSupport::TimeZone['Etc/UTC'], value)
|
81
88
|
|
82
89
|
if date && date.is_a?(ActiveSupport::TimeWithZone)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allscripts_unity_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- healthfinch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -212,23 +212,28 @@ dependencies:
|
|
212
212
|
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0.51'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: pry
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: 0.11.3
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 0.11.3
|
215
229
|
description: Provides a simple interface to the Allscripts Unity API using JSON. Developed
|
216
230
|
at healthfinch http://healthfinch.com
|
217
231
|
email:
|
218
|
-
-
|
232
|
+
- engineering@healthfinch.com
|
219
233
|
executables: []
|
220
234
|
extensions: []
|
221
235
|
extra_rdoc_files: []
|
222
236
|
files:
|
223
|
-
- ".gitignore"
|
224
|
-
- ".rspec"
|
225
|
-
- ".rubocop.yml"
|
226
|
-
- ".travis.yml"
|
227
|
-
- Gemfile
|
228
|
-
- LICENSE
|
229
|
-
- README.md
|
230
|
-
- Rakefile
|
231
|
-
- allscripts_unity_client.gemspec
|
232
237
|
- lib/allscripts_unity_client.rb
|
233
238
|
- lib/allscripts_unity_client/client.rb
|
234
239
|
- lib/allscripts_unity_client/client_driver.rb
|
@@ -240,49 +245,6 @@ files:
|
|
240
245
|
- lib/allscripts_unity_client/unity_response.rb
|
241
246
|
- lib/allscripts_unity_client/utilities.rb
|
242
247
|
- lib/allscripts_unity_client/version.rb
|
243
|
-
- spec/allscripts_unity_client_spec.rb
|
244
|
-
- spec/client_driver_spec.rb
|
245
|
-
- spec/client_options_spec.rb
|
246
|
-
- spec/client_spec.rb
|
247
|
-
- spec/factories/allscripts_unity_client_parameters_factory.rb
|
248
|
-
- spec/factories/client_driver_factory.rb
|
249
|
-
- spec/factories/client_factory.rb
|
250
|
-
- spec/factories/client_options.rb
|
251
|
-
- spec/factories/magic_request_factory.rb
|
252
|
-
- spec/factories/unity_request_factory.rb
|
253
|
-
- spec/factories/unity_response_factory.rb
|
254
|
-
- spec/fixtures/attributes_hash.yml
|
255
|
-
- spec/fixtures/date_hash.yml
|
256
|
-
- spec/fixtures/date_string_hash.yml
|
257
|
-
- spec/fixtures/error.json
|
258
|
-
- spec/fixtures/get_providers.json
|
259
|
-
- spec/fixtures/get_providers.xml
|
260
|
-
- spec/fixtures/get_providers_json.yml
|
261
|
-
- spec/fixtures/get_providers_xml.yml
|
262
|
-
- spec/fixtures/get_security_token.json
|
263
|
-
- spec/fixtures/get_security_token.xml
|
264
|
-
- spec/fixtures/get_server_info.json
|
265
|
-
- spec/fixtures/get_server_info.xml
|
266
|
-
- spec/fixtures/get_server_info_json.yml
|
267
|
-
- spec/fixtures/get_server_info_xml.yml
|
268
|
-
- spec/fixtures/no_attributes_hash.yml
|
269
|
-
- spec/fixtures/retire_security_token.json
|
270
|
-
- spec/fixtures/retire_security_token.xml
|
271
|
-
- spec/fixtures/soap_fault.xml
|
272
|
-
- spec/fixtures/string_keyed_hash.yml
|
273
|
-
- spec/fixtures/symbol_keyed_hash.yml
|
274
|
-
- spec/json_client_driver_spec.rb
|
275
|
-
- spec/json_unity_request_spec.rb
|
276
|
-
- spec/json_unity_response_spec.rb
|
277
|
-
- spec/spec_helper.rb
|
278
|
-
- spec/support/factory_bot.rb
|
279
|
-
- spec/support/fixture_loader.rb
|
280
|
-
- spec/support/shared_examples_for_client_driver.rb
|
281
|
-
- spec/support/shared_examples_for_unity_request.rb
|
282
|
-
- spec/support/shared_examples_for_unity_response.rb
|
283
|
-
- spec/unity_request_spec.rb
|
284
|
-
- spec/unity_response_spec.rb
|
285
|
-
- spec/utilities_spec.rb
|
286
248
|
homepage: https://github.com/healthfinch/allscripts-unity-client
|
287
249
|
licenses:
|
288
250
|
- MIT
|
@@ -293,17 +255,16 @@ require_paths:
|
|
293
255
|
- lib
|
294
256
|
required_ruby_version: !ruby/object:Gem::Requirement
|
295
257
|
requirements:
|
296
|
-
- - "
|
258
|
+
- - ">="
|
297
259
|
- !ruby/object:Gem::Version
|
298
|
-
version: 2.
|
260
|
+
version: 2.4.2
|
299
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
262
|
requirements:
|
301
263
|
- - ">="
|
302
264
|
- !ruby/object:Gem::Version
|
303
265
|
version: '0'
|
304
266
|
requirements: []
|
305
|
-
|
306
|
-
rubygems_version: 2.5.2.1
|
267
|
+
rubygems_version: 3.0.3
|
307
268
|
signing_key:
|
308
269
|
specification_version: 4
|
309
270
|
summary: Allscripts Unity API client
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,340 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
DisabledByDefault: true
|
3
|
-
DisplayCopNames: true
|
4
|
-
Exclude:
|
5
|
-
- 'bin/**/*'
|
6
|
-
|
7
|
-
|
8
|
-
Style/AndOr:
|
9
|
-
Description: 'Use &&/|| instead of and/or.'
|
10
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
|
11
|
-
Enabled: true
|
12
|
-
Exclude:
|
13
|
-
- 'lib/healthfinch/service/controller_base.rb'
|
14
|
-
|
15
|
-
Style/DefWithParentheses:
|
16
|
-
Description: 'Use def with parentheses when there are arguments.'
|
17
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
18
|
-
Enabled: true
|
19
|
-
|
20
|
-
Style/PreferredHashMethods:
|
21
|
-
Description: 'Checks for use of deprecated Hash methods.'
|
22
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
|
23
|
-
Enabled: true
|
24
|
-
|
25
|
-
Style/DoubleNegation:
|
26
|
-
Description: 'Checks for uses of double negation (!!).'
|
27
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
|
28
|
-
Enabled: true
|
29
|
-
Exclude:
|
30
|
-
- 'lib/healthfinch/service/rspec/process_service_acceptance.rb'
|
31
|
-
|
32
|
-
Layout/ElseAlignment:
|
33
|
-
Description: 'Align elses and elsifs correctly.'
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
Style/EmptyElse:
|
37
|
-
Description: 'Avoid empty else-clauses.'
|
38
|
-
Enabled: true
|
39
|
-
|
40
|
-
Layout/EmptyLineBetweenDefs:
|
41
|
-
Description: 'Use empty lines between defs.'
|
42
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
|
43
|
-
Enabled: true
|
44
|
-
|
45
|
-
Layout/EmptyLines:
|
46
|
-
Description: "Don't use several empty lines in a row."
|
47
|
-
Enabled: true
|
48
|
-
|
49
|
-
Layout/EndOfLine:
|
50
|
-
Description: 'Use Unix-style line endings.'
|
51
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
|
52
|
-
Enabled: true
|
53
|
-
|
54
|
-
Layout/ExtraSpacing:
|
55
|
-
Description: 'Do not use unnecessary spacing.'
|
56
|
-
Enabled: true
|
57
|
-
|
58
|
-
Naming/FileName:
|
59
|
-
Description: 'Use snake_case for source file names.'
|
60
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
61
|
-
Enabled: true
|
62
|
-
|
63
|
-
Layout/IndentationConsistency:
|
64
|
-
Description: 'Keep indentation straight.'
|
65
|
-
Enabled: true
|
66
|
-
|
67
|
-
Layout/IndentationWidth:
|
68
|
-
Description: 'Use 2 spaces for indentation.'
|
69
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
70
|
-
Enabled: true
|
71
|
-
|
72
|
-
Style/MethodCallWithoutArgsParentheses:
|
73
|
-
Description: 'Do not use parentheses for method calls with no arguments.'
|
74
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
|
75
|
-
Enabled: true
|
76
|
-
|
77
|
-
Style/MethodDefParentheses:
|
78
|
-
Description: >-
|
79
|
-
Checks if the method definitions have or don't have
|
80
|
-
parentheses.
|
81
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
82
|
-
Enabled: true
|
83
|
-
|
84
|
-
Naming/MethodName:
|
85
|
-
Description: 'Use the configured style when naming methods.'
|
86
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
87
|
-
Enabled: true
|
88
|
-
|
89
|
-
Style/NestedTernaryOperator:
|
90
|
-
Description: 'Use one expression per branch in a ternary operator.'
|
91
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
|
92
|
-
Enabled: true
|
93
|
-
|
94
|
-
Style/NilComparison:
|
95
|
-
Description: 'Prefer x.nil? to x == nil.'
|
96
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
97
|
-
Enabled: true
|
98
|
-
|
99
|
-
Style/NonNilCheck:
|
100
|
-
Description: 'Checks for redundant nil checks.'
|
101
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
|
102
|
-
Enabled: true
|
103
|
-
|
104
|
-
Layout/SpaceAroundKeyword:
|
105
|
-
Description: 'Put a space before the modifier keyword.'
|
106
|
-
Enabled: true
|
107
|
-
|
108
|
-
Layout/Tab:
|
109
|
-
Description: 'No hard tabs.'
|
110
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
111
|
-
Enabled: true
|
112
|
-
|
113
|
-
Layout/TrailingBlankLines:
|
114
|
-
Description: 'Checks trailing blank lines and final newline.'
|
115
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
|
116
|
-
Enabled: true
|
117
|
-
|
118
|
-
Layout/TrailingWhitespace:
|
119
|
-
Description: 'Avoid trailing whitespace.'
|
120
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
|
121
|
-
Enabled: true
|
122
|
-
|
123
|
-
Style/UnlessElse:
|
124
|
-
Description: >-
|
125
|
-
Do not use unless with else. Rewrite these with the positive
|
126
|
-
case first.
|
127
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
|
128
|
-
Enabled: true
|
129
|
-
|
130
|
-
Naming/VariableName:
|
131
|
-
Description: 'Use the configured style when naming variables.'
|
132
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
133
|
-
Enabled: true
|
134
|
-
|
135
|
-
#################### Lint ################################
|
136
|
-
### Warnings
|
137
|
-
|
138
|
-
Lint/AmbiguousOperator:
|
139
|
-
Description: >-
|
140
|
-
Checks for ambiguous operators in the first argument of a
|
141
|
-
method invocation without parentheses.
|
142
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
|
143
|
-
Enabled: true
|
144
|
-
|
145
|
-
Lint/AmbiguousRegexpLiteral:
|
146
|
-
Description: >-
|
147
|
-
Checks for ambiguous regexp literals in the first argument of
|
148
|
-
a method invocation without parenthesis.
|
149
|
-
Enabled: true
|
150
|
-
|
151
|
-
Lint/AssignmentInCondition:
|
152
|
-
Description: "Don't use assignment in conditions."
|
153
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
154
|
-
Enabled: true
|
155
|
-
|
156
|
-
Lint/BlockAlignment:
|
157
|
-
Description: 'Align block ends correctly.'
|
158
|
-
Enabled: true
|
159
|
-
|
160
|
-
Lint/CircularArgumentReference:
|
161
|
-
Description: "Don't refer to the keyword argument in the default value."
|
162
|
-
Enabled: true
|
163
|
-
|
164
|
-
Lint/ConditionPosition:
|
165
|
-
Description: >-
|
166
|
-
Checks for condition placed in a confusing position relative to
|
167
|
-
the keyword.
|
168
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
169
|
-
Enabled: true
|
170
|
-
|
171
|
-
Lint/Debugger:
|
172
|
-
Description: 'Check for debugger calls.'
|
173
|
-
Enabled: true
|
174
|
-
|
175
|
-
Lint/DefEndAlignment:
|
176
|
-
Description: 'Align ends corresponding to defs correctly.'
|
177
|
-
Enabled: true
|
178
|
-
|
179
|
-
Lint/DeprecatedClassMethods:
|
180
|
-
Description: 'Check for deprecated class method calls.'
|
181
|
-
Enabled: true
|
182
|
-
|
183
|
-
Lint/DuplicateMethods:
|
184
|
-
Description: 'Check for duplicate methods calls.'
|
185
|
-
Enabled: true
|
186
|
-
|
187
|
-
Lint/DuplicatedKey:
|
188
|
-
Description: 'Check for duplicate keys in hash literals.'
|
189
|
-
Enabled: true
|
190
|
-
|
191
|
-
Lint/EachWithObjectArgument:
|
192
|
-
Description: 'Check for immutable argument given to each_with_object.'
|
193
|
-
Enabled: true
|
194
|
-
|
195
|
-
Lint/ElseLayout:
|
196
|
-
Description: 'Check for odd code arrangement in an else block.'
|
197
|
-
Enabled: true
|
198
|
-
|
199
|
-
Lint/EmptyEnsure:
|
200
|
-
Description: 'Checks for empty ensure block.'
|
201
|
-
Enabled: true
|
202
|
-
|
203
|
-
Lint/EmptyInterpolation:
|
204
|
-
Description: 'Checks for empty string interpolation.'
|
205
|
-
Enabled: true
|
206
|
-
|
207
|
-
Lint/EndAlignment:
|
208
|
-
Description: 'Align ends correctly.'
|
209
|
-
Enabled: true
|
210
|
-
|
211
|
-
Lint/EndInMethod:
|
212
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
213
|
-
Enabled: true
|
214
|
-
|
215
|
-
Lint/EnsureReturn:
|
216
|
-
Description: 'Do not use return in an ensure block.'
|
217
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
|
218
|
-
Enabled: true
|
219
|
-
|
220
|
-
Security/Eval:
|
221
|
-
Description: 'The use of eval represents a serious security risk.'
|
222
|
-
Enabled: true
|
223
|
-
|
224
|
-
Lint/FormatParameterMismatch:
|
225
|
-
Description: 'The number of parameters to format/sprint must match the fields.'
|
226
|
-
Enabled: true
|
227
|
-
|
228
|
-
Lint/HandleExceptions:
|
229
|
-
Description: "Don't suppress exception."
|
230
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
231
|
-
Enabled: true
|
232
|
-
|
233
|
-
Lint/LiteralInCondition:
|
234
|
-
Description: 'Checks of literals used in conditions.'
|
235
|
-
Enabled: true
|
236
|
-
|
237
|
-
Lint/LiteralInInterpolation:
|
238
|
-
Description: 'Checks for literals used in interpolation.'
|
239
|
-
Enabled: true
|
240
|
-
|
241
|
-
Lint/Loop:
|
242
|
-
Description: >-
|
243
|
-
Use Kernel#loop with break rather than begin/end/until or
|
244
|
-
begin/end/while for post-loop tests.
|
245
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
246
|
-
Enabled: true
|
247
|
-
|
248
|
-
Lint/NestedMethodDefinition:
|
249
|
-
Description: 'Do not use nested method definitions.'
|
250
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
251
|
-
Enabled: true
|
252
|
-
|
253
|
-
Lint/NonLocalExitFromIterator:
|
254
|
-
Description: 'Do not use return in iterator to cause non-local exit.'
|
255
|
-
Enabled: true
|
256
|
-
|
257
|
-
Lint/ParenthesesAsGroupedExpression:
|
258
|
-
Description: >-
|
259
|
-
Checks for method calls with a space before the opening
|
260
|
-
parenthesis.
|
261
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
262
|
-
Enabled: true
|
263
|
-
|
264
|
-
Lint/RequireParentheses:
|
265
|
-
Description: >-
|
266
|
-
Use parentheses in the method call to avoid confusion
|
267
|
-
about precedence.
|
268
|
-
Enabled: true
|
269
|
-
|
270
|
-
Lint/RescueException:
|
271
|
-
Description: 'Avoid rescuing the Exception class.'
|
272
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
|
273
|
-
Enabled: true
|
274
|
-
|
275
|
-
Lint/ShadowingOuterLocalVariable:
|
276
|
-
Description: >-
|
277
|
-
Do not use the same name as outer local variable
|
278
|
-
for block arguments or block local variables.
|
279
|
-
Enabled: true
|
280
|
-
|
281
|
-
Layout/SpaceBeforeFirstArg:
|
282
|
-
Description: >-
|
283
|
-
Put a space between a method name and the first argument
|
284
|
-
in a method call without parentheses.
|
285
|
-
Enabled: true
|
286
|
-
|
287
|
-
Lint/StringConversionInInterpolation:
|
288
|
-
Description: 'Checks for Object#to_s usage in string interpolation.'
|
289
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
|
290
|
-
Enabled: true
|
291
|
-
|
292
|
-
Lint/UnderscorePrefixedVariableName:
|
293
|
-
Description: 'Do not use prefix `_` for a variable that is used.'
|
294
|
-
Enabled: true
|
295
|
-
|
296
|
-
Lint/UnneededDisable:
|
297
|
-
Description: >-
|
298
|
-
Checks for rubocop:disable comments that can be removed.
|
299
|
-
Note: this cop is not disabled when disabling all cops.
|
300
|
-
It must be explicitly disabled.
|
301
|
-
Enabled: true
|
302
|
-
|
303
|
-
Lint/UnusedBlockArgument:
|
304
|
-
Description: 'Checks for unused block arguments.'
|
305
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
306
|
-
Enabled: true
|
307
|
-
|
308
|
-
Lint/UnusedMethodArgument:
|
309
|
-
Description: 'Checks for unused method arguments.'
|
310
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
311
|
-
Enabled: true
|
312
|
-
|
313
|
-
Lint/UnreachableCode:
|
314
|
-
Description: 'Unreachable code.'
|
315
|
-
Enabled: true
|
316
|
-
|
317
|
-
Lint/UselessAccessModifier:
|
318
|
-
Description: 'Checks for useless access modifiers.'
|
319
|
-
Enabled: true
|
320
|
-
|
321
|
-
Lint/UselessAssignment:
|
322
|
-
Description: 'Checks for useless assignment to a local variable.'
|
323
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
324
|
-
Enabled: true
|
325
|
-
|
326
|
-
Lint/UselessComparison:
|
327
|
-
Description: 'Checks for comparison of something with itself.'
|
328
|
-
Enabled: true
|
329
|
-
|
330
|
-
Lint/UselessElseWithoutRescue:
|
331
|
-
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
332
|
-
Enabled: true
|
333
|
-
|
334
|
-
Lint/UselessSetterCall:
|
335
|
-
Description: 'Checks for useless setter call to a local variable.'
|
336
|
-
Enabled: true
|
337
|
-
|
338
|
-
Lint/Void:
|
339
|
-
Description: 'Possible use of operator/literal/variable in void context.'
|
340
|
-
Enabled: true
|