Skip to content

Commit

Permalink
reduce deepest nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 22, 2015
1 parent 408a046 commit c067fba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 40 deletions.
14 changes: 1 addition & 13 deletions .rubocop.yml
Expand Up @@ -2,39 +2,27 @@
inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml

# Offense count: 493
Metrics/AbcSize:
Max: 446

# Offense count: 51
Metrics/BlockNesting:
Max: 6
Max: 5

# Offense count: 84
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 2880

# Offense count: 184
Metrics/CyclomaticComplexity:
Max: 63

# Offense count: 1820
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 274

# Offense count: 824
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 931

# Offense count: 20
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 11

# Offense count: 179
Metrics/PerceivedComplexity:
Max: 76

Expand Down
39 changes: 12 additions & 27 deletions library/types/src/modules/String.rb
Expand Up @@ -499,24 +499,17 @@ def ParseOptions(options, parameters)
"r" => " ", # CR
"t" => "\t", # tab
"v" => "v", # vertical tab
"\\" => "\\"
} # backslash

if Builtins.haskey(backslash_seq, nextcharacter) == true
character = Ops.get_string(
backslash_seq,
nextcharacter,
"DUMMY"
)
"\\" => "\\", # backslash
# backslash will be removed later,
# double quote and escaped double quote have to different yet
"\"" => "\\\""
}

if backslash_seq[nextcharacter]
character = backslash_seq[nextcharacter]
else
if nextcharacter != "\""
# ignore backslash in invalid backslash sequence
character = nextcharacter
else
# backslash will be removed later,
# double quote and escaped double quote have to different yet
character = "\\\""
end
# ignore backslash in invalid backslash sequence
character = nextcharacter
end

Builtins.y2debug("backslash sequence: '%1'", character)
Expand Down Expand Up @@ -550,11 +543,7 @@ def ParseOptions(options, parameters)
# after double quoted string - handle non-separator chars after double quote
elsif state == :in_quoted_string_after_dblqt
if Builtins.issubstring(separator, character) == true
if unique == true
ret = Builtins.add(ret, str) if !Builtins.contains(ret, str)
else
ret = Builtins.add(ret, str)
end
ret = Builtins.add(ret, str) if !unique || !Builtins.contains(ret, str)

str = ""
state = :out_of_string
Expand All @@ -578,11 +567,7 @@ def ParseOptions(options, parameters)

str = CutBlanks(str) if remove_whitespace == true

if unique == true
ret = Builtins.add(ret, str) if !Builtins.contains(ret, str)
else
ret = Builtins.add(ret, str)
end
ret = Builtins.add(ret, str) if !unique || !Builtins.contains(ret, str)

str = ""
elsif character == "\\\""
Expand Down

0 comments on commit c067fba

Please sign in to comment.