MCPcopy
hub / github.com/saltstack/salt / _lint_pre_commit

Function _lint_pre_commit

noxfile.py:1598–1626  ·  view source on GitHub ↗
(session, rcfile, flags, paths)

Source from the content-addressed store, hash-verified

1596
1597
1598def _lint_pre_commit(session, rcfile, flags, paths):
1599 if "VIRTUAL_ENV" not in os.environ:
1600 session.error(
1601 "This should be running from within a virtualenv and "
1602 "'VIRTUAL_ENV' was not found as an environment variable."
1603 )
1604 if "pre-commit" not in os.environ["VIRTUAL_ENV"]:
1605 session.error(
1606 "This should be running from within a pre-commit virtualenv and "
1607 "'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format(
1608 os.environ["VIRTUAL_ENV"]
1609 )
1610 )
1611 from nox.virtualenv import VirtualEnv
1612
1613 # Let's patch nox to make it run inside the pre-commit virtualenv
1614 session._runner.venv = VirtualEnv(
1615 os.environ["VIRTUAL_ENV"],
1616 interpreter=session._runner.func.python,
1617 reuse_existing=True,
1618 venv=True,
1619 )
1620 _lint(
1621 session,
1622 rcfile,
1623 flags,
1624 paths,
1625 upgrade_setuptools_and_pip=False,
1626 )
1627
1628
1629@nox.session(python="3")

Callers 2

lint_salt_pre_commitFunction · 0.85
lint_tests_pre_commitFunction · 0.85

Calls 4

VirtualEnvClass · 0.85
_lintFunction · 0.85
formatMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected