Skip to content

Commit

Permalink
Merge pull request r509#86 from reaperhulk/more-stylin
Browse files Browse the repository at this point in the history
more rubocop fixes
  • Loading branch information
reaperhulk committed Apr 13, 2014
2 parents a071645 + a5cc52f commit 62c2253
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Expand Up @@ -41,3 +41,7 @@ NumericLiterals:

IfUnlessModifier:
Enabled: false

# false positive
LiteralInInterpolation:
Enabled: false
4 changes: 2 additions & 2 deletions lib/r509/cert/extensions/base.rb
Expand Up @@ -18,7 +18,7 @@ def self.wrap_openssl_extensions(extensions)
r509_extensions = {}
extensions.each do |openssl_extension|
R509_EXTENSION_CLASSES.each do |r509_class|
if ( r509_class::OID.downcase == openssl_extension.oid.downcase)
if r509_class::OID.downcase == openssl_extension.oid.downcase
if r509_extensions.key?(r509_class)
raise ArgumentError, "Only one extension object allowed per OID"
end
Expand All @@ -39,7 +39,7 @@ def self.get_unknown_extensions(extensions)
extensions.each do |openssl_extension|
match_found = false
R509_EXTENSION_CLASSES.each do |r509_class|
if ( r509_class::OID.downcase == openssl_extension.oid.downcase)
if r509_class::OID.downcase == openssl_extension.oid.downcase
match_found = true
break
end
Expand Down
4 changes: 2 additions & 2 deletions lib/r509/config/ca_config.rb
Expand Up @@ -120,12 +120,12 @@ def initialize(opts = {})

# @return [R509::Cert] either a custom OCSP cert or the ca_cert
def ocsp_cert
if @ocsp_cert.nil? then @ca_cert else @ocsp_cert end
(@ocsp_cert.nil?) ? @ca_cert : @ocsp_cert
end

# @return [R509::Cert] either a custom CRL cert or the ca_cert
def crl_cert
if @crl_cert.nil? then @ca_cert else @crl_cert end
(@crl_cert.nil?) ? @ca_cert : @crl_cert
end

# @param [String] name The name of the profile
Expand Down
2 changes: 1 addition & 1 deletion lib/r509/csr.rb
Expand Up @@ -99,7 +99,7 @@ def self.load_from_file(filename)

# @return [OpenSSL::PKey::RSA,OpenSSL::PKey::DSA,OpenSSL::PKey::EC] public key
def public_key
if (@req.kind_of?(OpenSSL::X509::Request)) then
if @req.kind_of?(OpenSSL::X509::Request) then
@req.public_key
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/cert/extensions/base_spec.rb
Expand Up @@ -33,7 +33,9 @@
it "should not have failed to map an implemented extension" do
missing_extensions = []
@wrappable_extensions.each do |openssl_ext|
if (@r509_extensions.select { |r509_class, r509_ext| r509_ext.oid == openssl_ext.oid }) == {} then missing_extensions << openssl_ext.oid end
if (@r509_extensions.select { |r509_class, r509_ext| r509_ext.oid == openssl_ext.oid }) == {}
missing_extensions << openssl_ext.oid
end
end

missing_extensions.should == []
Expand Down
4 changes: 2 additions & 2 deletions spec/oid_mapper_spec.rb
Expand Up @@ -21,8 +21,8 @@
expect { R509::Subject.new [['testOIDName', 'random_oid']] }.to raise_error(OpenSSL::X509::NameError, 'invalid field name')
expect { R509::Subject.new [['anotherOIDName', 'second_random']] }.to raise_error(OpenSSL::X509::NameError, 'invalid field name')
R509::OIDMapper.batch_register([
{ :oid => '1.4.3.2.1.2.3.4.4.4.4', :short_name => 'testOIDName' },
{ :oid => '1.4.3.2.1.2.5.4.4.4.4', :short_name => 'anotherOIDName' }
{ :oid => '1.4.3.2.1.2.3.4.4.4.4', :short_name => 'testOIDName' },
{ :oid => '1.4.3.2.1.2.5.4.4.4.4', :short_name => 'anotherOIDName' }
])
subject_new = R509::Subject.new [['testOIDName', 'random_oid'], ['anotherOIDName', 'second_random']]
subject_new['testOIDName'].should == 'random_oid'
Expand Down

0 comments on commit 62c2253

Please sign in to comment.