Skip to content

Python/JavaScript scientific: the library name has no left boundary (import my_numpy, ./my-numpy) and the match spans the whole line #9453

Backlog

Description

@squid-protocol

Found by the SOP-002 gap-cell decoy suite (protocol SOP-002-v1, epic #8863).

Construct: the scientific rule in python.py and javascript.py is the same pattern, \b(?:import|require|from)\b.*?(?:numpy|pandas|scipy|matplotlib|opencv|cv2)\b. The library name has no left boundary and .*? spans the whole line, so any identifier or path that merely ENDS in a library name, anywhere later on a line that contains the word import/from/require, counts.

Snippets and actual hits (expected 0 each):

  • python import my_numpy -> 1
  • python from mypandas import x -> 1
  • python import my_cv2 -> 1
  • javascript import x from "./my-numpy"; -> 1
  • javascript import { my_numpy } from "./x"; -> 1
  • javascript const from = 1; const c = cv2; -> 1 (a variable named from, then a use of cv2)

Positive controls import numpy as np (python) and import cv from "@techstark/opencv-js"; (javascript) fire as they should.

Rules: gitgalaxy/standards/language_standards/languages/python.py and javascript.py, scientific. The python import rule was anchored to statement position for the same kind of reason (#2875 C5); scientific was not.

Locked in tests/decoys/test_decoy_python.py and tests/decoys/test_decoy_javascript.py as xfail(strict=True).

Activity

  1. added
    bug
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions