Showing 147 of 147 total issues
File go.rb
has 944 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Xdrgen
module Generators
class Go < Xdrgen::Generators::Base
File rust.rb
has 870 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Xdrgen
module Generators
class Rust < Xdrgen::Generators::Base
File java.rb
has 843 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
module Xdrgen
module Generators
class Java < Xdrgen::Generators::Base
Method render_union
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def render_union(union, render_import_in_func = false)
union_name = name union
union_name_underscore = union_name.underscore
@init_out.puts "from .#{union_name_underscore} import #{union_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
File python.rb
has 597 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Xdrgen
module Generators
class Python < Xdrgen::Generators::Base
MAX_SIZE = (2 ** 32) - 1
CIRCLE_IMPORT_UNION = %w[SCVal SCSpecTypeDef]
Method render_union
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def render_union(union, out)
out.puts "public #{name union} () {}"
out.puts <<-EOS.strip_heredoc
#{type_string union.discriminant.type} #{union.discriminant.name};
public #{type_string union.discriminant.type} getDiscriminant() {
- 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 render_encode_to_body
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def render_encode_to_body(out, var, type, self_encode:)
def check_error(str)
<<-EOS
if #{str}; err != nil {
return err
- 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
File csharp.rb
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Xdrgen
module Generators
class Csharp < Xdrgen::Generators::Base
def generate
render_lib
Method render_union
has 196 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_union(union, out)
out.puts "public #{name union} () {}"
out.puts <<-EOS.strip_heredoc
#{type_string union.discriminant.type} #{union.discriminant.name};
public #{type_string union.discriminant.type} getDiscriminant() {
Method render_decode_from_body
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def render_decode_from_body(out, var, type, declared_variables:, self_encode:)
tail = <<-EOS
n += nTmp
if err != nil {
return n, fmt.Errorf("decoding #{name type}: %w", err)
- 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 render_typedef
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_typedef(out, typedef)
if is_builtin_type(typedef.type)
out.puts "pub type #{name typedef} = #{reference(typedef, typedef.type)};"
else
out.puts "#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]"
Method render_union
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def render_union(out, union)
if union.default_arm.present?
$stderr.puts "warn: union #{name union} includes default arms and default arms are not supported in the rust generator"
end
discriminant_type = reference(nil, union.discriminant.type)
- 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 render_decode_from_body
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_decode_from_body(out, var, type, declared_variables:, self_encode:)
tail = <<-EOS
n += nTmp
if err != nil {
return n, fmt.Errorf("decoding #{name type}: %w", err)
Method render_union
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_union(union, render_import_in_func = false)
union_name = name union
union_name_underscore = union_name.underscore
@init_out.puts "from .#{union_name_underscore} import #{union_name}"
Method render_enum_of_all_types
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_enum_of_all_types(out, types)
out.puts <<-EOS.strip_heredoc
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(
all(feature = "serde", feature = "alloc"),
Class Go
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Go < Xdrgen::Generators::Base
def generate
@already_rendered = []
path = "#{@namespace}_generated.go"
Method render_struct
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_struct(struct, out)
out.puts "public #{name struct} () {}"
struct.members.each do |m|
out.puts <<-EOS.strip_heredoc
private #{decl_string(m.declaration)} #{m.name};
Method render_union
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_union(out, union)
if union.default_arm.present?
$stderr.puts "warn: union #{name union} includes default arms and default arms are not supported in the rust generator"
end
discriminant_type = reference(nil, union.discriminant.type)
Method render_union
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def render_union(out, union)
out.puts "xdr.union(\"#{name union}\", {"
out.indent do
out.puts "switchOn: #{reference union.discriminant.type},"
out.puts "switchName: \"#{member_name union.discriminant}\","
- 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 render_encode_to_body
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_encode_to_body(out, var, type, self_encode:)
def check_error(str)
<<-EOS
if #{str}; err != nil {
return err