Similar blocks of code found in 2 locations. Consider refactoring. Open
func UnSettledBatch() (*UnsettledTransactionListResponse, error) {
new := GetUnsettledBatchTransactionListRequest{
GetUnsettledTransactionList: GetUnsettledTransactionList{
MerchantAuthentication: GetAuthentication(),
},
- 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 113.
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 GetMerchantDetails() (*MerchantDetailsResponse, error) {
new := GetMerchantDetailsRequest{
GetMerchantDetailsReq: GetMerchantDetailsReq{
MerchantAuthentication: GetAuthentication(),
},
- 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 113.
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 type BatchListResponse should have comment or be unexported Open
type BatchListResponse struct {
- Exclude checks
exported type FullTransaction should have comment or be unexported Open
type FullTransaction struct {
- Exclude checks
exported type UnsettledTransactionListResponse should have comment or be unexported Open
type UnsettledTransactionListResponse struct {
- Exclude checks
exported type GetMerchantDetailsRequest should have comment or be unexported Open
type GetMerchantDetailsRequest struct {
- Exclude checks
exported type GetSettledBatchList should have comment or be unexported Open
type GetSettledBatchList struct {
- Exclude checks
exported method BatchListResponse.List should have comment or be unexported Open
func (r BatchListResponse) List() []BatchList {
- Exclude checks
exported method UnsettledTransactionListResponse.List should have comment or be unexported Open
func (r UnsettledTransactionListResponse) List() []Transaction {
- Exclude checks
exported method PreviousTransaction.Info should have comment or be unexported Open
func (tranx PreviousTransaction) Info() (*FullTransaction, error) {
- Exclude checks
exported type GetSettledBatchListRequest should have comment or be unexported Open
type GetSettledBatchListRequest struct {
- Exclude checks
exported function GetMerchantDetails should have comment or be unexported Open
func GetMerchantDetails() (*MerchantDetailsResponse, error) {
- Exclude checks
exported type GetBatchStatisticsRequest should have comment or be unexported Open
type GetBatchStatisticsRequest struct {
- Exclude checks
exported method Range.SettledBatch should have comment or be unexported Open
func (r Range) SettledBatch() (*BatchListResponse, error) {
- Exclude checks
exported type GetTransactionList should have comment or be unexported Open
type GetTransactionList struct {
- Exclude checks
exported type GetTransactionListResponse should have comment or be unexported Open
type GetTransactionListResponse struct {
- Exclude checks
exported type GetTransactionDetails should have comment or be unexported Open
type GetTransactionDetails struct {
- Exclude checks
exported type GetUnsettledBatchTransactionListRequest should have comment or be unexported Open
type GetUnsettledBatchTransactionListRequest struct {
- Exclude checks
exported method GetTransactionListResponse.Count should have comment or be unexported Open
func (r *GetTransactionListResponse) Count() int {
- Exclude checks
exported type BatchList should have comment or be unexported Open
type BatchList struct {
- Exclude checks
don't use MixedCaps in package name; AuthorizeCIM should be authorizecim Open
package AuthorizeCIM
- Exclude checks
exported function UnSettledBatch should have comment or be unexported Open
func UnSettledBatch() (*UnsettledTransactionListResponse, error) {
- Exclude checks
exported type GetTransactionDetailsRequest should have comment or be unexported Open
type GetTransactionDetailsRequest struct {
- Exclude checks
exported type BatchStatisticsResponse should have comment or be unexported Open
type BatchStatisticsResponse struct {
- Exclude checks
exported type Range should have comment or be unexported Open
type Range struct {
- Exclude checks
exported method Range.Transactions should have comment or be unexported Open
func (r Range) Transactions() (*GetTransactionListResponse, error) {
- Exclude checks
exported type Transactions should have comment or be unexported Open
type Transactions struct {
- Exclude checks
exported type GetUnsettledTransactionList should have comment or be unexported Open
type GetUnsettledTransactionList struct {
- Exclude checks
exported type MerchantDetailsResponse should have comment or be unexported Open
type MerchantDetailsResponse struct {
- Exclude checks
exported method GetTransactionListResponse.List should have comment or be unexported Open
func (r *GetTransactionListResponse) List() []Transaction {
- Exclude checks
exported type Transaction should have comment or be unexported Open
type Transaction struct {
- Exclude checks
exported type TransactionDetailsResponse should have comment or be unexported Open
type TransactionDetailsResponse struct {
- Exclude checks
exported type GetTransactionListRequest should have comment or be unexported Open
type GetTransactionListRequest struct {
- Exclude checks
struct field BatchId should be BatchID Open
BatchId string `"omitempty"`
- Exclude checks
exported method Range.Statistics should have comment or be unexported Open
func (r Range) Statistics() (*Statistics, error) {
- Exclude checks
exported type GetBatchStatistics should have comment or be unexported Open
type GetBatchStatistics struct {
- Exclude checks
exported type Statistics should have comment or be unexported Open
type Statistics struct {
- Exclude checks
exported type GetMerchantDetailsReq should have comment or be unexported Open
type GetMerchantDetailsReq struct {
- Exclude checks