File stub.go
has 731 lines of code (exceeds 500 allowed). Consider refactoring. Open
package stub
import (
"fmt"
"io"
Function generateObjectInterface
has 89 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateObjectInterface(file *jen.File, set *signature.TypeSet,
itf *idl.InterfaceType) error {
// Proxy and stub shall generate the name method name: reuse
// the MetaObject method ForEachMethodAndSignal to get an
Function generateStubMetaObject
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubMetaObject(file *jen.File, itf *idl.InterfaceType) error {
metaMethods := func(d jen.Dict) {
for _, method := range itf.Methods {
d[jen.Lit(int(method.ID))] = jen.Values(jen.Dict{
jen.Id("Uid"): jen.Lit(int(method.ID)),
Function generateStubObject
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubObject(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
if itf.Name == "Object" {
code := jen.Id(`p.signal.Activate(activation)`)
writing = append(writing, code)
Function generateReceiveMethod
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateReceiveMethod(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
prelude := jen.Comment("action dispatch")
if itf.Name == "Object" {
Function methodBodyBlock
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func methodBodyBlock(itf *idl.InterfaceType, method idl.Method,
methodName string) (*jen.Statement, error) {
writing := make([]jen.Code, 0)
params := make([]jen.Code, 0)
Function generateStubPropertyCallback
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubPropertyCallback(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
method := func(m object.MetaMethod, methodName string) error {
Function generateObjectInterface
has 8 return statements (exceeds 4 allowed). Open
func generateObjectInterface(file *jen.File, set *signature.TypeSet,
itf *idl.InterfaceType) error {
// Proxy and stub shall generate the name method name: reuse
// the MetaObject method ForEachMethodAndSignal to get an
Function generateStubMethods
has 8 return statements (exceeds 4 allowed). Open
func generateStubMethods(file *jen.File, itf *idl.InterfaceType) error {
method := func(m object.MetaMethod, methodName string) error {
method := itf.Methods[m.Uid]
err := generateMethodMarshal(file, itf, method, methodName)
Function generateStub
has 6 return statements (exceeds 4 allowed). Open
func generateStub(f *jen.File, itf *idl.InterfaceType) error {
if err := generateStubType(f, itf); err != nil {
return err
}
if err := generateStubConstructor(f, itf); err != nil {
Function generateReceiveMethod
has 5 return statements (exceeds 4 allowed). Open
func generateReceiveMethod(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
prelude := jen.Comment("action dispatch")
if itf.Name == "Object" {
Function generateStubPropertyCallback
has 5 return statements (exceeds 4 allowed). Open
func generateStubPropertyCallback(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
method := func(m object.MetaMethod, methodName string) error {
Similar blocks of code found in 2 locations. Consider refactoring. Open
func generateSignalHelper(file *jen.File, itf *idl.InterfaceType,
signal idl.Signal, signalName string) error {
tuple := signal.Tuple()
body, err := signalBodyBlock(itf, signal, signalName)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 186.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func generatePropertyHelper(file *jen.File, itf *idl.InterfaceType,
property idl.Property, propertyName string) error {
tuple := property.Tuple()
body, err := propertyBodyBlock(itf, property, propertyName)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 186.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
metaSignals := func(d jen.Dict) {
for _, signal := range itf.Signals {
d[jen.Lit(int(signal.ID))] = jen.Values(jen.Dict{
jen.Id("Uid"): jen.Lit(int(signal.ID)),
jen.Id("Name"): jen.Lit(signal.Name),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 163.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
metaProperties := func(d jen.Dict) {
for _, property := range itf.Properties {
d[jen.Lit(int(property.ID))] = jen.Values(jen.Dict{
jen.Id("Uid"): jen.Lit(int(property.ID)),
jen.Id("Name"): jen.Lit(property.Name),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 163.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
for _, param := range property.Params {
code = jen.If(jen.Err().Op(":=").Add(
param.Type.Marshal(param.Name, "&buf"),
).Op(";").Err().Op("!=").Nil()).Block(
jen.Id(`return fmt.Errorf("serialize ` +
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
for _, param := range signal.Params {
code = jen.If(jen.Err().Op(":=").Add(
param.Type.Marshal(param.Name, "&buf"),
).Op(";").Err().Op("!=").Nil()).Block(
jen.Id(`return fmt.Errorf("serialize ` +
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
property := func(p object.MetaProperty, propertyName string) error {
property := itf.Properties[p.Uid]
propertyName = "Update" + propertyName
err := generatePropertyHelper(file, itf, property,
propertyName)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
signal := func(s object.MetaSignal, signalName string) error {
signal := itf.Signals[s.Uid]
signalName = "Signal" + signalName
err := generateSignalHelper(file, itf, signal, signalName)
if err != nil {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76