Skip to content

Commit 28a7412

Browse files
committed
modernize hash and array style
1 parent 05dd408 commit 28a7412

19 files changed

+91
-97
lines changed

.rubocop.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ Metrics/MethodLength:
2727
Exclude:
2828
- 'test/**/*'
2929

30-
Style/HashSyntax:
31-
EnforcedStyle: hash_rockets
32-
33-
Style/SymbolArray:
34-
EnforcedStyle: brackets
35-
3630
Naming/MethodParameterName:
3731
Enabled: false
3832

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'bundler'
44

5-
Bundler::GemHelper.install_tasks :name => 'openscap'
5+
Bundler::GemHelper.install_tasks name: 'openscap'
66

77
task :test do
88
$LOAD_PATH.unshift('lib')

lib/openscap/ds/arf.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def html
5858

5959
attach_function :ds_rds_session_new_from_source, [:pointer], :pointer
6060
attach_function :ds_rds_session_free, [:pointer], :void
61-
attach_function :ds_rds_session_select_report, [:pointer, :string], :pointer
62-
attach_function :ds_rds_session_replace_report_with_source, [:pointer, :pointer], :int
63-
attach_function :ds_rds_session_select_report_request, [:pointer, :string], :pointer
61+
attach_function :ds_rds_session_select_report, %i[pointer string], :pointer
62+
attach_function :ds_rds_session_replace_report_with_source, %i[pointer pointer], :int
63+
attach_function :ds_rds_session_select_report_request, %i[pointer string], :pointer
6464
attach_function :ds_rds_session_get_html_report, [:pointer], :pointer
6565
end

lib/openscap/ds/sds.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ def destroy
4343

4444
attach_function :ds_sds_session_new_from_source, [:pointer], :pointer
4545
attach_function :ds_sds_session_free, [:pointer], :void
46-
attach_function :ds_sds_session_select_checklist, [:pointer, :string, :string, :string], :pointer
47-
attach_function :ds_sds_session_get_html_guide, [:pointer, :string], :string
46+
attach_function :ds_sds_session_select_checklist, %i[pointer string string string], :pointer
47+
attach_function :ds_sds_session_get_html_guide, %i[pointer string], :string
4848
end

lib/openscap/source.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def create_from_memory(param)
5151
end
5252

5353
attach_function :oscap_source_new_from_file, [:string], :pointer
54-
attach_function :oscap_source_new_from_memory, [:pointer, :int, :string], :pointer
54+
attach_function :oscap_source_new_from_memory, %i[pointer int string], :pointer
5555
attach_function :oscap_source_get_scap_type, [:pointer], :int
5656
attach_function :oscap_source_free, [:pointer], :void
57-
attach_function :oscap_source_save_as, [:pointer, :string], :int
57+
attach_function :oscap_source_save_as, %i[pointer string], :int
5858

59-
callback :xml_reporter, [:string, :int, :string, :pointer], :int
60-
attach_function :oscap_source_validate, [:pointer, :xml_reporter, :pointer], :int
59+
callback :xml_reporter, %i[string int string pointer], :int
60+
attach_function :oscap_source_validate, %i[pointer xml_reporter pointer], :int
6161
XmlReporterCallback = proc do |filename, line_number, error_message, e|
6262
offset = e.get_string(0).length
6363
msg = "#{filename}:#{line_number}: #{error_message}"

lib/openscap/text.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def destroy
3737
end
3838

3939
attach_function :oscap_text_new, [], :pointer
40-
attach_function :oscap_text_set_text, [:pointer, :string], :bool
40+
attach_function :oscap_text_set_text, %i[pointer string], :bool
4141
attach_function :oscap_text_get_text, [:pointer], :string
4242
attach_function :oscap_text_free, [:pointer], :void
4343

44-
attach_function :oscap_textlist_get_preferred_plaintext, [:pointer, :string], :string
44+
attach_function :oscap_textlist_get_preferred_plaintext, %i[pointer string], :string
4545
attach_function :oscap_text_iterator_free, [:pointer], :void
4646
end

lib/openscap/xccdf/fix.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def content
2929

3030
def to_hash
3131
{
32-
:id => id,
33-
:platform => platform,
34-
:system => fix_system,
35-
:content => content
32+
id:,
33+
platform:,
34+
system: fix_system,
35+
content:
3636
}
3737
end
3838
end

lib/openscap/xccdf/reference.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def html_link
2424

2525
def to_hash
2626
{
27-
:title => title,
28-
:href => href,
29-
:html_link => html_link
27+
title:,
28+
href:,
29+
html_link:
3030
}
3131
end
3232
end

lib/openscap/xccdf/rule.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ class Rule < Item
1111
def severity
1212
severity = OpenSCAP.xccdf_rule_get_severity(@raw)
1313
severity_mapping = {
14-
:xccdf_level_not_defined => 'Not defined',
15-
:xccdf_unknown => 'Unknown',
16-
:xccdf_info => 'Info',
17-
:xccdf_low => 'Low',
18-
:xccdf_medium => 'Medium',
19-
:xccdf_high => 'High'
14+
xccdf_level_not_defined: 'Not defined',
15+
xccdf_unknown: 'Unknown',
16+
xccdf_info: 'Info',
17+
xccdf_low: 'Low',
18+
xccdf_medium: 'Medium',
19+
xccdf_high: 'High'
2020
}
2121
severity_mapping[severity] || severity_mapping[:xccdf_unknown]
2222
end

lib/openscap/xccdf/session.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def sds?
1717

1818
def load(opts = {})
1919
o = {
20-
:datastream_id => nil,
21-
:component_id => nil
20+
datastream_id: nil,
21+
component_id: nil
2222
}.merge(opts)
2323
if sds?
2424
OpenSCAP.xccdf_session_set_datastream_id(@s, o[:datastream_id])
@@ -45,12 +45,12 @@ def remediate
4545

4646
def export_results(opts = {})
4747
o = {
48-
:rds_file => nil,
49-
:xccdf_file => nil,
50-
:report_file => nil,
51-
:oval_results => false,
52-
:oval_variables => false,
53-
:engines_results => false
48+
rds_file: nil,
49+
xccdf_file: nil,
50+
report_file: nil,
51+
oval_results: false,
52+
oval_variables: false,
53+
engines_results: false
5454
}.merge!(opts)
5555
export_targets o
5656
export
@@ -94,13 +94,13 @@ def export_targets(opts = {})
9494

9595
attach_function :xccdf_session_is_sds, [:pointer], :bool
9696

97-
attach_function :xccdf_session_set_profile_id, [:pointer, :string], :bool
98-
attach_function :xccdf_session_set_datastream_id, [:pointer, :string], :void
99-
attach_function :xccdf_session_set_component_id, [:pointer, :string], :void
100-
attach_function :xccdf_session_set_arf_export, [:pointer, :string], :bool
101-
attach_function :xccdf_session_set_xccdf_export, [:pointer, :string], :bool
102-
attach_function :xccdf_session_set_report_export, [:pointer, :string], :bool
103-
attach_function :xccdf_session_set_oval_variables_export, [:pointer, :bool], :void
104-
attach_function :xccdf_session_set_oval_results_export, [:pointer, :bool], :void
105-
attach_function :xccdf_session_set_check_engine_plugins_results_export, [:pointer, :bool], :void
97+
attach_function :xccdf_session_set_profile_id, %i[pointer string], :bool
98+
attach_function :xccdf_session_set_datastream_id, %i[pointer string], :void
99+
attach_function :xccdf_session_set_component_id, %i[pointer string], :void
100+
attach_function :xccdf_session_set_arf_export, %i[pointer string], :bool
101+
attach_function :xccdf_session_set_xccdf_export, %i[pointer string], :bool
102+
attach_function :xccdf_session_set_report_export, %i[pointer string], :bool
103+
attach_function :xccdf_session_set_oval_variables_export, %i[pointer bool], :void
104+
attach_function :xccdf_session_set_oval_results_export, %i[pointer bool], :void
105+
attach_function :xccdf_session_set_check_engine_plugins_results_export, %i[pointer bool], :void
106106
end

0 commit comments

Comments
 (0)