jemmons/MyNameIsURL

View on GitHub

Showing 22 of 28 total issues

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

import Foundation


/**
 Type that matchies a `URL` based on evaluation of its wrapped `URLMatchable`s, logically OR’d together.
Severity: Major
Found in Sources/MyNameIsURL/Matchers/Or.swift and 1 other location - About 1 hr to fix
Sources/MyNameIsURL/Matchers/And.swift on lines 1..51

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

Further Reading

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

  public enum Size: LocalizedError {
    /// Error received when a given string domains too many characters to be used as a domain name.
    case tooLong(String)
    
    public var errorDescription: String? {
Severity: Minor
Found in Sources/MyNameIsURL/Types/Domain.swift and 1 other location - About 45 mins to fix
Sources/MyNameIsURL/Types/Domain.swift on lines 12..22

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

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

  public enum Format: LocalizedError {
    /// Error received when a given string contains characters which are disallowed in a domain name.
    case invalid(String)
    
    public var errorDescription: String? {
Severity: Minor
Found in Sources/MyNameIsURL/Types/Domain.swift and 1 other location - About 45 mins to fix
Sources/MyNameIsURL/Types/Domain.swift on lines 26..36

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

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

Force tries should be avoided.
Open

  public static let ftp = try! Scheme("ftp")

Operators should be surrounded by a single whitespace when defining them.
Open

public func ~=(pattern: URLMatchable, value: URL) -> Bool {

Prefer checking isEmpty over comparing string to an empty string literal.
Open

      return url.path == ""

Three lines between top-level items.
Open

import Foundation

Three lines between top-level items.
Open

// swift-tools-version:4.0
Severity: Minor
Found in Package.swift by swiftlint

Force tries should be avoided.
Open

  public static let http = try! Scheme("http")

Force tries should be avoided.
Open

  public static let file = try! Scheme("file")

Files should have a single trailing newline.
Open

Force tries should be avoided.
Open

  public static let sms = try! Scheme("sms")

Force tries should be avoided.
Open

  public static let mailto = try! Scheme("mailto")

Three lines between top-level items.
Open

import Foundation

Force tries should be avoided.
Open

  public static let webcal = try! Scheme("webcal")

Force tries should be avoided.
Open

  public static let telprompt = try! Scheme("telprompt")

Three lines between top-level items.
Open

import PackageDescription
Severity: Minor
Found in Package.swift by swiftlint

Top-level declarations should specify Access Control Level keywords explicitly.
Open

let package = Package(
Severity: Minor
Found in Package.swift by swiftlint

Force tries should be avoided.
Open

  public static let tel = try! Scheme("tel")

There must be two or zero lines between second-level items.
Open

  private static let validCharacters: Set<Character> = validFirstCharacters.union(["+", "-", ".", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"])
Severity
Category
Status
Source
Language