Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code not properly formatted #250

Closed
imGurpreetSK opened this issue Dec 7, 2018 · 2 comments
Closed

Generated code not properly formatted #250

imGurpreetSK opened this issue Dec 7, 2018 · 2 comments
Labels
enhancement good first issue If you're looking to contribute, this issue is the way to go!

Comments

@imGurpreetSK
Copy link

The code generated by the library is not formatted properly. A lot of extra new lines are present in the code. Example snippet attached along-with:

class MockRequestable: Requestable, Cuckoo.ProtocolMock {
    typealias MocksType = Requestable
    typealias Stubbing = __StubbingProxy_Requestable
    typealias Verification = __VerificationProxy_Requestable
    let cuckoo_manager = Cuckoo.MockManager(hasParent: false)

    

    

    

	struct __StubbingProxy_Requestable: Cuckoo.StubbingProxy {
	    private let cuckoo_manager: Cuckoo.MockManager
	
	    init(manager: Cuckoo.MockManager) {
	        self.cuckoo_manager = manager
	    }
	    
	    
	}

	struct __VerificationProxy_Requestable: Cuckoo.VerificationProxy {
	    private let cuckoo_manager: Cuckoo.MockManager
	    private let callMatcher: Cuckoo.CallMatcher
	    private let sourceLocation: Cuckoo.SourceLocation
	
	    init(manager: Cuckoo.MockManager, callMatcher: Cuckoo.CallMatcher, sourceLocation: Cuckoo.SourceLocation) {
	        self.cuckoo_manager = manager
	        self.callMatcher = callMatcher
	        self.sourceLocation = sourceLocation
	    }
	
	    
	
	    
	}

}

 class RequestableStub: Requestable {
    

    

    
}


class MockApi: Api, Cuckoo.ClassMock {
    typealias MocksType = Api
    typealias Stubbing = __StubbingProxy_Api
    typealias Verification = __VerificationProxy_Api
    let cuckoo_manager = Cuckoo.MockManager(hasParent: true)

    

    

    
    // ["name": "v1Url", "returnSignature": " -> String", "fullyQualifiedName": "v1Url(from: String) -> String", "parameterSignature": "from path: String", "parameterSignatureWithoutNames": "path: String", "inputTypes": "String", "isThrowing": false, "isInit": false, "isOverriding": true, "hasClosureParams": false, "@type": "ClassMethod", "accessibility": "", "parameterNames": "path", "call": "from: path", "parameters": [CuckooGeneratorFramework.MethodParameter(label: Optional("from"), name: "path", type: "String", range: CountableRange(2984..<3001), nameRange: CountableRange(2984..<2988))], "returnType": "String", "isOptional": false, "stubFunction": "Cuckoo.ClassStubFunction"]
     override func v1Url(from path: String)  -> String {
        
            return cuckoo_manager.call("v1Url(from: String) -> String",
                parameters: (path),
                superclassCall:
                    
                    super.v1Url(from: path)
                    )
        
    }
    
@TadeasKriz TadeasKriz added enhancement help wanted This issue is asking for a way to solve a problem. labels Dec 7, 2018
@TadeasKriz
Copy link
Member

TadeasKriz commented Dec 7, 2018

Hi, thank you for the report. The amount of whitespaces is caused by our use of Stencil and how it handles new lines in its statements. Although it might be nice to have a clean output, it doesn't contribute to the feature-set of Cuckoo and I'd consider it a low priority task.

This would be a good starter-issue for someone that's looking to contribute to Cuckoo.

@MatyasKriz MatyasKriz added the good first issue If you're looking to contribute, this issue is the way to go! label Jan 24, 2019
@MatyasKriz MatyasKriz removed the help wanted This issue is asking for a way to solve a problem. label May 21, 2020
@MatyasKriz
Copy link
Collaborator

This has been greatly improved in Cuckoo 2.0. I'll close this for now, but I welcome any PR that pushes the generated code beauty even further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue If you're looking to contribute, this issue is the way to go!
Projects
None yet
Development

No branches or pull requests

3 participants