Showing 14 of 14 total issues
Method purelyze
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def purelyze(locale, targets, excl_prefix, project, filer_ui_duplicates=false, exclude_units)
locale_file_name = locale_file_name(locale)
doc = Nokogiri::XML(File.open(locale_file_name))
puts "Removing all files not matching required targets" if $VERBOSE
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method export_master
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
master_file_name = locale_file_name(master_lang)
File.delete(master_file_name) if File.exist?(master_file_name)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method push_master_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def push_master_file(wti, master_lang, master_file_name)
# Pushing master file to WebtranslateIt
begin
puts "Uploading master file to WebtranslateIt"
file = File.open(master_file_name, 'r')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method import_plurals_if_needed
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_plurals_if_needed(locale)
plurals_fname = "#{locale}_plurals.yaml"
return if !File.exist?(plurals_fname)
puts "Importing translations from #{plurals_fname}" if $VERBOSE
plurals_yml = YAML.load_file(plurals_fname)
Method define_export_cmd
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def define_export_cmd
command :export do |c|
c.syntax = 'xlocalize export [options]'
c.description = 'Export localized strings from Xcode project'
c.option '--wti_key STRING', String, 'Webtranslateit API key'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(key, http = Net::HTTP.new("webtranslateit.com", 443))
@key = key
@http = http
@http.use_ssl = true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method export_master
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
master_file_name = locale_file_name(master_lang)
File.delete(master_file_name) if File.exist?(master_file_name)
Method localized_filename
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def localized_filename(file_name, locale)
parts = file_name.split('/')
# WebTranslateIt uses _ for Language_Country separator e.g. pt_PT
# but Xcode uses - e.g. pt-PT
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method export_master
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def export_master(wti, project, targets, excl_prefix, master_lang, exclude_units=[], no_cryptic)
Method purelyze
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def purelyze(locale, targets, excl_prefix, project, filer_ui_duplicates=false, exclude_units)
Method merge_on_top_of
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def merge_on_top_of(original_doc)
#original_doc = Nokogiri::XML(wti.pull(master_lang)['xliff'])
original_xliff = original_doc.at_css('xliff')
doc = self#Nokogiri::XML(File.open(master_file_name))
doc.xpath("//xmlns:file").each { |node|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method push_master_plurals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def push_master_plurals(plurals_file)
if @plurals_file_id.nil?
if $VERBOSE
$stderr.puts 'Creating plurals file'
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method filter_duplicate_storyboard_xib_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filter_duplicate_storyboard_xib_files
all_files = self.xpath("//xmlns:file").map { |node| Pathname.new(node["original"]).split.last.to_s }
self.xpath("//xmlns:file").each do |node|
fname = Pathname.new(node["original"]).split.last.to_s
if fname.end_with?(".strings")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method filter_plurals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filter_plurals(project)
plurals = {}
self.xpath("//xmlns:file").each { |node|
fname = node["original"]
next if !fname.end_with?(".strings")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"