bpicode/fritzctl

View on GitHub

Showing 51 of 51 total issues

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

func TestRegisterLoglevelInvalid(t *testing.T) {
    f := flag.NewFlagSet("TestFlagSet", flag.ContinueOnError)
    ll := Level{}
    f.Var(&ll, "loglevel", "logging verbosity specified as "+ll.Type())
    err := f.Parse([]string{"--loglevel=whistleblower"})
Severity: Minor
Found in logger/flags_test.go and 1 other location - About 35 mins to fix
logger/flags_test.go on lines 11..17

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

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

Method cliConfigurer.Obtain has 5 return statements (exceeds 4 allowed).
Open

func (iCLI *cliConfigurer) Obtain(r io.Reader) (ExtendedConfig, error) {
    f := ""
    c := Config{}
    err := proceedUntilFirstError(
        func() (err error) {
Severity: Major
Found in config/configurer.go - About 35 mins to fix

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

    func (i *internal) ListLogs() (*MessageLog, error) {
        url := i.
            query().
            query("mq_log", "logger:status/log").
            build()
    Severity: Minor
    Found in fritz/api_internal.go and 2 other locations - About 35 mins to fix
    fritz/ain_based.go on lines 29..36
    fritz/api_internal.go on lines 37..45

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

    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 (i *internal) ListLanDevices() (*LanDevices, error) {
        url := i.
            query().
            query("network", "landevice:settings/landevice/list(name,ip,mac,UID,dhcp,wlan,ethernet,active,wakeup,deleteable,source,online,speed,guest,url)").
            build()
    Severity: Minor
    Found in fritz/api_internal.go and 2 other locations - About 35 mins to fix
    fritz/ain_based.go on lines 29..36
    fritz/api_internal.go on lines 26..34

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

    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 (a *ainBasedClient) listDevices() (*Devicelist, error) {
        url := a.homeAutoSwitch().
            query("switchcmd", "getdevicelistinfos").
            build()
        var deviceList Devicelist
    Severity: Minor
    Found in fritz/ain_based.go and 2 other locations - About 35 mins to fix
    fritz/api_internal.go on lines 26..34
    fritz/api_internal.go on lines 37..45

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

    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 TestVersion(t *testing.T) {
        osArgsBefore := os.Args
        exit = func(code int) {}
        defer func() {
            os.Args = osArgsBefore
    Severity: Minor
    Found in main_test.go and 1 other location - About 35 mins to fix
    main_test.go on lines 22..32

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

    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 TestHelp(t *testing.T) {
        osArgsBefore := os.Args
        exit = func(code int) {}
        defer func() {
            os.Args = osArgsBefore
    Severity: Minor
    Found in main_test.go and 1 other location - About 35 mins to fix
    main_test.go on lines 35..44

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

    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 TestCommandsHaveHelp(t *testing.T) {
        for _, c := range allCommands(RootCmd) {
            t.Run(fmt.Sprintf("test long description of command %s", c.Name()), func(t *testing.T) {
                assert.NotEmpty(t, c.Long)
            })
    Severity: Minor
    Found in cmd/commands_test.go and 1 other location - About 35 mins to fix
    cmd/commands_test.go on lines 93..99

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

    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 TestCommandsHaveSynopsis(t *testing.T) {
        for _, c := range allCommands(RootCmd) {
            t.Run(fmt.Sprintf("test short description of command %s", c.Name()), func(t *testing.T) {
                assert.NotEmpty(t, c.Short)
            })
    Severity: Minor
    Found in cmd/commands_test.go and 1 other location - About 35 mins to fix
    cmd/commands_test.go on lines 74..80

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

    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

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    package main
    Severity: Minor
    Found in main_test.go by gofmt

    2: cannot find package "github.com/bpicode/fritzctl/config" in any of:
    Open

        "github.com/bpicode/fritzctl/config"
    Severity: Minor
    Found in cmd/about.go by govet
    Severity
    Category
    Status
    Source
    Language