Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions envoy.code.check/envoy/code/check/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ toolshed_library(
"__init__.py",
"abstract/__init__.py",
"abstract/base.py",
"abstract/bazel.py",
"abstract/changelog.py",
"abstract/checker.py",
"abstract/extensions.py",
Expand All @@ -30,6 +31,7 @@ toolshed_library(
"cmd.py",
"exceptions.py",
"interface.py",
"shared.py",
"typing.py",
],
)
9 changes: 6 additions & 3 deletions envoy.code.check/envoy/code/check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from . import abstract, exceptions, typing
from .abstract import (
ABackticksCheck,
ABazelCheck,
AChangelogChangesChecker,
AChangelogCheck,
AChangelogStatus,
Expand All @@ -20,6 +21,7 @@
AYamllintCheck,
AYapfCheck)
from .checker import (
BazelCheck,
ChangelogChangesChecker,
ChangelogCheck,
ChangelogStatus,
Expand All @@ -33,12 +35,13 @@
YamllintCheck,
YapfCheck)
from .cmd import run, main
from . import checker, interface
from . import checker, interface, shared


__all__ = (
"abstract",
"ABackticksCheck",
"ABazelCheck",
"AChangelogChangesChecker",
"AChangelogCheck",
"AChangelogStatus",
Expand All @@ -56,6 +59,7 @@
"AShellcheckCheck",
"AYamllintCheck",
"AYapfCheck",
"BazelCheck",
"ChangelogChangesChecker",
"ChangelogCheck",
"ChangelogStatus",
Expand All @@ -69,9 +73,8 @@
"interface",
"main",
"run",
"main",
"run",
"RuntimeGuardsCheck",
"shared",
"ShellcheckCheck",
"typing",
"YamllintCheck",
Expand Down
4 changes: 4 additions & 0 deletions envoy.code.check/envoy/code/check/abstract/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

from .base import ACodeCheck, AFileCodeCheck, AProjectCodeCheck
from .bazel import ABazelCheck
from .changelog import (
AChangelogCheck,
AChangelogChangesChecker,
Expand All @@ -19,6 +20,7 @@
from .yapf import AYapfCheck
from . import (
base,
bazel,
checker,
extensions,
flake8,
Expand All @@ -32,6 +34,7 @@

__all__ = (
"ABackticksCheck",
"ABazelCheck",
"AChangelogChangesChecker",
"AChangelogCheck",
"AChangelogStatus",
Expand All @@ -50,6 +53,7 @@
"AYamllintCheck",
"AYapfCheck",
"base",
"bazel",
"checker",
"extensions",
"flake8",
Expand Down
12 changes: 11 additions & 1 deletion envoy.code.check/envoy/code/check/abstract/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

import asyncio
import pathlib
import shutil
from concurrent import futures
from typing import Dict, List, Optional, Set

import abstracts

from aio.core import event
from aio.core import event, subprocess
from aio.core.directory import ADirectory
from aio.core.functional import async_property

Expand Down Expand Up @@ -35,6 +37,14 @@ def __init__(
def binaries(self):
return self._binaries

def command_path(self, command_name: str) -> pathlib.Path:
if command_name in self.binaries:
return pathlib.Path(self.binaries[command_name]).absolute()
if command := shutil.which(command_name):
return pathlib.Path(command)
raise subprocess.exceptions.OSCommandError(
f"Unable to find {command_name} command")


@abstracts.implementer(interface.IFileCodeCheck)
class AFileCodeCheck(ACodeCheck, metaclass=abstracts.Abstraction):
Expand Down
Loading