@er.pushpinderrana made the following review comments.

Manual Review

1. (+) Configure link on module page is incorrect that need to be fixed. In .info file there is admin/config/bacnet/manage and in .module file it is admin/config/services/bacnet

2. (*) As you are using system_settings_form(), it means bacnet_admin_settings_submit never called, need to remove it.

3. (+) bacnet_admin_settings_form(): All the variables defined in this form like bws1_server, bws1_login_name etc need to be delete using hook_uninstall() function after uninstallation of module.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

Comments

dbt102’s picture

Issue summary: View changes
dbt102’s picture

After trimming down the module to eliminate all Pareview test errors/warnings there were still some code remnants that needed cleaned up, even thou the module worked great there were still a few items that I overlooked.

1. Fixed the configure link
2. Removed bacnet_admin_settings_submit because it is never called.
3. Added function bacnet_uninstall() to bacnet.install

(I think these all originated when trying to embed the bacnet site map feature and bacnetsite content type feature into the base module at the same time I was trying to address review comments. I got confused about the various pieces I was working on, and where I was working on them in my local dev environment. )

  • dbt102 committed b75bdc1 on 7.x-1.x
    #2335581#comment-9133685 by dbt: Uninstall variables.
    
dbt102’s picture

Cleanup Pareview review

Review of the 7.x-1.x branch (commit b75bdc1):

Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
FILE: /var/www/drupal-7-pareview/pareview_temp/bacnet.install
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
42 | WARNING | Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", or "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.".
--------------------------------------------------------------------------------

  • dbt102 committed a3d71f3 on 7.x-1.x
    #2335581#comment-9133717 by dbt: Cleaup pareview.
    

  • dbt102 committed d52461a on 7.x-1.x
    #2335581#comment-9133717 by dbt: Cleaup pareview.
    
dbt102’s picture

Status: Active » Fixed
dbt102’s picture

Title: Phase 1 cleanup review cleanup items » Phase 1 Cleanup review items for Stable Release
dbt102’s picture

After last commit (b7627bc) I removed check_plain() from the two lines noted

DrupalPractice has found some issues with your code, but could be false positives.
FILE: /var/www/drupal-7-pareview/pareview_temp/bacnet.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
267 | WARNING | The extra check_plain() is not necessary for placeholders, "@"
| | and "%" will automatically run check_plain()
340 | WARNING | The extra check_plain() is not necessary for placeholders, "@"
| | and "%" will automatically run check_plain()
--------------------------------------------------------------------------------

Time: 85ms; Memory: 6.5Mb

  • dbt102 committed fbcbab7 on 7.x-1.x
    #2335581#comment-9166031 by dbt: Removed check_plain()
    
dbt102’s picture

Cleaning up these errors also,

Review of the 7.x-1.x branch (commit fbcbab7):

Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
FILE: /var/www/drupal-7-pareview/pareview_temp/bacnet.module
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
14 | WARNING | [ ] Line exceeds 80 characters; contains 118 characters
129 | WARNING | [ ] A comma should follow the last multiline array item.
| | Found: ]
177 | ERROR | [ ] Inline comments must start with a capital letter
177 | ERROR | [ ] Inline comments must end in full-stops, exclamation marks,
| | or question marks
198 | ERROR | [x] Whitespace found at end of line
234 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
303 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 181ms; Memory: 8.5Mb

  • dbt102 committed 7e3b80c on 7.x-1.x
    #2335581#comment-9166039 by dbt: Cleanup pareview reported items
    

  • dbt102 committed aef8e4e on 7.x-1.x
    #2335581#comment-9166039 by dbt: Cleanup more pareview reported items.
    

  • dbt102 committed 2d8f4c0 on 7.x-1.x
    #2335581#comment-9166039 by dbt: And more cleanup of pareview reported...
dbt102’s picture

per https://www.drupal.org/node/2312955#comment-9167565

manual review:

1. bacnet_soap_get_value(): could you document @return here so that is clear what comes out of this function? See https://www.drupal.org/coding-standards/docs#return
2. bacnet_get(): this is vulnerable to XSS exploits. You are printing the result body of the request unsanitized to watchdog(). You need to apply check_plain() to the result of var_export() in the pre tags. This is a security blocker.

  • dbt102 committed 75c6a8e on 7.x-1.x
    #2335581#comment-9167865 by dbt: Add check_plain() back and document @...

  • dbt102 committed 217e6db on 7.x-1.x
    #2335581#comment-9167865 by dbt: Fix pareview comments.
    

  • dbt102 committed daa88c3 on 7.x-1.x
    #2335581#comment-9167865 by dbt: Fix more pareview comments.
    
dbt102’s picture

Version: » 7.x-1.0
Status: Fixed » Closed (fixed)