-
Notifications
You must be signed in to change notification settings - Fork 297
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
Code quality: Makefile to run static code checkers #124
Conversation
837a7f1
to
f5a38ff
Compare
The travis log/ |
It provides stats, in a concise way, about how compliant the code is to clean coding standards. I've been using that kind of utility as a commit hook for some time, and it's great to proof-check your commit/branch status before actually pushing anything anywhere (e.g. local/small projects without code-review services). Not having details in commit-triggered builds is useful for project managers, to track code evolution trends. The main goal behind having a Makefile is to easily run unit tests, which is planned for #71. You may then consider having static checkers' concise output as a bonus for your build log 😃 Please note that I'm not assuming everything here is relevant; this PR essentially provides a fashionable way to install and run some popular PHP dev tools. |
Ok, while I see (and approve) the goal of this PR (better code quality), I'm not ok with merging this in the Dev tools have nothing to do in our released code. The Makefile is definitely useful to run checks locally and work on code quality. A |
I'm a bit confused... What would be the point in hiding test code in a development branch? Or even worse, a Wiki page? Providing test code and utilities along the actual product's codebase is, besides being a standard for all modern projects, a huge asset to improve the quality and quantity of code contributions:
Tests are part of -and often more important than- the code: they live with it, show how it (is expected to) work, and should not be kept apart. There may be a confusion here, between:
Here is an awesome example of a successful Git branching model:
Given the small size of Shaarli, we could stick to stable, development and release branches. As I understand it, the issue is having "non-release" code provided to users; why not work on a release script / process then, that would:
|
This is something that could be done in the long run. However the current download strategy for users is to either While the travis integration is nice and automatically gives us a summary of what could be improved on each pull request, it does not help with the current state of the code at all, which needs to be addressed before we can think of best practices for further contributions. How I'd handle that: first merge the Makefile since it is helpful for cleaning up current code. Provide comments in it on how to install the required tools. Let the composerfile and travis integration wait for later. |
@pikzen seemed to disagree with me in a private chat:
I say wash first. |
huehuehuehue For those who do not speak french, it went that way:
I definitely agree with providing tools to maintain a high code quality in Shaarli (read: not what there is currently). PHPMD is great (835 problems on the latest master woohoooo), so is phpcs, etc. What @nodiscc probably didn't understand is that I rather agree with him (which also means that my analogies are terrible): providing the Makefile is great. Providing an install script is great: we can store whatever the hell we want in master and not have it mirrored when the users install Shaarli. (As an aside, phpmd reports $GLOBALS usage as a problem, so either ignore it or merge #108 in to fix 300 in one go ) |
Shaarli runs with PHP 5.1 |
I do think that having this included in the master repository is the right thing to do. It allows anyone getting the source to reproduce it (which is a core part of the FLOSS philosophy, we're not just dumping a tar-/zipball over the fence every now and then), can be used by Linux distributions to run tests, etc. when building their packages, and provides a way to automatically run these tasks each time a new commit is pushed to GitHub. As I have explained elsewhere, the original goal of having everything in one file is long gone. And in the worst case the user has a Makefile on their webserver. Not a big deal, they already have these files that are not strictly needed (in the technical sense) to run the software:
|
Fine, let's merge it if you think it helps. At least I agree the Makefile helps :) |
Thanks to all for you insights ;-)
That's the cool thing, Travis runs builds on any branch that has a
Agreed. Travis integration was a bonus / demo here, and can be kept for later.
Adding expected PHP revisions to Travis is quite easy, I think we can safely focus on
I'd rather provide an actual Composer config file, than a Makefile with lots of superfluous setup comments / instructions.
4-year-old dev ArchLinux here, quite safe to assume there's a bunch of unused and obsolete stuff lurking in each and every corner If needed, we could meet by IM to discuss CI PRs (either on Gitter, IRC, XMPP or whatever service is convenient) 😃 |
@virtualtam @e2jk So what do we keep in this Pull Request before merging? |
I'd:
|
@virtualtam Ok, please make the required changes and rebase and we can merge. If you want to document the contribution process (in the wiki) it's also welcome, either in a separate page or in a new chapter. |
f5a38ff
to
261aa28
Compare
Relates to shaarli#71 Relates to shaarli#95 Additions: - Makefile for easy usage, - Composer file to declare dev & test dependencies. Features: - PHP Copy/Paste Detect: detect duplicate code; - PHP Code Sniffer: static analysis, syntax checking, - PHP Mess Detector: static analysis, syntax checking. Signed-off-by: VirtualTam <virtualtam@flibidi.org>
261aa28
to
00f98bd
Compare
PR updated ;-) |
Code quality: Makefile to run static code checkers
Thanks! |
Here's a Makefile to run the static analysis tools mentioned in #95.
There's also a Travis config draft, untested (Travis is currently under maintenance).
Edit: Travis is back! Here's what a build looks like: https://travis-ci.org/virtualtam/Shaarli/builds/52341101