Perform static analysis on the given file.

    .. seealso::

        - :data:`.SUPPORTED_FILES`
        - :func:`.check_pep8`
        - :func:`.check_pydocstyle`
        - and :func:`.check_license`

    :param filename: path of file to check.
    :type filename: str
    :return: errors sorted by line number or None if file is excluded
    :rtype: `list`

def check_file(filename, **kwargs):
    """Perform static analysis on the given file.

    .. seealso::

        - :data:`.SUPPORTED_FILES`
        - :func:`.check_pep8`
        - :func:`.check_pydocstyle`
        - and :func:`.check_license`

    :param filename: path of file to check.
    :type filename: str
    :return: errors sorted by line number or None if file is excluded
    :rtype: `list`

    """
    excludes = kwargs.get("excludes", [])
    errors = []

    if is_file_excluded(filename, excludes):
        return None

    if filename.endswith(".py"):
        if kwargs.get("pep8", True):
            errors += check_pep8(filename, **kwargs)
        if kwargs.get("pydocstyle", True):
            errors += check_pydocstyle(filename, **kwargs)
        if kwargs.get("license", True):
            errors += check_license(filename, **kwargs)
    elif re.search("\.(tpl|html)$", filename):
        errors += check_license(filename, **kwargs)
    elif re.search("\.(js|jsx|css|less)$", filename):
        errors += check_license(filename, python_style=False, **kwargs)

    def try_to_int(value):
        try:
            return int(value.split(':', 1)[0])
        except ValueError:
            return 0

    return sorted(errors, key=try_to_int)