Tuesday, 2 September 2014

Enable Sonar JavaScript plugin to scan WebSphere Commerce Stores project

Assuming we need to scan Stores project, follow the steps below:

  • Under sonar.modules, add extra entry called StoresJS

    sonar.modules = WebSphereCommerceServerExtensionsLogic,CyberSourceAddOn,Stores,StoresJS,PaypalAddOn,GenericPaymentPlugin,FirstDataAddOn,RewardCardAddOn,Rest
    • Add the entries below to configure the new StoresJS module including the language scanner engine to use
    StoresJS.projectName = Stores
    StoresJS.sonar.sources = WebContent
    StoresJS.sonar.language = js
    StoresJS.sonar.projectBaseDir = ${WORKSPACE}/Stores

    • Update sonar.exclusions to make sure all js files which are OOB (WebSphere Commerce specific) as well as Dojo or JQuery libraries are excluded from scanning. Example below shows how to excluded dojo18 folder and all of its subfolders. It will be easier if all project specific JS files are grouped under one folder and include it under StoresJS.sonar.sources, to avoid updating sonar.exclusions.
    sonar.exclusions=org/omg/**/*.java,com/ibm/**/*.java,**/*.jsp*,com/tmpl/**/*.java,**/dojo18/**

    • Repeat the steps above for any other custom web application you might have (if required).
    Hints:
    • Sonar JS plugin is not based on JSLint or JSHint engines and developers should expect to find different coding issues reported.

    No comments:

    Post a Comment