This project for Drupal 6 does Apache Solr live node content indexation by nodejs on node creation and node deletion. It also display live search results on the default search page when typing in the default search field. It is based on the Nodejs Integration module for Drupal 6.
git clone --branch master julien@git.drupal.org:sandbox/julien/1306592.git nodejs_solr
I would like it to be available to download only in dev or beta version for now, to seek issuers reporters or co-maintainers + i need a code review for best code practice and security.

projcet page: http://drupal.org/sandbox/julien/1306592

Comments

gargsuchi’s picture

Please provide the correct URL for your sandbox project. The git URL above is not working.

julien’s picture

Hi,

this is the url to the sandbox project where you will get the correct git infos:
http://drupal.org/sandbox/julien/1306592

Cheers

julien’s picture

Issue summary: View changes

update

klausi’s picture

Status: Needs review » Needs work

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/nodejs_solr.module:
     +4: [minor] Comment should be read "Implements hook_foo()."
     +19: [minor] There should be no trailing spaces
     +20: [minor] There should be no trailing spaces
     +26: [minor] There should be no trailing spaces
     +155: [minor] Potential problem: use the Form API to prevent against CSRF attacks. If you need to use $_POST variables, ensure they are fully sanitized if displayed by using check_plain(), !f
    ilter_xss() or similar.
     +216: [minor] There should be no trailing spaces
     +278: [minor] There should be no trailing spaces
     +279: [minor] There should be no trailing spaces
     +290: [minor] There should be no trailing spaces
     +293: [minor] There should be no trailing spaces
     +303: [minor] There should be no trailing spaces
     +306: [minor] There should be no trailing spaces
     +316: [minor] There should be no trailing spaces
     +339: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +357: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +362: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +363: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +403: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +474: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +522: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +689: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +691: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +693: [minor] in most cases, replace the string function with the drupal_ equivalent string functions
     +696: [normal] use a space between the closing parenthesis and the open bracket
     +699: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +723: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +726: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +729: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
    
    sites/all/modules/pareview_temp/test_candidate/nodejs_solr.admin.inc:
     +11: [minor] There should be no trailing spaces
     +16: [minor] There should be no trailing spaces
     +24: [minor] There should be no trailing spaces
     +33: [minor] There should be no trailing spaces
     +51: [minor] There should be no trailing spaces
     +74: [minor] There should be no trailing spaces
     +83: [minor] There should be no trailing spaces
    
    Status Messages:
     Coder found 1 projects, 19 files, 8 normal warnings, 27 minor warnings, 0 warnings were flagged to be ignored
    
  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • @file doc block is missing in the module file, see http://drupal.org/node/1354#files .
  • ./nodejs_solr.js: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
          // window from resulting notifications. We do this so that modules can hook
    
  • ./nodejs_solr.module: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
              // We can use 'value' rather than 'safe' since we strip tags and later check_plain().
          // $mappings['per-field']['field_model_name'] = array('callback' => '', 'index_type' => 'string', 'facets' => TRUE);
          // $mappings['per-field']['field_model_price'] = array('callback' => '', 'index_type' => 'float', 'facets' => TRUE);
            // Only deal with fields that have index mappings and that have not been marked for exclusion.
    
  • ./nodejs_solr.module: all functions should have doxygen doc blocks, see http://drupal.org/node/1354#functions
    
    function _nodejs_solr_hmac_base64($data, $key) {
    --
    
    function _nodejs_solr_random_bytes($count) {
    --
    
    function _nodejs_solr_get_hash_salt() {
    
  • ./nodejs_solr.module: The description for the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    224- */
    247- */
    
  • Assignments should have a space before and after the operator, see http://drupal.org/node/318#operators
    ./node_modules/solr/lib/solr.js:63:      for (var i=0; i<id.length; i++) {
    ./node_modules/solr/lib/solr.js:72:      for (var i=0; i<query.length; i++) {
    

This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.

manual review:
node_modules: appears to be 3rd party code. 3rd party code is not generally allowed on Drupal.org and should be deleted. This policy is described in the getting involved handbook. It also appears in the terms and conditions you agreed to when you signed up for Git access, which you may want to re-read, to be sure you're not violating other terms. The Libraries API module is a recommended method for adding 3rd party dependencies without directly including the code on Drupal.org.

julien’s picture

Status: Needs work » Active

Did made a code review with coder, and did applied the git requests. Is it possible to give it another go? Thanks in advance.

klausi’s picture

Status: Active » Needs review

So it needs review.

julien’s picture

Indeed.

natemow’s picture

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:

  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • @file doc block is missing in the module file, see http://drupal.org/node/1354#files .
  • ./server.js: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
    //if mysql enable in the settings, then do the query directly to simulate a variable_get
    
  • ./nodejs_solr.js: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
          // window from resulting notifications. We do this so that modules can hook
    
  • ./nodejs_solr.module: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
              // We can use 'value' rather than 'safe' since we strip tags and later check_plain().
          // $mappings['per-field']['field_model_name'] = array('callback' => '', 'index_type' => 'string', 'facets' => TRUE);
          // $mappings['per-field']['field_model_price'] = array('callback' => '', 'index_type' => 'float', 'facets' => TRUE);
            // Only deal with fields that have index mappings and that have not been marked for exclusion.
    
  • Comments should be on a separate line before the code line, see http://drupal.org/node/1354#inline
    ./server.js:48:var HOST = backendSettings.solrHost;  // 127.0.0.1
    ./server.js:49:var PORT = backendSettings.solrPort;  // 8080
    ./server.js:50:var CORE = '';  // No core
    ./server.js:51:var PATH = backendSettings.solrPath;  // /solr
    ./node_modules/solr/lib/solr.js:13:  this.core = core || ""; // if defined, should begin with a slash
    ./node_modules/solr/lib/solr.js:14:  this.path = path || "/solr"; // should also begin with a slash
    ./node_modules/solr/test/test-update.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./node_modules/solr/test/test-query.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./node_modules/solr/test/common.js:6:var HOST = '';  // 127.0.0.1
    ./node_modules/solr/test/common.js:7:var PORT = '';  // 8983
    ./node_modules/solr/test/common.js:8:var CORE = '';  // No core
    ./node_modules/solr/test/common.js:9:var PATH = '';  // /solr
    ./node_modules/solr/test/test-update-xml.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./node_modules/solr/test/test-post.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./node_modules/solr/test/test-update-array.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./nodejs_solr.module:59:<!--//--><![CDATA[//><!--]]
    ./nodejs_solr.module:640:      $type_prefix = 'p'; // reserve d for date
    ./test/test-update.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-query.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/common.js:6:var HOST = '';  // 127.0.0.1
    ./test/common.js:7:var PORT = '';  // 8983
    ./test/common.js:8:var CORE = '';  // No core
    ./test/common.js:9:var PATH = '';  // /solr
    ./test/test-update-xml.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-post.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-update-array.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    
  • ./nodejs_solr.module: all functions should have doxygen doc blocks, see http://drupal.org/node/1354#functions
    
    function _nodejs_solr_hmac_base64($data, $key) {
    --
    
    function _nodejs_solr_random_bytes($count) {
    --
    
    function _nodejs_solr_get_hash_salt() {
    
  • ./nodejs_solr.module: The description on the line after the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    230- */
    253- */
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./server.js ./node_modules/solr/lib/solr.js ./node_modules/solr/index.js ./node_modules/solr/test/test-query.js ./node_modules/solr/test/common.js ./nodejs_solr.config.js ./nodejs_solr.admin.inc ./nodejs_solr.module ./test/test-query.js ./test/common.js
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

natemow’s picture

Status: Needs review » Needs work
julien’s picture

Status: Needs work » Needs review

Errr... According to the first review i did create a dev git branch. 6.x-1.x-dev.
http://drupal.org/node/1306592/commits?page=1
Please check the commits from the 1st of November until now. maybe you're doing the review on the wrong git branch?

natemow’s picture

Status: Needs review » Needs work

Ah, I see...that branch should be re-named to 6.x-1.x -- see http://drupal.org/node/1015226

julien’s picture

Status: Needs work » Needs review

The branch 6.x-1.x has been renamed. Is it possible to give it another go? Thanks in advance.

natemow’s picture

Status: Needs review » Needs work

Review of the 6.x-1.x branch:

  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • @file doc block is missing in the install file, see http://drupal.org/node/1354#files .
  • Comments: there should be a space after "//", see http://drupal.org/node/1354#inline
    nodejs_solr.js:7:      //Drupal.Nodejs.sendAuthMessage();
    nodejs_solr.js:68:    //Drupal.Nodejs.sendAuthMessage();
    nodejs_solr.module:176:      //nodejs_solr_user_set_offline($message['uid']);
    nodejs_solr.module:216:      //drupal_json(array('setting' => variable_get('html_replace', '')));
    nodejs_solr.module:328:    //drupal_alter('nodejs_solr_message', $message);
    nodejs_solr.module:331:    //watchdog('639:', $message->client_socket_id);
    nodejs_solr.module:342:    //drupal_alter('nodejs_solr_message', $message);
    nodejs_solr.module:344:    //watchdog('639:', $message->client_socket_id);
    nodejs_solr.module:355:    //drupal_alter('nodejs_solr_message', $message);
    nodejs_solr.module:357:    //watchdog('639:', $message->client_socket_id);
    server.js:7://declare some variables - require
    server.js:29://if mysql enable in the settings, then do the query directly to simulate a variable_get
    server.js:45:    //wclient.end();
    server.js:238:      //console.log('Failed to parse authentication message:', exception);
    server.js:441:		//DO the indexation
    server.js:484:      //sentCount = publishMessageToChannel(message);
    server.js:513:		//DO the indexation
    server.js:591:	  //console.log(sessionId);
    server.js:706:    //setUserOffline(uid);
    server.js:791:  //console.log(socket.id);	
    server.js:806:    //message.messageType = 'setting';
    server.js:807:    //htmlstr = "1";
    server.js:813:    //console.log(htmlstr);
    
  • ./server.js: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
    //if mysql enable in the settings, then do the query directly to simulate a variable_get
    
  • ./nodejs_solr.module: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
              // We can use 'value' rather than 'safe' since we strip tags and later check_plain().
                  //$document->setMultiValue($index_key, _nodejs_solr_clean_text($value['value']));
          // $mappings['per-field']['field_model_name'] = array('callback' => '', 'index_type' => 'string', 'facets' => TRUE);
          // $mappings['per-field']['field_model_price'] = array('callback' => '', 'index_type' => 'float', 'facets' => TRUE);
            // Only deal with fields that have index mappings and that have not been marked for exclusion.
    
  • Comments should be on a separate line before the code line, see http://drupal.org/node/1354#inline
    ./server.js:50:var HOST = backendSettings.solrHost;  // 127.0.0.1
    ./server.js:51:var PORT = backendSettings.solrPort;  // 8080
    ./server.js:52:var CORE = '';  // No core
    ./server.js:53:var PATH = backendSettings.solrPath;  // /solr
    ./nodejs_solr.module:65:<!--//--><![CDATA[//><!--]]
    ./nodejs_solr.module:691:      $type_prefix = 'p'; // reserve d for date
    ./test/test-update.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-query.js:9:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/common.js:6:var HOST = '';  // 127.0.0.1
    ./test/common.js:7:var PORT = '';  // 8983
    ./test/common.js:8:var CORE = '';  // No core
    ./test/common.js:9:var PATH = '';  // /solr
    ./test/test-update-xml.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-post.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    ./test/test-update-array.js:8:client.del(null, '*:*', function(err) {  // Clean up index
    
  • ./nodejs_solr.module: The description on the line after the @param/@return documentation is either missing or not formatted correctly. See http://drupal.org/node/1354#functions
    271- */
    294- */
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./server.js ./nodejs_solr.config.js ./nodejs_solr.admin.inc ./README.txt ./nodejs_solr.module ./nodejs_solr.install ./test/test-query.js ./test/common.js
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

julien’s picture

Status: Needs work » Needs review

The review changes have been applied and commited. Here is the output of the parview script:

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

doitDave’s picture

Status: Needs review » Needs work

Automated review (Please keep in mind that this is primarily a high level check that does not replace but, after all, eases the review process. There is no guarantee that no other issues could show up in a more in-depth manual follow-up review.)

Review of the 6.x-1.x branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/nodejs_solr.module:
     +6: [minor] There should be no trailing spaces
     +8: [minor] Comment should be read "Implements hook_foo()."
     +167: [minor] Potential problem: use the Form API to prevent against CSRF attacks. If you need to use $_POST variables, ensure they are fully sanitized if displayed by using check_plain(), !f
    ilter_xss() or similar.
     +210: [minor] Potential problem: use the Form API to prevent against CSRF attacks. If you need to use $_POST variables, ensure they are fully sanitized if displayed by using check_plain(), !f
    ilter_xss() or similar.
     +450: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +737: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +739: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +744: [minor] Use an indent of 2 spaces, with no tabs
     +747: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +776: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +779: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
    
    Status Messages:
     Coder found 1 projects, 1 files, 6 normal warnings, 5 minor warnings, 0 warnings were flagged to be ignored
    
  • Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):
    
    FILE: ...p709/sites/all/modules/pareview_temp/test_candidate/nodejs_solr.install
    --------------------------------------------------------------------------------
    FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
    --------------------------------------------------------------------------------
     19 | ERROR | Whitespace found at end of line
     26 | ERROR | No space found after comma in function call
     28 | ERROR | Whitespace found at end of line
    --------------------------------------------------------------------------------
    
    
    FILE: ...dp709/sites/all/modules/pareview_temp/test_candidate/nodejs_solr.module
    --------------------------------------------------------------------------------
    FOUND 30 ERROR(S) AND 6 WARNING(S) AFFECTING 32 LINE(S)
    --------------------------------------------------------------------------------
       6 | ERROR   | Whitespace found at end of line
       8 | WARNING | Format should be * Implements hook_foo().
      25 | ERROR   | Line indented incorrectly; expected at least 8 spaces, found 4
      26 | ERROR   | Closing brace indented incorrectly; expected 6 spaces, found 4
      35 | ERROR   | Line indented incorrectly; expected at least 6 spaces, found 0
      52 | ERROR   | Line indented incorrectly; expected at least 2 spaces, found 1
      60 | ERROR   | An operator statement must be followed by a single space
     196 | WARNING | Line exceeds 80 characters; contains 86 characters
     225 | ERROR   | Line indented incorrectly; expected at least 2 spaces, found 1
     309 | ERROR   | Missing function doc comment
     318 | ERROR   | Missing function doc comment
     328 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2
     332 | ERROR   | You must use "/**" style comments for a function comment
     341 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2
     345 | ERROR   | You must use "/**" style comments for a function comment
     353 | ERROR   | Line indented incorrectly; expected at least 4 spaces, found 2
     361 | ERROR   | You must use "/**" style comments for a function comment
     386 | WARNING | Silencing errors is discouraged
     414 | ERROR   | You must use "/**" style comments for a function comment
     450 | ERROR   | Concat operator must be surrounded by spaces
     595 | WARNING | Line exceeds 80 characters; contains 83 characters
     619 | WARNING | Line exceeds 80 characters; contains 120 characters
     621 | WARNING | Line exceeds 80 characters; contains 120 characters
     737 | ERROR   | Concat operator must be surrounded by spaces
     737 | ERROR   | Concat operator must be surrounded by spaces
     739 | ERROR   | Concat operator must be surrounded by spaces
     739 | ERROR   | Concat operator must be surrounded by spaces
     744 | ERROR   | Line indented incorrectly; expected 6 spaces, found 5
     746 | ERROR   | Closing brace indented incorrectly; expected 5 spaces, found 6
     747 | ERROR   | Concat operator must be surrounded by spaces
     770 | ERROR   | Line indented incorrectly; expected at least 8 spaces, found 0
     771 | ERROR   | Line indented incorrectly; expected at least 8 spaces, found 0
     776 | ERROR   | Concat operator must be surrounded by spaces
     776 | ERROR   | Concat operator must be surrounded by spaces
     776 | ERROR   | Concat operator must be surrounded by spaces
     779 | ERROR   | Concat operator must be surrounded by spaces
    --------------------------------------------------------------------------------
    
  • Comments should be on a separate line before the code line, see http://drupal.org/node/1354#inline
    ./nodejs_solr.module:65:<!--//--><![CDATA[//><!--]]
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

Manual review:

  • There are still files in your master branch. You should replace them as described in http://drupal.org/node/1127732 at step 5.
  • You don't need your 6.x-1.x-dev branch. Dev snapshots will be automatically created once you achieve full project status, so just drop it for more consistence.
  • Can you please explain what you are doing in .module lines 60-67? This does actually look far from being compliant with the Drupal JS API, so you should either add your script in the standard ways or clarify why you would have no way but to "hackity_hack" the API standards. Please explain that in a way that every reviewer understands (and, eventually, can give a hint on how to do it according to the API standards anyhow).
  • I did not find a feedback on http://drupal.org/node/1324570#comment-5185552 regarding the 3rd party code, or did I miss that?
misc’s picture

@julien has no contact-adress on d.o. I try to contact him in a comment here to ask if the application is abandoned.

After ten weeks with a status of needs work: the applicant may be contacted by a reviewer to determine whether the application was indeed abandoned. The action taken by the reviewer should be documented in the project application issue.

http://drupal.org/node/894256

misc’s picture

Status: Needs work » Closed (won't fix)

The application has been closed. If you would like to reopen it, you are free to do so.
See http://drupal.org/node/894256#abandonedtwoweekscontact

misc’s picture

Issue summary: View changes

added project page