Skip to content

magic number smell: Inappropriate default threshold #27

@testmigrator

Description

@testmigrator

The default threshold is set to 0.
Assuming a refactoring has already eliminated the magic number, re-testing should not detect this smell.
However, because magicCount = 0 >= 0 (default threshold), the following code will still detect a magic number:

  override val magicNumberTest: Int
        get() = 0
 testMethod.setSmell(false); //default value is false (i.e. no smell)
 super.visit(n, arg);
 testMethod.setSmell(magicCount >= thresholds.getMagicNumberTest());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions