sarumaj/go-kakasi

View on GitHub

Showing 7 of 13 total issues

Method Kakasi.Convert has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
Open

func (k Kakasi) Convert(text string) (IConvertedSlice, error) {
    if len([]rune(text)) == 0 {
        return IConvertedSlice{{}}, nil
    }

Severity: Minor
Found in kakasi.go - About 5 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

ch has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

type ch struct{}
Severity: Minor
Found in internal/properties/ch.go - About 4 hrs to fix

    Method Kakasi.Convert has 97 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (k Kakasi) Convert(text string) (IConvertedSlice, error) {
        if len([]rune(text)) == 0 {
            return IConvertedSlice{{}}, nil
        }
    
    
    Severity: Major
    Found in kakasi.go - About 2 hrs to fix

      Method convertTables.Latin1Table has 97 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c convertTables) Latin1Table() map[rune]string {
          return map[rune]string{
              0x00A1: "!",        // inverted exclamation mark
              0x00A2: "cent",     // cent mark
              0x00A3: "GBP",      // pound mark
      Severity: Major
      Found in internal/properties/convert_tables.go - About 2 hrs to fix

        Method convertTables.CyrillicTable has 84 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (convertTables) CyrillicTable() map[rune]string {
            return map[rune]string{
                0x0400: "E",   // Ѐ
                0x0401: "E",   // Ё
                0x0402: "Dj",  // Ђ
        Severity: Major
        Found in internal/properties/convert_tables.go - About 2 hrs to fix

          Function Generate has 7 return statements (exceeds 4 allowed).
          Open

          func Generate(dst, indent string) error {
              for tgt, src := range lookupMapResources {
                  m, err := makeLookupMap(src)
                  if err != nil {
                      return err
          Severity: Major
          Found in internal/codegen/codegen.go - About 45 mins to fix

            Method Kata.convertH has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
            Open

            func (k Kata) convertH(text string) (string, int, error) {
                var converted string
                var max_length int
            
                var diff rune = 0x30A1 - 0x3041
            Severity: Minor
            Found in internal/script/kata.go - 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