biter777/countries

View on GitHub

Showing 24 of 60 total issues

File subdivisionsconst.go has 4890 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Package countries supports subdivisions as per ISO 3166-2.
//
// Data has been sourced from <https://www.ip2location.com/free/iso3166-2>. See
// license for further information.
package countries
Severity: Major
Found in subdivisionsconst.go - About 1 wk to fix

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

    func (c CountryCode) FIPS() string {
        switch c {
        case 8:
            return "AL"
        case 12:
    Severity: Major
    Found in countries.go and 3 other locations - About 3 days to fix
    countries.go on lines 162..694
    countries.go on lines 1773..2305
    countries.go on lines 2310..2842

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

    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 4 locations. Consider refactoring.
    Open

    func (c CountryCode) Alpha2() string { //nolint:gocyclo
        switch c {
        case 8:
            return "AL"
        case 12:
    Severity: Major
    Found in countries.go and 3 other locations - About 3 days to fix
    countries.go on lines 162..694
    countries.go on lines 1236..1768
    countries.go on lines 2310..2842

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

    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 4 locations. Consider refactoring.
    Open

    func (c CountryCode) String() string { //nolint:gocyclo
        switch c {
        case 8:
            return "Albania"
        case 12:
    Severity: Major
    Found in countries.go and 3 other locations - About 3 days to fix
    countries.go on lines 1236..1768
    countries.go on lines 1773..2305
    countries.go on lines 2310..2842

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

    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 4 locations. Consider refactoring.
    Open

    func (c CountryCode) Alpha3() string { //nolint:gocyclo
        switch c {
        case 8:
            return "ALB"
        case 12:
    Severity: Major
    Found in countries.go and 3 other locations - About 3 days to fix
    countries.go on lines 162..694
    countries.go on lines 1236..1768
    countries.go on lines 1773..2305

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

    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 CountryCode.FIPS has 531 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (c CountryCode) FIPS() string {
        switch c {
        case 8:
            return "AL"
        case 12:
    Severity: Major
    Found in countries.go - About 2 days to fix

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

      func (c CurrencyCode) String() string { //nolint:gocyclo
          switch c {
          case 840:
              return "US Dollar"
          case 978:
      Severity: Major
      Found in currencies.go and 1 other location - About 2 days to fix
      currencies.go on lines 398..742

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

      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 (c CurrencyCode) Alpha() string { //nolint:gocyclo
          switch c {
          case 840:
              return "USD"
          case 978:
      Severity: Major
      Found in currencies.go and 1 other location - About 2 days to fix
      currencies.go on lines 49..393

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

      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 3 places. Go fmt your code!
      Open

      package countries
      Severity: Minor
      Found in capitals.go by gofmt

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ CountryCode) Type() string {
      Severity: Minor
      Found in countries.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ Subdivision) Type() string {
      Severity: Minor
      Found in subdivisions.go by golint

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

      package countries
      Severity: Minor
      Found in callcodes.go by gofmt

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ RegionCode) Type() string {
      Severity: Minor
      Found in regions.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ *CallCodeInfo) Type() string {
      Severity: Minor
      Found in callcodes.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ Domain) Type() string {
      Severity: Minor
      Found in domains.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ CallCode) Type() string {
      Severity: Minor
      Found in callcodes.go by golint

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

      package countries
      Severity: Minor
      Found in value.go by gofmt

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ DomainCode) Type() string {
      Severity: Minor
      Found in domains.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ Capital) Type() string {
      Severity: Minor
      Found in capitals.go by golint

      receiver name should not be an underscore, omit the name if it is unused
      Open

      func (_ *Country) Type() string {
      Severity: Minor
      Found in countries.go by golint
      Severity
      Category
      Status
      Source
      Language