Closed gabel closed 5 months ago
I agree! Being able to test documentation quality on a project comes at great advantage for both the dev and the users. Please (please) add support to PHP :smile:
I totally agree! Please add support to PHP :smile:
Okay, the only problem is that I am not an active PHP coder, so I would need help on this.
What we would need is a PHP documentation parser that can produce machine-readable output like JSON or XML. For example, in JavaScript we use JSDoc for this. It parses the documentation, emits JSON which is then parsed by Inch to create the evaluation.
Do you know of any such project for PHP?
Can u please provide output file for analyzing.
2015-10-29 14:49 GMT+02:00 René Föhring notifications@github.com:
Okay, the only problem is that I am not an active PHP coder, so I would need help on this.
What we would need is a PHP documentation parser that can produce machine-readable output like JSON or XML. For example, in JavaScript we use JSDoc http://usejsdoc.org/ for this. It parses the documentation, emits JSON which is then parsed by Inch to create the evaluation.
Do you know of any such project for PHP?
— Reply to this email directly or view it on GitHub https://github.com/inch-ci/inch_ci-web/issues/91#issuecomment-152168730.
С Уважением, Егоров Виталий, моб.: (050) 414-13-07 skype: vitalyiegorov vitalyiegorov@gmail.com
Something along these lines would be great:
{
"objects": [
{
"source": "src/Quantum/ProxyCacheWarmer.php:15",
// file : line_number
"fullname": "Quantum.ProxyCacheWarmer.refreshUser",
// a unique name for the object in the codebase
"type": "Function",
// type of the object ("Function", "Class", ...)
"parameters": ["$user"],
// names of the parameters from the signature
"docstring": "/**\n * The proxy generator cache warmer generates all entity proxies.\n *\n * In the process of generating proxies the cache for all the metadata is primed also,\n * since this information is necessary to build the proxies in the first place.\n *\n *\n */"
// the documentation as it appears in the code
},
// ... all objects (functions, classes, and so on)
]
}
Please note that I know next to nothing about PHP, so my notation of fullname
maybe wrong (please use whatever notation PHP devs are familar with).
I updated the above comment many times, in case your reading via email!
Thank u, can u please attach an example of generated JSON file for real project on ruby or javascript? And regarding fullname - what does this field is for? full class name with namespaces? @rrrene
An example JSON for Forever can be found here: https://gist.github.com/rrrene/69c0a81bc748d6fd71a5
And yes: fullname means a unique name in the code base. So I would presume it will be something like namespace + class_name + function_name
...
A fully qualified class name in PHP, with a method, would look something like this:
Quantum\ProxyCacheWarmer::refreshUser
Ah, I suspected it would be different from Ruby et al.
Thx!
In PHP documentation is added (in the source) via PHPDOC. This can be parsed by PHPDocumentor later.
phpdoc --template=xml
generates this kind of XML file: https://gist.github.com/Rudloff/f037b01c2397ad5bc407bd7dfadf996b
Would that be something you can parse?
@rrrene Any success using phpdoc? If i can help in some way - please tell. I think that using comments analysis is the last part to make perfect modules/packages. Take a look at SamsonFramework/Generator We have scrutinizer and code climate for code quality analysis, we have styleci for coding standards validation, we have travis for builds and code coverage, packagist for dependency management and statistics, the only thing that we are lacking - is comments coverage, I think that code commenting is super very important especially in PHP. So this would give huge interest to your project from PHP world if you would be first to implement such kind of CI analysis or I think someone will do it aside.
@vitalyiegorov I will need a free weekend to look at this stuff. We would need to convert the XML to JSON like described above.
@rrrene Any success with PHP language?
Sorry, did not find the time. 😞
Ok, so we have figured out than we can get XML output related to documentation using phpdoc cli tool.
Can you guide me how to attach this approach to current project or what should be our steps to integrate it into inch-ci logic.
Readme for this project says that you are using https://github.com/mperham/sidekiq for background workers so I need to create one worker for processing PHP code with phpdoc command and parse xml results,
Can you please help me with classes and logic guide of how to do it, then i will create a pull request.
Please re-read the discussion in this issue. We need a PHP CLI which runs phpdoc
(or something similar) and converts the resulting XML into the described JSON format. That will be a bunch of work.
Sidekiq has nothing to do with that and comes a loooong way down the road, when integrating the to-be-invented Inch for PHP into Inch CI, the webservice. :+1:
We need this
@inch-ci Is there any update? This issue is 4 years old and not active for 1 year. Support for PHP would be needed.
I totally agree. @inch-ci needs to support php.
closing stale issue
I'd like this too. In fact, I imagine the entire PHP community would.