Skip to content

Commit 0eed042

Browse files
committed
Rubocop now wants us to fail with raise
Addressing: C: Always use raise to signal exceptions. We used fail as advised by previous version of the rubocop software.
1 parent 3d2d7c4 commit 0eed042

File tree

14 files changed

+32
-32
lines changed

14 files changed

+32
-32
lines changed

lib/openscap/ds/arf.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014 Red Hat Inc.
2+
# Copyright (c) 2014--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -25,7 +25,7 @@ def initialize(param)
2525
@source = OpenSCAP::Source.new(param)
2626
@session = OpenSCAP.ds_rds_session_new_from_source @source.raw
2727
else
28-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::DS:Arf with '#{param}'"
28+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::DS:Arf with '#{param}'"
2929
end
3030
OpenSCAP.raise! if @session.null?
3131
end

lib/openscap/openscap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014 Red Hat Inc.
2+
# Copyright (c) 2014--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -31,7 +31,7 @@ def self.raise!(msg = nil)
3131
else
3232
err += "\n#{msg}"
3333
end
34-
fail OpenSCAPError, err
34+
raise OpenSCAPError, err
3535
end
3636

3737
attach_function :oscap_init, [], :void

lib/openscap/source.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014 Red Hat Inc.
2+
# Copyright (c) 2014--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -18,15 +18,15 @@ class Source
1818
def initialize(param)
1919
case param
2020
when nil
21-
fail OpenSCAPError, 'No filename specified!'
21+
raise OpenSCAPError, 'No filename specified!'
2222
when String
2323
@raw = OpenSCAP.oscap_source_new_from_file(param)
2424
when Hash
2525
@raw = create_from_memory param
2626
when FFI::Pointer
2727
@raw = param
2828
else
29-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Source with '#{param}'"
29+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Source with '#{param}'"
3030
end
3131
OpenSCAP.raise! if @raw.null?
3232
end

lib/openscap/xccdf/benchmark.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014 Red Hat Inc.
2+
# Copyright (c) 2014--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -23,8 +23,8 @@ def initialize(p)
2323
when OpenSCAP::Source
2424
@raw = OpenSCAP.xccdf_benchmark_import_source p.raw
2525
else
26-
fail OpenSCAP::OpenSCAPError,
27-
"Cannot initialize OpenSCAP::Xccdf::Benchmark with '#{p}'"
26+
raise OpenSCAP::OpenSCAPError,
27+
"Cannot initialize OpenSCAP::Xccdf::Benchmark with '#{p}'"
2828
end
2929
OpenSCAP.raise! if @raw.null?
3030
end

lib/openscap/xccdf/fix.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2015 Red Hat Inc.
2+
# Copyright (c) 2015--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -13,7 +13,7 @@ module OpenSCAP
1313
module Xccdf
1414
class Fix
1515
def initialize(raw)
16-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Reference with '#{raw}'" \
16+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Reference with '#{raw}'" \
1717
unless raw.is_a?(FFI::Pointer)
1818
@raw = raw
1919
end

lib/openscap/xccdf/item.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2015 Red Hat Inc.
2+
# Copyright (c) 2015--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -19,7 +19,7 @@ module OpenSCAP
1919
module Xccdf
2020
class Item
2121
def self.build(t)
22-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Item with #{t}" \
22+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Item with #{t}" \
2323
unless t.is_a?(FFI::Pointer)
2424
# This is Abstract base class that enables you to build its child
2525
case OpenSCAP.xccdf_item_get_type t
@@ -28,13 +28,13 @@ def self.build(t)
2828
when :rule
2929
OpenSCAP::Xccdf::Rule.new t
3030
else
31-
fail OpenSCAP::OpenSCAPError, "Unknown Xccdf::Item type: #{OpenSCAP.xccdf_item_get_type t}"
31+
raise OpenSCAP::OpenSCAPError, "Unknown Xccdf::Item type: #{OpenSCAP.xccdf_item_get_type t}"
3232
end
3333
end
3434

3535
def initialize(t)
3636
if self.class == OpenSCAP::Xccdf::Item
37-
fail OpenSCAP::OpenSCAPError, 'Cannot initialize Xccdf::Item abstract base class.'
37+
raise OpenSCAP::OpenSCAPError, 'Cannot initialize Xccdf::Item abstract base class.'
3838
end
3939
@raw = t
4040
end

lib/openscap/xccdf/policy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def initialize(p)
2121
when FFI::Pointer
2222
@raw = p
2323
else
24-
fail OpenSCAP::OpenSCAPError,
25-
"Cannot initialize OpenSCAP::Xccdf::Policy with '#{p}'"
24+
raise OpenSCAP::OpenSCAPError,
25+
"Cannot initialize OpenSCAP::Xccdf::Policy with '#{p}'"
2626
end
2727
OpenSCAP.raise! if @raw.null?
2828
end

lib/openscap/xccdf/policy_model.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def initialize(b)
2323
when OpenSCAP::Xccdf::Benchmark
2424
@raw = OpenSCAP.xccdf_policy_model_new(b.raw)
2525
else
26-
fail OpenSCAP::OpenSCAPError,
27-
"Cannot initialize OpenSCAP::Xccdf::PolicyModel with '#{b}'"
26+
raise OpenSCAP::OpenSCAPError,
27+
"Cannot initialize OpenSCAP::Xccdf::PolicyModel with '#{b}'"
2828
end
2929
OpenSCAP.raise! if @raw.null?
3030
end

lib/openscap/xccdf/profile.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(p)
2121
when FFI::Pointer
2222
@raw = p
2323
else
24-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Profile with #{p}"
24+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Profile with #{p}"
2525
end
2626
end
2727

lib/openscap/xccdf/reference.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2015 Red Hat Inc.
2+
# Copyright (c) 2015--2016 Red Hat Inc.
33
#
44
# This software is licensed to you under the GNU General Public License,
55
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
@@ -13,7 +13,7 @@ module OpenSCAP
1313
module Xccdf
1414
class Reference
1515
def initialize(raw)
16-
fail OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Reference with '#{raw}'" \
16+
raise OpenSCAP::OpenSCAPError, "Cannot initialize OpenSCAP::Xccdf::Reference with '#{raw}'" \
1717
unless raw.is_a?(FFI::Pointer)
1818
@raw = raw
1919
end

0 commit comments

Comments
 (0)