Similar blocks of code found in 7 locations. Consider refactoring. Open
func NewQueryExecutionContext(o *SDK.QueryExecutionContext) QueryExecutionContext {
r := QueryExecutionContext{}
if o == nil {
return r
}
- 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 109.
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
exported method ResultConfiguration.ToSDK should have comment or be unexported Open
func (v ResultConfiguration) ToSDK() *SDK.ResultConfiguration {
- Exclude checks
exported type Row should have comment or be unexported Open
type Row struct {
- Exclude checks
exported function NewRow should have comment or be unexported Open
func NewRow(o SDK.Row) Row {
- Exclude checks
exported type ColumnInfo should have comment or be unexported Open
type ColumnInfo struct {
- Exclude checks
exported function NewResultConfiguration should have comment or be unexported Open
func NewResultConfiguration(o *SDK.ResultConfiguration) ResultConfiguration {
- Exclude checks
exported function NewResultSet should have comment or be unexported Open
func NewResultSet(o *SDK.ResultSet) ResultSet {
- Exclude checks
exported function NewRowList should have comment or be unexported Open
func NewRowList(list []SDK.Row) []Row {
- Exclude checks
exported type QueryExecutionContext should have comment or be unexported Open
type QueryExecutionContext struct {
- Exclude checks
exported function NewQueryExecutionContext should have comment or be unexported Open
func NewQueryExecutionContext(o *SDK.QueryExecutionContext) QueryExecutionContext {
- Exclude checks
exported method ResultSet.ToListString should have comment or be unexported Open
func (r ResultSet) ToListString() [][]string {
- Exclude checks
exported type ResultConfiguration should have comment or be unexported Open
type ResultConfiguration struct {
- Exclude checks
exported type ResultSet should have comment or be unexported Open
type ResultSet struct {
- Exclude checks
exported function NewColumnInfo should have comment or be unexported Open
func NewColumnInfo(o SDK.ColumnInfo) ColumnInfo {
- Exclude checks
exported method QueryExecutionContext.ToSDK should have comment or be unexported Open
func (v QueryExecutionContext) ToSDK() *SDK.QueryExecutionContext {
- Exclude checks
exported type QueryExecutionStatus should have comment or be unexported Open
type QueryExecutionStatus struct {
- Exclude checks
exported function NewColumnInfoListFromMetadata should have comment or be unexported Open
func NewColumnInfoListFromMetadata(o *SDK.ResultSetMetadata) []ColumnInfo {
- Exclude checks
exported type Datum should have comment or be unexported Open
type Datum struct {
- Exclude checks
exported function NewDatumList should have comment or be unexported Open
func NewDatumList(list []SDK.Datum) []Datum {
- Exclude checks
exported type QueryExecutionStatistics should have comment or be unexported Open
type QueryExecutionStatistics struct {
- Exclude checks
exported function NewColumnInfoList should have comment or be unexported Open
func NewColumnInfoList(list []SDK.ColumnInfo) []ColumnInfo {
- Exclude checks
exported function NewDatum should have comment or be unexported Open
func NewDatum(o SDK.Datum) Datum {
- Exclude checks
exported function NewQueryExecutionStatus should have comment or be unexported Open
func NewQueryExecutionStatus(o *SDK.QueryExecutionStatus) QueryExecutionStatus {
- Exclude checks
exported function NewQueryExecutionStatistics should have comment or be unexported Open
func NewQueryExecutionStatistics(o *SDK.QueryExecutionStatistics) QueryExecutionStatistics {
- Exclude checks
exported method ResultSet.ToMapString should have comment or be unexported Open
func (r ResultSet) ToMapString() []map[string]string {
- Exclude checks