Initialize Oracle JAF and Run an Audit

If you have an Oracle JET application you created using the JET Command-Line Interface, then you can auto-configure an audit for the application and run the audit in the Command Prompt window.

In the JET application, open a Command Prompt window and from the root directory, use the Oracle JET Audit Framework (JAF) command to initialize a default JAF configuration for the application.

ojaf --init

When you initialize Oracle JAF, the JET tooling scaffolds a default JAF configuration file named oraclejafconfig.json. The tooling creates the JAF configuration file in the root directory and defines the default configuration settings based on the JET application configuration file oraclejetconfig.json, also located in the application root directory.

Before you audit the application for the first time, you can confirm the default configuration for the application files that JAF will audit. This command is called a dry-run because it does not audit the application but confirms the files to be audited based on current JAF configuration settings.

ojaf --dryrun

To perform an audit of your application, enter the command to invoke the JAF audit utility.

ojaf

When you run the audit, Oracle JAF searches the directory in which you initiated the audit for the JAF configuration file oraclejafconfig.json. If no configuration file is found there, then JAF processes only HTML files found in the current directory and will always use the default JAF configuration for the audit.

On subsequent invocations of ojaf, a check is made to see if the Oracle JET configuration file (oraclejetconfig.json) has changed since the last ojaf invocation. If changes are detected, such as might occur when you migrate your application to a new JET version, then JAF updates certain settings in the JAF configuration file automatically. The configuration property settings that JAF monitors and updates based on JET configuration file changes are:

  • jetVer specifies the JET version to be audited against.

  • files specifies the file paths or URLs used to determine the input file set to be audited.

  • exclude specifies the files paths which should be excluded from the audit.

  • components specifies paths to folders where user-defined custom web component metadata (component.json) can be found. This provides the ability for rules to inspect the component metadata and to validate custom element attributes.

  • theme specifies the Oracle theme (redwood, alta, or none) and affects rules that are theme dependent. In particular, the attribute label-edge if not used will have a default value that is dependent on the theme. The Alta theme is the default if the theme property is not specified.

Note that you may freeze a JAF configuration and prevent further automatic updates by editing the oraclejafconfig.json file and setting the property update as follows.

"ojet": {
           "update": false,
           ...
        }

All other configuration properties remain unchanged, however, you may customize your application audit, by updating the configuration file oraclejafconfig.json in a text editor and adding or amending JAF properties. A full description of the configuration options are found in About the Oracle JAF Configuration File Properties.

Additionally, you can obtain a complete list of ojaf command line flags by entering the following command.

ojaf --help

See also Configure the JET Audit Framework and Run Audits on Oracle JET Applications.