Entry point for the spellcheck linter.

def main(arguments=None):  # suppress(unused-function)
    """Entry point for the spellcheck linter."""
    dictionary_path = os.path.abspath("DICTIONARY")
    result = _parse_arguments(arguments)

    num_errors = 0
    for found_filename in result.files:
        file_path = os.path.abspath(found_filename)
        with io.open(file_path, "r+", encoding="utf-8") as found_file:
            jobstamps_dependencies = [file_path]

            if os.path.exists(dictionary_path):
                jobstamps_dependencies.append(dictionary_path)

            if (result.technical_terms and
                    os.path.exists(result.technical_terms)):
                jobstamps_dependencies.append(result.technical_terms)

            kwargs = {
                "jobstamps_dependencies": jobstamps_dependencies,
                "jobstamps_cache_output_directory": result.stamp_file_path,
            }

            errors = jobstamp.run(spellcheck,
                                  found_file.read(),
                                  result.technical_terms,
                                  result.spellcheck_cache,
                                  **kwargs)

            for error in errors:
                _report_spelling_error(error, file_path)

            num_errors += len(errors)

    return num_errors