pantuspavel/PPEventRegistryAPI

View on GitHub

Showing 63 of 63 total issues

Function spec has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    override func spec() {

        var api = PPEventRegistryAPI()

        beforeEach {

    Function spec has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        override func spec() {
    
            describe("HttpMethod") {
    
                it ("Get case is in place") {

      Function spec has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          override func spec() {
      
              describe("HttpMethod") {
      
                  it ("Get case is in place") {

      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 spec has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          override func spec() {
              describe("Initialization") {
      
                  var modelMapper = PPModelMapper()
      
      

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

        import UIKit
        import PPEventRegistryAPI
        
        class ViewController: UIViewController {
            
        Severity: Major
        Found in Example/PPEventRegistryTest/ViewController.swift and 1 other location - About 3 hrs to fix
        Example/PPEventRegistryTest tvOS/ViewController.swift on lines 9..46

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

        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

        import UIKit
        import PPEventRegistryAPI
        
        class ViewController: UIViewController {
        
        
        Severity: Major
        Found in Example/PPEventRegistryTest tvOS/ViewController.swift and 1 other location - About 3 hrs to fix
        Example/PPEventRegistryTest/ViewController.swift on lines 9..46

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

        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 spec has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            override func spec() {
        
                describe("Initialization") {
        
                    it("init with value creates success") {

          Function spec has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override func spec() {
          
                  let params: [String: Any] = ["key1": "arg1", "key2": "arg2"]
                  var asyncOperation = PPAsyncOperation(controller: .Login,
                                                        method: .Get,

            Function spec has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override func spec() {
            
                    var getRecentArticles = PPRecentArticlesOperation {_ in}
            
                    beforeEach {

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

              import UIKit
              
              @UIApplicationMain
              class AppDelegate: UIResponder, UIApplicationDelegate {
              
              
              Severity: Major
              Found in Example/PPEventRegistryTest tvOS/AppDelegate.swift and 1 other location - About 2 hrs to fix
              Example/PPEventRegistryTest/AppDelegate.swift on lines 9..45

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

              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

              import UIKit
              
              @UIApplicationMain
              class AppDelegate: UIResponder, UIApplicationDelegate {
              
              
              Severity: Major
              Found in Example/PPEventRegistryTest/AppDelegate.swift and 1 other location - About 2 hrs to fix
              Example/PPEventRegistryTest tvOS/AppDelegate.swift on lines 9..45

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

              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 fixture1 has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static func fixture1() -> [String: Any] {
                      return [
                          "info" : [
                              "summary" : [
                                  "eng" : "All Exxon Mobil Corp. had to do is run its Los Angeles-area refinery for 15 days before handing the keys to new owner PBF Energy.\n\nThat's turning into a struggle. More than a month after Exxon Mobil restarted a key gasoline-making unit that was damaged in a blast last year, PBF still hasn't taken control of the Torrance plant. In the latest snag, a crane fell over Monday. While Exxon says it had no effect on production and the handover to PBF is still scheduled for mid year, the incident highligh"

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

                        it("configured with correct parameters") {
                            // TODO: reconsider once Quick supports dictionaries comparison
                //            expect(loginOperation.parameters).to(equal(["email": "email@email.com",
                //                                                        "pass": "qwerty"]))
                            let params = loginOperation.parameters as! [String: String]
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/API/Operations/PPAsyncOperationSpec.swift on lines 53..60

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

                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

                        it("correct parameters set") {
                            // TODO: reconsider once Quick supports dictionaries comparison
                //            expect(asyncOperation.parameters).to(equal(["key1": "arg1", "key2": "arg2"] as [String: Any]))
                            let params = asyncOperation.parameters as! [String: String]
                            expect(params).to(haveCount(2))
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/API/Operations/PPLoginOperationSpec.swift on lines 42..50

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

                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

                    static func fixture2() -> [String: Any] {
                        return [
                            "id" : "127827495",
                            "body" : "Tezpur: Tezpur University has received the 'A' grade and a CGPA of 3.25 from the National Assessment and Accreditation Council (NAAC) at the end of a week-long assessment conducted during May 16 to 19 last, said an official of the central university.\n\nThe 10-member assessment team was led by ...",
                            "sim" : 0,
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/API/Models/PPArticle+Fixture.swift on lines 82..101

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

                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

                    static func fixture3() -> [String: Any] {
                        return [
                            "id" : "127827492",
                            "body" : "Foreign portfolio investors' (FPIs) net investment in debt instruments in July has crossed the $1 billion mark, with FPIs having net bought instruments worth $1.03 billion since the beginning of the month.\n\nForeign portfolio investors' (FPIs) net investment in debt instruments in July has crossed ...",
                            "sim" : 0,
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/API/Models/PPArticle+Fixture.swift on lines 61..80

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

                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

                        it("Login returns a missing data error in case of an empty input") {
                            PPLoginOperation.stubUserMissingData()
                
                            waitUntil { done in
                                api.login("", password: "") { error in
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/PPEventRegistryAPISpec.swift on lines 43..53

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

                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

                        it("Login returns an unknown user error in case of failure") {
                            PPLoginOperation.stubUserNotFound()
                
                            waitUntil { done in
                                api.login("email@email.com", password: "password") { error in
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/PPEventRegistryAPISpec.swift on lines 55..65

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

                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

                        it("Recent Articles return empty array in case of no new articles") {
                            PPRecentArticlesOperation.stubNoArticlesFound()
                
                            waitUntil { done in
                                api.getRecentArticles(count: 10) { result in
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/PPEventRegistryAPISpec.swift on lines 124..134

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

                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

                        it("Recent Articles return new articles in case of available") {
                            PPRecentArticlesOperation.stubSuccess()
                
                            waitUntil { done in
                                api.getRecentArticles(count: 3) { result in
                PPEventRegistryAPI/PPEventRegistryAPITests/Classes/PPEventRegistryAPISpec.swift on lines 136..146

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

                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

                Severity
                Category
                Status
                Source
                Language