# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for vim:

https://www.cvedetails.com/vulnerability-list/vendor_id-8218/product_id-14270/Vim-Vim.html

"""

from cve_bin_tool.checkers import Checker


class VimChecker(Checker):
    CONTAINS_PATTERNS = [
        r"# This viminfo file was generated by Vim %s.",
        r"-u <vimrc>            Use <vimrc> instead of any .vimrc",
        r"- append vim.VIM_SPECIAL_PATH to sys.path",
    ]
    FILENAME_PATTERNS = [r"vim"]
    VERSION_PATTERNS = [
        r"vim-([0-9]+\.[0-9]+\.[0-9]{4})",
        r"VIM - Vi IMproved ([0-9]\.[0-9] (?:\([1-9]\d{3,} [A-Z][a-z]{2} [0-9]{1,2}\))?)",
    ]
    VENDOR_PRODUCT = [("vim", "vim")]
