Showing 7 of 13 total issues
Method Kakasi.Convert
has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring. Open
Open
func (k Kakasi) Convert(text string) (IConvertedSlice, error) {
if len([]rune(text)) == 0 {
return IConvertedSlice{{}}, nil
}
- 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
ch
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type ch struct{}
Method Kakasi.Convert
has 97 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (k Kakasi) Convert(text string) (IConvertedSlice, error) {
if len([]rune(text)) == 0 {
return IConvertedSlice{{}}, nil
}
Method convertTables.Latin1Table
has 97 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c convertTables) Latin1Table() map[rune]string {
return map[rune]string{
0x00A1: "!", // inverted exclamation mark
0x00A2: "cent", // cent mark
0x00A3: "GBP", // pound mark
Method convertTables.CyrillicTable
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (convertTables) CyrillicTable() map[rune]string {
return map[rune]string{
0x0400: "E", // Ѐ
0x0401: "E", // Ё
0x0402: "Dj", // Ђ
Function Generate
has 7 return statements (exceeds 4 allowed). Open
Open
func Generate(dst, indent string) error {
for tgt, src := range lookupMapResources {
m, err := makeLookupMap(src)
if err != nil {
return err
Method Kata.convertH
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func (k Kata) convertH(text string) (string, int, error) {
var converted string
var max_length int
var diff rune = 0x30A1 - 0x3041
- 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"