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

[PHP] RFC on emitted code quality #3867

Closed
dkarlovi opened this issue Sep 25, 2016 · 6 comments
Closed

[PHP] RFC on emitted code quality #3867

dkarlovi opened this issue Sep 25, 2016 · 6 comments

Comments

@dkarlovi
Copy link
Contributor

Description

The code emitted by PHP generator is solid, but could be made better. If I open the project with PHPStorm and crank up all the inspections (including the excellent EA extended), I get quite a few violations, including those regarding code style, code smell, performance, type compatibility, etc.

As the code is generated, most of these (almost all of them) could be fixed with rather simple tweaks (some would require a more significant change which might break BC, not sure), we could tweak the templates, much like #3863.

This would make the emitted code read almost as hand-written.

Swagger-codegen version

Latest.

Related issues

#3863 is the first step in this direction. Probably also #1482.

Suggest a Fix

PR fixing this, making emitted code of higher quality and a first step toward maybe replacing the HTTP client.

@wing328
Copy link
Contributor

wing328 commented Sep 26, 2016

@dkarlovi thanks for the suggestion. We definitely welcome code analysis/inspection using PHPStorm or other tools (previously I tried codeclimate, codacy).

Do you mind sharing the PHPStorm report so that the community can review and comment on it?

@dkarlovi
Copy link
Contributor Author

@wing328 not at all, I'll add it here for Petstore later today.

@dkarlovi
Copy link
Contributor Author

Here's the inspections' output.

Sorry about it being an archive instead of link to a HTML file, it created a 15MB file which I don't know where to host or what to do with. Anyway, not all of these are errors, but I feel there's some good stuff here which can be used.

/cc @arnested

@dkarlovi
Copy link
Contributor Author

@wing328 just wanted to let you know I didn't forget about this, my Swagger-related commercial project started back up so I will be working on this in the near future for sure.

@wing328
Copy link
Contributor

wing328 commented Jan 17, 2017

@dkarlovi thanks for the update. If you need any help from us (the community), please let us know.

(we've just added Swagger Codegen to ProductHunt: https://www.producthunt.com/posts/swagger-codegen, pleae upvote if you find Swagger Codegen useful)

@wing328
Copy link
Contributor

wing328 commented Nov 30, 2017

Using #5277 for tracking and closing this one

@wing328 wing328 closed this as completed Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants