Showing 23 of 23 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
var (
rabbitHost = flag.String("rabbit-host", "127.0.0.1", "RabbitMQ host")
rabbitPort = flag.Int("rabbit-port", 5672, "RabbitMQ port")
rabbitUser = flag.String("rabbit-user", "guest", "RabbitMQ username")
rabbitPassword = flag.String("rabbit-password", "guest", "RabbitMQ password")
- 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 137.
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
var (
rabbitHost = flag.String("rabbit-host", "127.0.0.1", "RabbitMQ host")
rabbitPort = flag.Int("rabbit-port", 5672, "RabbitMQ port")
rabbitUser = flag.String("rabbit-user", "guest", "RabbitMQ username")
rabbitPassword = flag.String("rabbit-password", "guest", "RabbitMQ password")
- 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 137.
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
Function openDB
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func openDB(host string, port int, user string, password string, dbName string) (*pgdb, error) {
Function BuildRabbitMQConnector
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func BuildRabbitMQConnector(host string, port int, user string, password string, exchange string) (*RabbitMQConnector, error) {
Method RabbitMQConnector.open
has 5 return statements (exceeds 4 allowed). Open
func (m *RabbitMQConnector) open() error {
var err error
if m.conn, err = amqp.Dial(m.url); err != nil {
return fmt.Errorf("Dial: %v", err)
}
Your code does not pass gofmt in 2 places. Go fmt your code! Open
package common
- Exclude checks
exported type RabbitMQConnector should have comment or be unexported Open
type RabbitMQConnector struct {
- Exclude checks
exported func OpenMongo returns unexported type *main.mongo, which can be annoying to use Open
func OpenMongo(host string, port int) (*mongo, error) {
- Exclude checks
exported function BuildRabbitMQConnector should have comment or be unexported Open
func BuildRabbitMQConnector(host string, port int, user string, password string, exchange string) (*RabbitMQConnector, error) {
- Exclude checks
exported method RabbitMQConnector.Close should have comment or be unexported Open
func (m *RabbitMQConnector) Close() error {
- Exclude checks
Your code does not pass gofmt in 1 place. Go fmt your code! Open
package main
- Exclude checks
exported function OpenRedis should have comment or be unexported Open
func OpenRedis(host string, port int) (*redisPool, error) {
- Exclude checks
Your code does not pass gofmt in 1 place. Go fmt your code! Open
package main
- Exclude checks
Your code does not pass gofmt in 1 place. Go fmt your code! Open
package common
- Exclude checks
2: cannot find package "github.com/ezeql/koding-challange/common" in any of: Open
"github.com/ezeql/koding-challange/common"
- Exclude checks
exported method RabbitMQConnector.Handle should have comment or be unexported Open
func (m *RabbitMQConnector) Handle(queueName string, f ProcesorFunc) error {
- Exclude checks
exported func OpenRedis returns unexported type *main.redisPool, which can be annoying to use Open
func OpenRedis(host string, port int) (*redisPool, error) {
- Exclude checks
exported type ProcesorFunc should have comment or be unexported Open
type ProcesorFunc func([]byte) bool
- Exclude checks
comment on exported type MetricEntry should be of the form "MetricEntry ..." (with optional leading article) Open
//MetricData
- Exclude checks
exported method RabbitMQConnector.Publish should have comment or be unexported Open
func (m *RabbitMQConnector) Publish(b []byte) error {
- Exclude checks