ephread/Instructions

View on GitHub

Showing 63 of 63 total issues

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

// Copyright (c) 2015-present Frédéric Maquin <fred@ephread.com> and contributors.
// Licensed under the terms of the MIT License.

import UIKit

Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 15..19

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

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

    func didShow(coachMark: CoachMark, afterSizeTransition: Bool, at index: Int) {
        delegate?.coachMarksController(self, didShow: coachMark,
                                       afterSizeTransition: afterSizeTransition, at: index)
    }
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 57..60
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 84..91
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 93..100
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 102..108

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

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

    func didShow(coachMark: CoachMark, afterChanging change: ConfigurationChange, at index: Int) {
        delegate?.coachMarksController(self, didShow: coachMark,
                                       afterChanging: change, at: index)
    }
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 46..49
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 84..91
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 93..100
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 102..108

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

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

    func fetchIdleAnimationOfCoachMark(OfCoachMark coachMarkView: UIView,
                                       at index: Int,
                                       using manager: CoachMarkAnimationManager) {
        animationDelegate?.coachMarksController(self,
                                                fetchIdleAnimationOfCoachMark: coachMarkView,
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 46..49
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 57..60
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 84..91
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 93..100

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

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

    func fetchAppearanceTransition(OfCoachMark coachMarkView: UIView,
                                   at index: Int,
                                   using manager: CoachMarkTransitionManager) {
        animationDelegate?.coachMarksController(
            self, fetchAppearanceTransitionOfCoachMark: coachMarkView,
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 46..49
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 57..60
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 93..100
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 102..108

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

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

    func fetchDisappearanceTransition(OfCoachMark coachMarkView: UIView,
                                      at index: Int,
                                      using manager: CoachMarkTransitionManager) {
        animationDelegate?.coachMarksController(
            self, fetchDisappearanceTransitionOfCoachMark: coachMarkView,
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 46..49
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 57..60
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 84..91
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 102..108

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    func willShow(coachMark: inout CoachMark, afterSizeTransition: Bool, at index: Int) {
        delegate?.coachMarksController(self, willShow: &coachMark,
                                       afterSizeTransition: afterSizeTransition, at: index)
    }
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 51..55

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    func willShow(coachMark: inout CoachMark, beforeChanging change: ConfigurationChange,
                  at index: Int) {
        delegate?.coachMarksController(self, willShow: &coachMark,
                                       beforeChanging: change, at: index)
    }
Sources/Instructions/Core/Public/Extensions/CoachMarksController+Proxy.swift on lines 41..44

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

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 constraints has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        for coachMarkView: CoachMarkView,
        coachMark: CoachMark,
        parentView: UIView,
        layoutDirection: UIUserInterfaceLayoutDirection? = nil,
        passNumber: Int = 0
Severity: Minor
Found in Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.swift - About 35 mins to fix

    Function showNew has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        func showNew(coachMarkView: CoachMarkView, from coachMark: CoachMark,
                     at index: Int, animated: Bool = true, completion: (() -> Void)? = nil) {
    Severity: Minor
    Found in Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift - About 35 mins to fix

      Function update has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              coachMark: inout CoachMark,
              usingFrame frame: CGRect? = nil,
              pointOfInterest: CGPoint?,
              superview: UIView? = nil,
              cutoutPathMaker: CutoutPathMaker? = nil
      Severity: Minor
      Found in Sources/Instructions/Helpers/Public/CoachMarkHelper.swift - About 35 mins to fix

        Function makeDefaultCoachViews has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                withArrow arrow: Bool = true,
                arrowOrientation: CoachMarkArrowOrientation? = .top,
                hintText: String,
                nextText: String? = nil,
                nextLabelPosition: CoachMarkNextLabelPosition = .trailing
        Severity: Minor
        Found in Sources/Instructions/Helpers/Public/CoachMarkHelper.swift - About 35 mins to fix

          Function hide has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              func hide(coachMark: CoachMark, at index: Int, animated: Bool = true,
                        beforeTransition: Bool = false, completion: (() -> Void)? = nil) {
          Severity: Minor
          Found in Sources/Instructions/Core/Internal/CoachMarksViewController.swift - About 35 mins to fix

            Function generateAndEnableVerticalConstraints has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private func generateAndEnableVerticalConstraints(of coachMarkView: CoachMarkView,
                                                                  forDisplayIn parentView: UIView,
                                                                  usingCoachMark coachMark: CoachMark,
                                                                  cutoutPath: UIBezierPath,
                                                                  andOverlayView overlayView: OverlayView) {
            Severity: Minor
            Found in Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift - About 35 mins to fix

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

                  private func computeHorizontalAlignment(
                      of coachMark: CoachMark,
                      forLayoutDirection layoutDirection: UIUserInterfaceLayoutDirection,
                      inFrame frame: CGRect
                  ) -> CoachMarkHorizontalAlignment {
              Severity: Minor
              Found in Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.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

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

                  override var shouldAutorotate: Bool {
                      switch rotationStyle {
                      case .systemDefined: return super.shouldAutorotate
                      case .automatic: return true
                      case .manual: return false
              Sources/Instructions/Core/Internal/CoachMarksViewController.swift on lines 86..92

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

              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

                  override var prefersStatusBarHidden: Bool {
                      switch statusBarVisibility {
                      case .systemDefined: return super.prefersStatusBarHidden
                      case .hidden: return true
                      case .visible: return false
              Sources/Instructions/Core/Internal/CoachMarksViewController.swift on lines 78..84

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

              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

              Avoid too many return statements within this function.
              Open

                      return hitView
              Severity: Major
              Found in Sources/Instructions/Views/OverlayView.swift - About 30 mins to fix

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

                // Copyright (c) 2017-present Frédéric Maquin <fred@ephread.com> and contributors.
                // Licensed under the terms of the MIT License.
                
                import UIKit
                
                
                Sources/Instructions/Managers/Internal/OverlayStyleManager/OverlayStyleManager.swift on lines 1..47

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

                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

                Avoid too many return statements within this function.
                Open

                                return hitView
                Severity: Major
                Found in Sources/Instructions/Views/OverlayView.swift - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language