JohnCoates/Aerial

View on GitHub
Aerial/Source/Views/Layers/Weather/ForecastLayer.swift

Summary

Maintainability
F
4 days
Test Coverage

File ForecastLayer.swift has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import AVKit

// swiftlint:disable:next type_body_length
class ForecastLayer: CALayer {
Severity: Minor
Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 5 hrs to fix

    Function makeDayBlock has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        func makeDayBlock(slice: ArraySlice<FList>, size: Double) -> CALayer {
            // This is ugly but we try and do the  best from the data we get...
            var tmin, tmax: Double?
            var day: Int?
    
    
    Severity: Major
    Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 3 hrs to fix

      Function makeHourBlock has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func makeHourBlock(hour: FList, size: Double) -> CALayer {
              let mainLayer = CALayer()
      
              let isNight = hour.sys!.pod! == "n" ? true : false
      
      
      Severity: Major
      Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 2 hrs to fix

        Function makeLegendBlock has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func makeLegendBlock(size: Double) -> CALayer {
                let mainLayer = CALayer()
        
                // Make a vertically centered layer for t°
                let windLayer = CAVCTextLayer()
        Severity: Major
        Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 2 hrs to fix

          Function makeDayBlock has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              func makeDayBlock(slice: ArraySlice<FList>, size: Double) -> CALayer {
                  // This is ugly but we try and do the  best from the data we get...
                  var tmin, tmax: Double?
                  var day: Int?
          
          
          Severity: Minor
          Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function makeLegendBlock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              func makeLegendBlock(size: Double) -> CALayer {
                  let mainLayer = CALayer()
          
                  // Make a vertically centered layer for t°
                  let windLayer = CAVCTextLayer()
          Severity: Minor
          Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid deeply nested control flow statements.
          Open

                                  if day.frame.height > height {
                                      height = day.frame.height
                                  }
          Severity: Major
          Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if dayidx == 0 {
                                        day = makeDayBlock(slice: flist[0..<breakIndex], size: size*2)
            
                                    } else {
                                        day = makeDayBlock(slice: flist[start..<(start+8)], size: size*2)
            Severity: Major
            Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if day.frame.height > height {
                                          height = day.frame.height
                                      }
              Severity: Major
              Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 45 mins to fix

                Function detectDayChange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    func detectDayChange(list: [FList]) -> Int {
                        var firstDay: String?
                        var index = 0
                        for day in list {
                            if firstDay == nil {
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect4 = dayi.calculateRect(string: dayi.string as! String, font: dayi.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = max.calculateRect(string: max.string as! String, font: max.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = max.calculateRect(string: max.string as! String, font: max.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = min.calculateRect(string: min.string as! String, font: min.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect3 = min.calculateRect(string: min.string as! String, font: min.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = min.calculateRect(string: min.string as! String, font: min.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = windLayer.calculateRect(string: windLayer.string as! String, font: windLayer.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = feelsLike.calculateRect(string: feelsLike.string as! String, font: feelsLike.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = wind.calculateRect(string: wind.string as! String, font: wind.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = temp.calculateRect(string: temp.string as! String, font: temp.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = temp.calculateRect(string: temp.string as! String, font: temp.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect3 = min.calculateRect(string: min.string as! String, font: min.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect4 = dayi.calculateRect(string: dayi.string as! String, font: dayi.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let recth = humidity.calculateRect(string: humidity.string as! String, font: humidity.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = wind.calculateRect(string: wind.string as! String, font: wind.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = max.calculateRect(string: max.string as! String, font: max.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = feelsLike.calculateRect(string: feelsLike.string as! String, font: feelsLike.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect = max.calculateRect(string: max.string as! String, font: max.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect4 = dayi.calculateRect(string: dayi.string as! String, font: dayi.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect4 = dayi.calculateRect(string: dayi.string as! String, font: dayi.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

                Force casts should be avoided
                Open

                        let rect2 = windLayer.calculateRect(string: windLayer.string as! String, font: windLayer.font as! NSFont)

                forced-type-cast

                Avoid using the forced form of the type cast operator (as!) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?) is safer and should be used when possible.

                Preferred

                if let movie = item as? Movie {
                    print("Movie: '\(movie.name)', dir. \(movie.director)")
                }

                Not Preferred

                let movie = item as! Movie
                print("Movie: '\(movie.name)', dir. \(movie.director)")

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

                        if PrefsInfo.weather.showHumidity {
                            humidity.anchorPoint = CGPoint(x: 0.5, y: 0)
                            humidity.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(humidity)
                            offset += humidity.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 224..229
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 323..328
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 330..335
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 427..432
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 434..439

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

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

                        if PrefsInfo.weather.showHumidity {
                            humidity.anchorPoint = CGPoint(x: 0.5, y: 0)
                            humidity.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(humidity)
                            offset += humidity.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 224..229
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 231..236
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 323..328
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 427..432
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 434..439

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

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

                        if PrefsInfo.weather.showWind {
                            windLayer.anchorPoint = CGPoint(x: 0.5, y: 0)
                            windLayer.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(windLayer)
                            offset += windLayer.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 224..229
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 231..236
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 323..328
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 330..335
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 434..439

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

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

                        if PrefsInfo.weather.showHumidity {
                            humidity.anchorPoint = CGPoint(x: 0.5, y: 0)
                            humidity.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(humidity)
                            offset += humidity.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 224..229
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 231..236
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 323..328
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 330..335
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 427..432

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

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

                        if PrefsInfo.weather.showWind {
                            windLayer.anchorPoint = CGPoint(x: 0.5, y: 0)
                            windLayer.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(windLayer)
                            offset += windLayer.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 231..236
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 323..328
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 330..335
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 427..432
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 434..439

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

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

                        if PrefsInfo.weather.showWind {
                            windLayer.anchorPoint = CGPoint(x: 0.5, y: 0)
                            windLayer.position = CGPoint(x: CGFloat(size)/2, y: offset)
                            mainLayer.addSublayer(windLayer)
                            offset += windLayer.frame.height
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 5 other locations - About 1 hr to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 224..229
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 231..236
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 330..335
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 427..432
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 434..439

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

                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

                            if tmax == nil {
                                tmax = element.main!.tempMax
                            } else {
                                if element.main!.tempMax! > tmax! {
                                    tmax = element.main!.tempMax
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 1 other location - About 50 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 139..145

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

                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

                            if tmin == nil {
                                tmin = element.main!.tempMin
                            } else {
                                if element.main!.tempMin! < tmin! {
                                    tmin = element.main!.tempMin
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 1 other location - About 50 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 147..153

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

                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

                        if PrefsInfo.weather.degree == .celsius {
                            if PrefsInfo.weatherWindMode == .kph {
                                windLayer.string = "km/h"
                            } else {
                                windLayer.string = "m/s"
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 1 other location - About 45 mins to fix
                Aerial/Source/Views/Layers/Weather/ConditionLayer.swift on lines 260..268

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

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

                        min.string = "\(String(format: "%.0f", tmin!))°"
                
                        (min.font, min.fontSize) = min.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

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

                        temp.string = "\(String(format: "%.0f", hour.main!.temp!))°"
                
                        (temp.font, temp.fontSize) = temp.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

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

                        humidity.string = "\(hour.main!.humidity!)%"
                
                        (humidity.font, humidity.fontSize) = humidity.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

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

                        max.string = "\(String(format: "%.0f", tmax!))°"
                
                        (max.font, max.fontSize) = max.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

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

                        humidity.string = "\(whumidity!)%"
                
                        (humidity.font, humidity.fontSize) = humidity.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

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

                        humidity.string = "Humidity"
                        (humidity.font, humidity.fontSize) = humidity.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 285..287
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298

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

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

                        feelsLike.string = "\(String(format: "%.0f", hour.main!.feelsLike!))°"
                
                        (feelsLike.font, feelsLike.fontSize) = feelsLike.makeFont(name: PrefsInfo.weather.fontName, size: size/4)
                Severity: Major
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 6 other locations - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 175..177
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 186..188
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 197..199
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 274..276
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 296..298
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 415..416

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

                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

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

                        imglayer.position = CGPoint(x: Double(size) / 2,
                                                    y: Double(offset) + size/2)
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 1 other location - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 348..349

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

                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

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

                        imglayer.position = CGPoint(x: Double(size) / 2,
                                                    y: Double(offset) + size/2)
                Severity: Minor
                Found in Aerial/Source/Views/Layers/Weather/ForecastLayer.swift and 1 other location - About 35 mins to fix
                Aerial/Source/Views/Layers/Weather/ForecastLayer.swift on lines 249..250

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

                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

                Function should have at least one blank line after it
                Open

                    }

                function-whitespace

                Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

                Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                
                function1()
                
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                
                }
                
                func function5() {
                  // something goes here
                }

                Not Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                function1()
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                }
                func function5() {
                  // something goes here
                }

                Function should have at least one blank line after it
                Open

                    }

                function-whitespace

                Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

                Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                
                function1()
                
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                
                }
                
                func function5() {
                  // something goes here
                }

                Not Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                function1()
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                }
                func function5() {
                  // something goes here
                }

                Line should not have any trailing whitespace
                Open

                        

                trailing-whitespace

                Flag whitespace after the last non-whitespace character on each line until the newline.

                Preferred

                let number = 42¬

                Not Preferred

                let number = 42••¬

                Function should have at least one blank line before it
                Open

                    func roundTemp() -> Double {

                function-whitespace

                Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

                Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                
                function1()
                
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                
                }
                
                func function5() {
                  // something goes here
                }

                Not Preferred

                func function1() {
                  var text = 1
                  var text = 2
                }
                function1()
                // a comment
                func function2() {
                  // something goes here
                }
                
                struct SomeStruct {
                  func function3() {
                    // something goes here
                  }
                
                  func function4() {
                    // something else goes here
                  };
                }
                func function5() {
                  // something goes here
                }

                There are no issues that match your filters.

                Category
                Status