lib/cli.js
function lint(userConfig, input, ignore, errorReporter) {
    let filesToLint, errorCount;

    //If filename is provided, lint it. Otherwise, lint over current directory & sub-directories
    if (input.file) {

        if (!fsUtils.isFile(input.file)) {
            errorReporter.reportFatal(`${input.file} is not a valid file`);
            process.exit(errorCodes.INVALID_PARAMS);
        }

        filesToLint = [input.file];

    } else if (input.dir) {

        if (!fsUtils.isDirectory(input.dir)) {
            errorReporter.reportFatal(`${input.dir} is not a valid directory`);
            process.exit(errorCodes.INVALID_PARAMS);
        }

        filesToLint = traverse(input.dir, ignore);
    }

    if (filesToLint) {
        errorCount = sum(filesToLint.map(function(file, index) {
            userConfig.options.returnInternalIssues = (index === 0);
            return lintFile(file, userConfig, errorReporter);
        }));
    } else if (input.stdin) {
        // This only works on *nix. Need to fix to enable stdin input in windows.
        let sourceCode = fs.readFileSync("/dev/stdin", "utf-8");

        userConfig.options.returnInternalIssues = true;
        errorCount = lintString(sourceCode, userConfig, errorReporter, "[stdin]");
    } else {
        errorReporter.reportFatal("Must specify input for linter using --file, --dir or --stdin");
        process.exit(errorCodes.INVALID_PARAMS);
    }

    errorReporter.finalize && errorReporter.finalize();
    return errorCount;
}
function lint(userConfig, input, ignore, errorReporter) {
    let filesToLint, errorCount;

    //If filename is provided, lint it. Otherwise, lint over current directory & sub-directories
    if (input.file) {

        if (!fsUtils.isFile(input.file)) {
            errorReporter.reportFatal(`${input.file} is not a valid file`);
            process.exit(errorCodes.INVALID_PARAMS);
        }

        filesToLint = [input.file];

    } else if (input.dir) {

        if (!fsUtils.isDirectory(input.dir)) {
            errorReporter.reportFatal(`${input.dir} is not a valid directory`);
            process.exit(errorCodes.INVALID_PARAMS);
        }

        filesToLint = traverse(input.dir, ignore);
    }

    if (filesToLint) {
        errorCount = sum(filesToLint.map(function(file, index) {
            userConfig.options.returnInternalIssues = (index === 0);
            return lintFile(file, userConfig, errorReporter);
        }));
    } else if (input.stdin) {
        // This only works on *nix. Need to fix to enable stdin input in windows.
        let sourceCode = fs.readFileSync("/dev/stdin", "utf-8");

        userConfig.options.returnInternalIssues = true;
        errorCount = lintString(sourceCode, userConfig, errorReporter, "[stdin]");
    } else {
        errorReporter.reportFatal("Must specify input for linter using --file, --dir or --stdin");
        process.exit(errorCodes.INVALID_PARAMS);
    }

    errorReporter.finalize && errorReporter.finalize();
    return errorCount;
}
Function that calls Solium object's linter based on user settings.
If not given, we lint the entire directory's (and sub-directories') solidity files.
@param {Object} userConfig User's configurations that contain information about which linting rules to apply
@param {String} filename (optional) The single file to be linted.
@returns {Integer} totalNumOfErrors Total no. of errors found throughout the codebase (directory) linted.