From 72578838cb01c80a88fee4c9062dc2172eb9375f Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Thu, 14 May 2026 00:42:34 +0300 Subject: ci(doc-linter): delete lint_mac dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `lint_mac()` was called and its return value immediately overwritten with `None`: err_mac = lint_mac(cnt, line.strip()) # disable mac detection for the moment, too many false positives err_mac = None The comment is correct — MAC linting produced too many false positives — but the cleanup never landed. The dead call ran on every line for every linted file, and the function/MAC-regex/MAC-error-text all sat in the source as a misleading hint that MAC linting was a live feature. Delete: - the `MAC` regex constant - the `lint_mac()` function - the `err_mac = lint_mac(...)`, `err_mac = None`, and the `err_mac` entry in the tuple iterated by the error-collection loop in `handle_file_action()` Tracked as item 9 of the rolling-side cleanup backlog flagged across the PR #2014 / #2019 / #2020 reviews. When MAC linting is genuinely wanted again, recover the regex/function from git history and wire it in cleanly. 🤖 Generated by [robots](https://vyos.io) (cherry picked from commit ac9f61e5ae366774e51975b0faddd7ba07996762) --- scripts/doc-linter.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/doc-linter.py b/scripts/doc-linter.py index 8e74600f..790409de 100644 --- a/scripts/doc-linter.py +++ b/scripts/doc-linter.py @@ -23,10 +23,6 @@ IPV6GROUPS = ( ) IPV6ADDR = '|'.join(['(?:{})'.format(g) for g in IPV6GROUPS[::-1]]) # Reverse rows for greedy match -MAC = r'([0-9A-F]{2}[:-]){5}([0-9A-F]{2})' - -NUMBER = r"([\s']\d+[\s'])" - SUPPORTED_EXTS = ('.md', '.rst', '.txt') # Linter only applies to published documentation sources under docs/. Repo-root @@ -92,17 +88,6 @@ def is_suppression_marker(line, kind, in_md_fence, in_rst_codeblock, return False -def lint_mac(cnt, line): - """Flag MAC addresses outside the RFC 7042 documentation range.""" - mac = re.search(MAC, line, re.I) - if mac is not None: - mac = mac.group() - u_mac = re.search(r'((00)[:-](53)([:-][0-9A-F]{2}){4})', mac, re.I) - m_mac = re.search(r'((90)[:-](10)([:-][0-9A-F]{2}){4})', mac, re.I) - if u_mac is None and m_mac is None: - return (f"Use MAC reserved for Documentation (RFC7042): {mac}", cnt, 'error') - - def lint_ipv4(cnt, line): """Flag IPv4 addresses outside RFC 5737 / private / multicast ranges.""" ip = re.search(IPV4ADDR, line, re.I) @@ -222,13 +207,10 @@ def handle_file_action(filepath): test_line_length = not (in_md_fence or in_rst_codeblock) - err_mac = lint_mac(cnt, line.strip()) - # disable mac detection for the moment, too many false positives - err_mac = None err_ip4 = lint_ipv4(cnt, line.strip()) err_ip6 = lint_ipv6(cnt, line.strip()) err_len = lint_linelen(cnt, line) if test_line_length else None - for e in (err_mac, err_ip4, err_ip6, err_len): + for e in (err_ip4, err_ip6, err_len): if e: errors.append(e) -- cgit v1.2.3