<commit_before>// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.require('axs.AuditResults');
goog.require('axs.AuditRules');
goog.require('axs.utils');

goog.provide('axs.Audit');
goog.provide('axs.AuditConfiguration');

/**
 * @typedef {{
 *   scope: (Element|undefined),
 *   auditRulesToRun: (Array.<String>|undefined),
 *   auditRulesToIgnore: (Array.<String>|undefined),
 *   maxResults: (number|undefined),
 *   withConsoleApi: (boolean|undefined),
 *   showUnsupportedRulesWarning: (boolean|undefined)
 * }}
 */
axs.AuditConfigurationOptions_;


/**
 * Object to hold configuration for an Audit run.
 * @constructor
 * @param {?axs.AuditConfigurationOptions_=} config Configuration object
 */
axs.AuditConfiguration = function(config) {
    if (config == null) {
        config = {};
    }

    /**
     * Dictionary of { audit rule name : { rules } } where rules is a dictionary
     * of { rule type : value }.
     * Possible rule types:
     * - ignore: value is a list of CSS selectors representing parts of the page
     *           which can be ignored for this audit rule.
     * - config: value is an object containing configuration for this audit
     *           rule. It will be passed to the test() method.
     * @type {Object}
     * @private<commit_msg>Migrate config docs from typedef to comments<commit_after>// Copyright 2012 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.require('axs.AuditResults');
goog.require('axs.AuditRules');
goog.require('axs.utils');

goog.provide('axs.Audit');
goog.provide('axs.AuditConfiguration');


/**
 * Object to hold configuration for an Audit run.
 * @constructor
 * @param {?Object=} config Configuration object
 *   The following configuration options are supported:
 *   - scope
 *   - auditRulesToRun
 *   - auditRulesToIgnore
 *   - maxResults
 *   - withConsoleApi
 *   - showUnsupportedRulesWarning
 */
axs.AuditConfiguration = function(config) {
    if (config == null) {
        config = {};
    }

    /**
     * Dictionary of { audit rule name : { rules } } where rules is a dictionary
     * of { rule type : value }.
     * Possible rule types:
     * - ignore: value is a list of CSS selectors representing parts of the page
     *           which can be ignored for this audit rule.
     * - config: value is an object containing configuration for this audit
     *           rule. It will be passed to the test() method.
     * @type {Object}
     * @private
{'fraction_non_alphanumeric': 0.107600341588386, 'fraction_numerical': 0.004554511813265016, 'mean_word_length': 3.1099415204678365, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '756112', 'n_tokens_mistral': 969, 'n_tokens_neox': 939, 'n_words': 369}