<commit_before>'use strict';

const root = require('app-root-path');
const path = require('path');
const fs = require('fs');

const CZ_CONFIG_NAME = '.cz-config.js';
let czConfigPath = path.join(root.path, CZ_CONFIG_NAME);

const { config } = require(path.join(process.cwd(), 'package.json'));
if (config && config['cz-customizable']) {
    const file = config['cz-customizable'].config;
    czConfigPath = path.join(process.cwd(), file);
}

/**
 * Reads and gets the cz-customizable config from a path.
 *
 * @param {string} path The path to a cz-customizable config file.
 *
 * @returns {Object} The cz-customizable config.
 */
function get(path) {
    let czConfig;

    try {
        fs.accessSync(path, fs.R_OK);

        czConfig = require(path);
    } catch (err) {
        czConfig = {};
    }<commit_msg>fix: get root dir error<commit_after>'use strict';

const root = require('app-root-path');
const path = require('path');
const fs = require('fs');

const CZ_CONFIG_NAME = '.cz-config.js';
let czConfigPath = path.join(root.path, CZ_CONFIG_NAME);

const { config } = require(root.path, 'package.json'));
if (config && config['cz-customizable']) {
    const file = config['cz-customizable'].config;
    czConfigPath = path.join(root.path, file);
}

/**
 * Reads and gets the cz-customizable config from a path.
 *
 * @param {string} path The path to a cz-customizable config file.
 *
 * @returns {Object} The cz-customizable config.
 */
function get(path) {
    let czConfig;

    try {
        fs.accessSync(path, fs.R_OK);

        czConfig = require(path);
    } catch (err) {
        czConfig = {};
    }
{'fraction_non_alphanumeric': 0.157601977750309, 'fraction_numerical': 0.0, 'mean_word_length': 3.472375690607735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3464290', 'n_tokens_mistral': 530, 'n_tokens_neox': 524, 'n_words': 138}