Posted by eugene.ilyin on December 25, 2012 at 3:26am
4 followers
Jump to:
| Project: | Coder |
| Version: | 7.x-2.x-dev |
| Component: | Coder Review |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hello
I have long been interested in checking coding standards for Drupal.
I have a small project dcq (http://drupal.org/project/dcq). Previously, he worked with drupalcs. But since now drupalcs was included in the module coder, then I would suggest to add the code of my module to module coder.
The essence of my module (dcq) to automatically run a check coding standards just before committing. It uses hooks git (precommit).
I think it would be better if we are going to develop a project together and not create a lot of small modules.
Thank you, I hope for your support.
Comments
#1
#2
any news?
#3
Not sure why your project is a drupal module? Shouldn't it be just a set of scripts for Git pre/post commit hooks?
What do you want to integrate into coder and where?
I have no strong opinion about this, ultimately I think douggreen should take a look and decide.
#4
I would like my project would be module for Drupal and not just a script, because it can be operated via a web interface. It is much easier for developers.
Operations that can be done via the interface:
includes/
modules/
sites/all/modules/contrib/
I would like to integrate my project with the coder module as a separate sub module. Such as coder_review or coder_sniffer, but that it was part of a module coder.
Waiting answer. Thanks.
#5
I did look and while I like the idea, I'd like to work on the execution.
I dislike doing installation tasks from Apache, so I'd only do this if it was a drush command like $ drush install-php-code-sniffer. Related to this, there's an issue that install-php-code-sniffer doesn't work perfectly either. We need to fix that.
#6
If I understand you correctly - you agree to include my project into module coder?
What should I do next? If I understand correctly I should to prepare a stable version of my project, and you will commit a him?
#7
I would like to have a drush command that sets up git properly to run various coder commands through git. I won't commit your project. I will work you on a patch that implements a drush install-coder-git (or something like that).
#8
But what about list of paths to files that do not need to check (exclusions)? I think it's very important. Please explain me - what the difference between php function (install task from apache as you says) and drush command (php code also).
Thank you
#9
If someone can run drush then they should have appropriate permissions on the server. When you try to do this from apache, you end up having to give the apache process permissions to write to your server, and this opens up a big security hole, because not only can your PHP now write to the server, any PHP run from apache can also write to the server.
#10
ok, thx.
>But what about list of paths to files that do not need to check (exclusions)? I think it's very important.
For this functionallity need interface.
May be better if I make a module that contains this drush command and an interface for adding paths exclusions?
#11
I recommend that we put it all in coder_review.drush.inc, see the code for install-php-code-sniffer there as an example, create a patch for this file that does it all, with some nice drush options, and have it also write the path exclusions. If you write your own module and distribute it that way, it's less likely for people to find and use it.
#12
>I recommend that we put it all in coder_review.drush.inc, see the code for install-php-code-sniffer
it's good idea.
You mean, that I should set exclusions via drush command options? It can be not easy. Exclusion paths for example:
includes
misc
modules
sites/default
sites/all/modules/contrib
sites/all/modules/features
.....
In latest version of my project I use special file .dcq_ignore in root dir of project, for storage excluded paths.
Also I think that need to implement special page with info about this functionality:
- check that git scripts can be runned (executable)
- check that .dcq_ignore (name just for example) file is readable.
I can implement this functionality as patch for module coder_review, it's ok for you?
#13
Can you confirm it please?
#14
Here's my first attempt at git integration. As I said above, I liked the idea, but I didn't like the implementation. Much credit here goes to @eugene.ilyin for the idea and the basic framework for the code.
http://drupalcode.org/project/coder.git/commit/8346548eb01996205900333a8...
The way this works is that when you run drush coder --git, it installs the coder command as a git pre-commit hook.
So for example, if you run this command, it runs coder sniffer review using your coder default modules, displaying all warnings
$ drush coder --sniffer --minor
If you run this command, it runs coder style review on a particular module, displaying all warnings
$ drush coder --review --minor example
If you run this command, it runs coder on SQL review on a particular file, and only displays major warnings.
$ drush coder --sql --major example.inc
And lastly, the reason for this issue and commit, if you add --git it will install the pre-commit hooks for that command. The only caveat is that when using --git you should not specify a module or file.
I suggest you just accept the defaults and use
$ drush coder --git
However, all these work
$ drush coder --sniffer --minor --git
$ drush coder --review --minor --git
$ drush coder --sql --major --git
Once coder git hooks are installed, you can ignore the results two ways.
1. use the coder ignore system, this is preferable. See #1772676: How to "ignore" warnings
2. $ git commit --no-verify, git commit -n
#15
Great! Thanks for your help. If my code has helped you, I would be very grateful if you add me as the author of a commit.
Thank you.
#16
#17
Automatically closed -- issue fixed for 2 weeks with no activity.