pedroMMM/goss

View on GitHub
system/dns.go

Summary

Maintainability
C
1 day
Test Coverage

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func LookupA(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
    m.SetQuestion(dns.Fqdn(host), dns.TypeA)
    r, _, err := c.Exchange(m, parseServerString(server))
    if err != nil {
        return nil, err
Severity: Major
Found in system/dns.go and 1 other location - About 1 hr to fix
system/dns.go on lines 202..216

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 178.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func LookupAAAA(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
    m.SetQuestion(dns.Fqdn(host), dns.TypeAAAA)
    r, _, err := c.Exchange(m, parseServerString(server))
    if err != nil {
        return nil, err
Severity: Major
Found in system/dns.go and 1 other location - About 1 hr to fix
system/dns.go on lines 175..189

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 178.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func LookupCNAME(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
    m.SetQuestion(dns.Fqdn(host), dns.TypeCNAME)
    r, _, err := c.Exchange(m, parseServerString(server))
    if err != nil {
        return nil, err
Severity: Major
Found in system/dns.go and 2 other locations - About 1 hr to fix
system/dns.go on lines 254..268
system/dns.go on lines 292..306

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 172.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func LookupTXT(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
    m.SetQuestion(dns.Fqdn(host), dns.TypeTXT)
    r, _, err := c.Exchange(m, parseServerString(server))
    if err != nil {
        return nil, err
Severity: Major
Found in system/dns.go and 2 other locations - About 1 hr to fix
system/dns.go on lines 219..233
system/dns.go on lines 254..268

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 172.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

func LookupNS(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error) {
    m.SetQuestion(dns.Fqdn(host), dns.TypeNS)
    r, _, err := c.Exchange(m, parseServerString(server))
    if err != nil {
        return nil, err
Severity: Major
Found in system/dns.go and 2 other locations - About 1 hr to fix
system/dns.go on lines 219..233
system/dns.go on lines 292..306

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 172.

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

Further Reading

exported function DNSlookup should have comment or be unexported
Open

func DNSlookup(host string, server string, qtype string, timeout int) ([]string, error) {
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupSRV should be of the form "LookupSRV ..."
Open

// SRV record lookup
Severity: Minor
Found in system/dns.go by golint

exported type DefDNS should have comment or be unexported
Open

type DefDNS struct {
Severity: Minor
Found in system/dns.go by golint

comment on exported method DefDNS.Exists should be of the form "Exists ..."
Open

// Stub out
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupCNAME should be of the form "LookupCNAME ..."
Open

// CNAME record lookup
Severity: Minor
Found in system/dns.go by golint

exported method DefDNS.Resolvable should have comment or be unexported
Open

func (d *DefDNS) Resolvable() (bool, error) {
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupMX should be of the form "LookupMX ..."
Open

// MX record lookup
Severity: Minor
Found in system/dns.go by golint

exported function NewDefDNS should have comment or be unexported
Open

func NewDefDNS(host string, system *System, config util.Config) DNS {
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupHost should be of the form "LookupHost ..."
Open

// A and AAAA record lookup - similar to net.LookupHost
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupTXT should be of the form "LookupTXT ..."
Open

// TXT record lookup
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupPTR should be of the form "LookupPTR ..."
Open

// PTR record lookup
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupCAA should be of the form "LookupCAA ..."
Open

// CAA record lookup
Severity: Minor
Found in system/dns.go by golint

exported method DefDNS.Server should have comment or be unexported
Open

func (d *DefDNS) Server() string {
Severity: Minor
Found in system/dns.go by golint

exported method DefDNS.Qtype should have comment or be unexported
Open

func (d *DefDNS) Qtype() string {
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupNS should be of the form "LookupNS ..."
Open

// NS record lookup
Severity: Minor
Found in system/dns.go by golint

exported type DNS should have comment or be unexported
Open

type DNS interface {
Severity: Minor
Found in system/dns.go by golint

exported method DefDNS.Addrs should have comment or be unexported
Open

func (d *DefDNS) Addrs() ([]string, error) {
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupA should be of the form "LookupA ..."
Open

// A record lookup
Severity: Minor
Found in system/dns.go by golint

comment on exported function LookupAAAA should be of the form "LookupAAAA ..."
Open

// AAAA (IPv6) record lookup
Severity: Minor
Found in system/dns.go by golint

exported method DefDNS.Host should have comment or be unexported
Open

func (d *DefDNS) Host() string {
Severity: Minor
Found in system/dns.go by golint

There are no issues that match your filters.

Category
Status