Closed (outdated)
Project:
Coder
Version:
8.x-2.x-dev
Component:
Coder Review
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
1 Nov 2012 at 14:49 UTC
Updated:
5 Jul 2016 at 20:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
douggreen commentedInitial attempt http://drupalcode.org/project/coder.git/commit/fba2a4e
Comment #2
benjifisherI may have done something odd to the installation of pear on my Mac (OSX 10.6) but it requires "sudo" to install a package.
I am having trouble testing. Even after I uninstall PHP_CodeSniffer, the drush script tells me that it is already installed. Maybe I have another copy somewhere in my include path, or maybe the test in the drush script does not work.
Maybe add the
--alldeps(or-a) option. When I install (not using the drush script) I get a message about the recommended package PHPTimer or something.I think we should look for a way to install this without using pear.
Comment #3
benjifisherI think the test for CodeSniffer.php does not work. I changed it to
and still got the message "PHP_CodeSniffer already installed."
Comment #4
benjifisherThe attached patch is a proof of concept. It downloads CodeSniffer from GitHub and unpacks it under
~/.drush/PHP. Despite the help text, it ignores the options. (That's what "proof of concept" means, right?) The code is based on some of my recent additions to the vimrc project.Advantage: It does not rely on pear.
Disadvantage: It downloads bleeding-edge code with no idea what version it is.
To do: Implement the options. Modify php.ini and/or output a message to the user. Link Drupal sniffs to the Standards directory. Test on Windows.
Maybe we can combine the two scripts, giving the user the option to use pear or not.
Comment #5
benjifisherTested on Windows 7. Pear is not installed, and I do not feel like installing it. After applying the patch from #4 I got the same results as on my Mac.
I do not think it makes a difference, but I ran drush from a bash shell (the one installed along with git).
I even tried installing pear, following the instructions at http://pear.php.net/manual/en/installation.getting.php. I found the .bat file under
Program Files (x86)\Drush\Php. I could not run it from bash, so I switched to the drush-enhanced Windows command line. The batch script seems to use relative paths, so I had to switch toProgram Files (x86)\Drush\Phpbefore I could get anywhere. I tried installing it system-wide (the default) and locally, but I did not try changing the defaults for any of the directories. I got error messages about the php executable and not being able to create directories.Conclusion: IMHO, Window users need a non-pear alternative.
Comment #6
douggreen commentedhttp://drupalcode.org/project/coder.git/commit/9293399 should fix hook_requirements problem reported above in #3
Comment #7
benjifisherI updated my installation to the latest git HEAD. I still have the problem I described in #3. I uninstalled PHP_CodeSniffer and made the same test change as in #3, and I still get "PHP_CodeSniffer already installed."
The change in 9293399 affects coder_review_requirements(). I tried making the same change in drush_coder_review_install_php_code_sniffer() and then
$ sudo drush install-php-code-snifferworked.
What do you think of my suggestion in #4?
Comment #8
mgiffordThis sounds good to me. I was talking to someone recently who had a heck of a lot of trouble setting this up in a Acquia Dev desktop environment, opted to set it up in a virtual machine instead.
Using drush version 6.0-dev
The drush command 'install-php-code-sniffer' could not be found. Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with
the --uri parameter on the command line. See `drush topic docs-aliases` for details.
* connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
I would like to do some more code reviews using this tool.
Comment #9
douggreen commented@ benjifisher I don't like downloaded non-stable code. That's something that pear does for us, only gets the stable releases. I could see adding something as a fallback for when pear is not installed, ... but couldn't the fallback be something more like telling the user how to install pear, or are there too many systems that this is impossible for?
Is there another Drupal project that relies on third party plugins, and offers a drush command to download and install, that we might use as a model?
Comment #10
benjifisher@douggreen:
Maybe there is a way to get a specific commit as a zip download from GitHub instead of the current HEAD.
See my comments in #5 (not just the first line). I tried pretty hard to install PEAR on W7, without success. If I can find some time, I may try the instructions at http://nikic.github.com/2011/12/03/Manually-installing-PEAR-on-Windows.html. It starts off,
This seems promising, since it suggests that the blogger had the same trouble I did.
Comment #11
alar commentedSometimes it's reassuring to know that others are suffering too.
I'm able to install Wet Boew Drupal on Linux but WIndows 7 is causing me grief. it looks like pear is required however I've never had this sort of problem before. The last message before total failure is:
Then I read on http://pear.php.net :
So I think this is another Windows 7 security feature. I'll look at the suggestions in #10. I wonder if I absolutely must have pear installed, maybe there is an easier fix???
Comment #12
benjifisher@alar: I share your pain.
If you cannot get PEAR to work, you can try my drush script in #4 above.
Comment #13
albert volkman commentedThe help text says "Coder review uses PHP_CodeSniffer to perform better code review checks; Code_Sniffer is not a requirement, but it is helpful. Use "drush install-coder-sniffer" to help install." The command is actually "
drush install-php-code-sniffer".Comment #14
Yet Another User commentedHi,
I have upgraded from Drupal 6 to 7. I found out that Coder module helps to convert the modules from 6 to 7.
I have installed the Coder module and when tried to run update.php. It said
"Coder Review PHP_CodeSniffer not installed.
Coder review uses PHP_CodeSniffer to perform better code review checks; Code_Sniffer is not a requirement, but it is helpful. Use "drush install-coder-sniffer" to help install."
I downloaded drush and installed it. Now when I tried "drush install-php-code-sniffer" command or any command, it gives the attached error. Please check the attachments.
I don't know much about drupal. It would be appreciated if anyone can help.
Thanks
Mohit Mittal
Comment #15
albert volkman commented@Mohit Mittal It appears that you have some issues with your LAMP stack. Also, you'll need to execute this command from within your Drupal install.
Comment #16
benjifisherIf you are having trouble installing drush, first look through the drush README file. A lot of questions are answered there. If you still need help with drush, then the project page says where to look for support: https://drupal.org/project/drush .
If you want to get CodeSniffer installed before resolving your drush problems, see the instructions at https://drupal.org/node/1419988 . If you are using Windows, then some of the comments and links above may be helpful.
Comment #17
Yet Another User commentedDear Albert and benjifisher,
Thanks for your replies.
I have applied the attached patch which somehow installed it. But when I try to run it, it still gives me
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
PHP/CodeSniffer.php not found
I tried to use coder_upgrade module for one of my modules, and it had converted it to make it compatible with Drupal 7.
Comment #18
kenorb commentedBTW. Where drush install-coder-sniffer command is defined?
As I've the error:
Comment #19
kenorb commentedComment #20
matt v. commented@kenorb,
See comment #13; the 7.x-2.0 version had a discrepancy between the name of the command in the help message versus the code. You may want to try the newer 7.x-2.1 release instead.
Comment #21
waverate commentedUsing coder 7.x-2.2 and PHP_CodeSniffer 1.5.2 installed via PEAR.
Drupal Status page report:
I think the expected result would be to hide the comment if PHP_CodeSniffer installed and detected correctly.
This may be a trivial point to consider but the inconsistency of the spelling and capitalization of the words Coder Review and Code_Sniffer make it difficult to tell if there is a problem or if this is a good thing.
Comment #22
seworthi commentedcoder_review.install:
In the function coder_review_requirements(), I changed the requirements array to this:
Comment #23
mile23FYI: Working on adding phpcs as a --dev dependency of core: #2744463: Add phpcs, coder 8.2.8 as --dev requirements for drupal/core
Comment #24
klausiCoder is not a module anymore and the installation with composer is documented at https://www.drupal.org/node/1419988
Note that Coder 8.x-2.x can also be used to check Drupal 7 code.