File countries.go
has 5849 lines of code (exceeds 500 allowed). Consider refactoring. Invalid
// Package countries - ISO 3166 (ISO3166-1, ISO3166, Digit, Alpha-2 and Alpha-3) countries codes and names (on eng and rus), ISO 4217 currency designators, ITU-T E.164 IDD calling phone codes, countries capitals, UN M.49 regions codes, ccTLD countries domains, IOC/NOC and FIFA letters codes, VERY FAST, NO maps[], NO slices[], NO external links/files/data, NO interface{}, NO specific dependencies, Databases compatible, Emoji countries flags and currencies support, full support ISO-3166-1, ISO-4217, ITU-T E.164, Unicode CLDR and ccTLD standarts. Full support ISO-3166-1, ISO-4217, ITU-T E.164, Unicode CLDR and ccTLD standarts.
/*
Package countries - ISO 3166 (ISO3166-1, ISO3166, Digit, Alpha-2 and Alpha-3) countries codes and names (on eng and rus), ISO 4217 currency designators, ITU-T E.164 IDD calling phone codes, countries capitals, UN M.49 regions codes, ccTLD countries domains, IOC/NOC and FIFA letters codes, VERY FAST, NO maps[], NO slices[], NO external links/files/data, NO interface{}, NO specific dependencies, Databases compatible, Emoji countries flags and currencies support, full support ISO-3166-1, ISO-4217, ITU-T E.164, Unicode CLDR and ccTLD standarts.
Full support ISO-3166-1, ISO-4217, ITU-T E.164, Unicode CLDR and ccTLD standarts.
Function ByName
has 537 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func ByName(name string) CountryCode { //nolint:misspell,gocyclo
switch textPrepare(name) {
case "AU", "AUS", "AUSTRALIA", "AVSTRALIA", "AVSTRALIYA", "AUSTRALIYA", "AUSTRALIEN":
return AUS
case "AT", "AUT", "AUSTRIA", "AVSTRIA", "AUSTRIYA", "AVSTRIYA", "ÖSTERREICH", "OESTERREICH":
Method CountryCode.CallCodes
has 532 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) CallCodes() []CallCode { //nolint:gocyclo
switch c {
case AUS:
return []CallCode{CallCode(61)}
case AUT:
Method CountryCode.StringRus
has 531 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) StringRus() string { //nolint:gocyclo
switch c {
case 8:
return "Албания"
case 12:
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:
Method CountryCode.String
has 531 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) String() string { //nolint:gocyclo
switch c {
case 8:
return "Albania"
case 12:
Method CountryCode.Alpha2
has 531 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) Alpha2() string { //nolint:gocyclo
switch c {
case 8:
return "AL"
case 12:
Method CountryCode.Alpha3
has 531 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) Alpha3() string { //nolint:gocyclo
switch c {
case 8:
return "ALB"
case 12:
Method CountryCode.Region
has 512 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) Region() RegionCode { //nolint:gocyclo
switch c {
case AUS:
return RegionOC
case AUT:
Method CountryCode.Capital
has 512 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) Capital() CapitalCode { //nolint:gocyclo
switch c {
case AUS:
return CapitalAU
case AUT:
Method CountryCode.Currency
has 494 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) Currency() CurrencyCode { //nolint:gocyclo
switch c {
case AUS:
return CurrencyAUD
case AUT, AND, MAF:
Function All
has 254 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func All() []CountryCode {
return []CountryCode{
AUS,
AUT,
AZE,
Method CountryCode.IOC
has 183 lines of code (exceeds 50 allowed). Consider refactoring. Invalid
func (c CountryCode) IOC() string { //nolint:gocyclo
switch c {
case DZA:
return `ALG`
case ASM:
Similar blocks of code found in 4 locations. Consider refactoring. Open
func (c CountryCode) FIPS() string {
switch c {
case 8:
return "AL"
case 12:
- 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 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
- 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 4 locations. Consider refactoring. Open
func (c CountryCode) Alpha2() string { //nolint:gocyclo
switch c {
case 8:
return "AL"
case 12:
- 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 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
- 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 4 locations. Consider refactoring. Open
func (c CountryCode) String() string { //nolint:gocyclo
switch c {
case 8:
return "Albania"
case 12:
- 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 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
- 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 4 locations. Consider refactoring. Open
func (c CountryCode) Alpha3() string { //nolint:gocyclo
switch c {
case 8:
return "ALB"
case 12:
- 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 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
- 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 6 locations. Consider refactoring. Invalid
func (country *Country) Scan(src interface{}) error {
if country == nil {
return fmt.Errorf("countries::Scan: Country scan err: country == nil")
}
switch src := src.(type) {
- 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 117.
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
receiver name should not be an underscore, omit the name if it is unused Open
func (_ CountryCode) Type() string {
- Exclude checks
receiver name should not be an underscore, omit the name if it is unused Open
func (_ *Country) Type() string {
- Exclude checks