netbe/Babelish

View on GitHub

Showing 16 of 16 total issues

Method convert has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    def convert(name = @csv_filename)
      rowIndex     = 0
      excludedCols = []
      defaultCol   = 0

Severity: Minor
Found in lib/babelish/csv2base.rb - About 7 hrs to fix

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 create_csv_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def create_csv_file(keys, strings, comments = nil)
      raise "csv_filename must not be nil" unless @csv_filename
      CSV.open(@csv_filename, "wb") do |csv|
        @headers << "Comments" if !comments.nil? && !comments.empty?
        csv << @headers
Severity: Minor
Found in lib/babelish/base2csv.rb - About 2 hrs to fix

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 csv2base has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def csv2base(classname)
      args = options.dup
      if options[:fetch]
        say "Fetching csv file #{options[:filename]} from Google Drive"
        files = download(options[:filename], nil, options[:sheet])
Severity: Minor
Found in lib/babelish/commandline.rb - About 2 hrs to fix

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 convert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def convert(name = @csv_filename)
      rowIndex     = 0
      excludedCols = []
      defaultCol   = 0

Severity: Minor
Found in lib/babelish/csv2base.rb - About 1 hr to fix

    Method download has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def download(filename, output_filename = nil, worksheet_index = nil)
          gd = Babelish::GoogleDoc.new
          if output_filename || worksheet_index
            file_path = gd.download_spreadsheet filename.to_s, output_filename, worksheet_index
            files = [file_path].compact
    Severity: Minor
    Found in lib/babelish/commandline.rb - About 1 hr to fix

    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 csv2base has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def csv2base(classname)
          args = options.dup
          if options[:fetch]
            say "Fetching csv file #{options[:filename]} from Google Drive"
            files = download(options[:filename], nil, options[:sheet])
    Severity: Minor
    Found in lib/babelish/commandline.rb - About 1 hr to fix

      Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(filename, langs, args = {})
            default_args = {
              :excluded_states => [],
              :state_column => nil,
              :keys_column => 0,
      Severity: Minor
      Found in lib/babelish/csv2base.rb - About 1 hr to fix

        Method load_strings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_strings(strings_filename)
              strings = {}
              File.open(strings_filename, 'r') do |strings_file|
                strings_file.read.each_line do |line|
                  parsed_line = parse_dotstrings_line(line)
        Severity: Minor
        Found in lib/babelish/php2csv.rb - About 55 mins to fix

        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 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(args = {:filenames => []})
              raise ArgumentError.new("No filenames given") unless args[:filenames]
              if args[:headers]
                raise ArgumentError.new("number of headers and files don't match, don't forget the constant column") unless args[:headers].size == (args[:filenames].size + 1)
              end
        Severity: Minor
        Found in lib/babelish/base2csv.rb - About 45 mins to fix

        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 load_strings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_strings(strings_filename)
              strings = {}
              comments = {}
              # genstrings uses utf16, so that's what we expect. utf8 should not be impact
              file = File.open(strings_filename, "r:utf-16:utf-8")
        Severity: Minor
        Found in lib/babelish/strings2csv.rb - About 45 mins to fix

        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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(table, keys, comments = {})
              keys.each do |key|
                clean_key = key.gsub(' ', '')
                clean_key.gsub!(/[[:punct:]]/, '_')       
                clean_key.gsub!('__', '_')
        Severity: Minor
        Found in lib/babelish/xcode_macros.rb - About 35 mins to fix

        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 keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def keys
              @languages.each do |lang|
                next unless lang
                return lang.content.keys unless lang.content.keys.empty?
              end
        Severity: Minor
        Found in lib/babelish/csv2base.rb - About 35 mins to fix

        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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def convert(write_to_file = true)
              strings = {}
              keys = nil
              comments = {}
        
        
        Severity: Minor
        Found in lib/babelish/base2csv.rb - About 25 mins to fix

        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 csv_download has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def csv_download
            all = options[:sheet] ? false : options[:all]
            filename = options['gd_filename']
            raise ArgumentError.new("csv_download command : missing file to download") unless filename
            if all
        Severity: Minor
        Found in lib/babelish/commandline.rb - About 25 mins to fix

        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 write_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_content
              info = "List of created files:\n"
              count = 0
              @languages.each do |language|
                next if language.nil?
        Severity: Minor
        Found in lib/babelish/csv2base.rb - About 25 mins to fix

        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 language_filepaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def language_filepaths(language)
              require 'pathname'
              output_name = "strings.xml"
              output_name = "#{@output_basename}.xml" unless @output_basename.empty?
              region = language.region.to_s.empty? ? "" : "-r#{language.region}"
        Severity: Minor
        Found in lib/babelish/csv2android.rb - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language