Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor imports and fix oxo should exit once the scan has completed #783

Closed
wants to merge 13 commits into from
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ serve =
[options.entry_points]
# Add here console scripts like:
console_scripts =
ostorlab = ostorlab:main
oxo = ostorlab:main
ostorlab = ostorlab.main:main
oxo = ostorlab.main:main
pytest11 =
pytest_ostorlab = ostorlab.testing.agent

Expand Down
28 changes: 0 additions & 28 deletions src/ostorlab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
"""Ostorlab main package."""

import logging

import click
from ostorlab.cli.rootcli import rootcli
from rich import console
from rich import logging as rich_logging

FORMAT = "%(message)s"
logging.basicConfig(
level="ERROR",
format=FORMAT,
datefmt="[%X]",
handlers=[
rich_logging.RichHandler(
rich_tracebacks=True,
console=console.Console(width=255),
tracebacks_suppress=[click],
)
],
)

logger = logging.getLogger("CLI")


def main():
rootcli(None)
29 changes: 26 additions & 3 deletions src/ostorlab/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
"""Run main function."""
"""Ostorlab main package."""

import ostorlab
import logging

Check warning on line 3 in src/ostorlab/main.py

View check run for this annotation

Codecov / codecov/patch

src/ostorlab/main.py#L3

Added line #L3 was not covered by tests

ostorlab.main()
import click
from ostorlab.cli.rootcli import rootcli
from rich import console
from rich import logging as rich_logging

Check warning on line 8 in src/ostorlab/main.py

View check run for this annotation

Codecov / codecov/patch

src/ostorlab/main.py#L5-L8

Added lines #L5 - L8 were not covered by tests

FORMAT = "%(message)s"
logging.basicConfig(

Check warning on line 11 in src/ostorlab/main.py

View check run for this annotation

Codecov / codecov/patch

src/ostorlab/main.py#L10-L11

Added lines #L10 - L11 were not covered by tests
level="ERROR",
format=FORMAT,
datefmt="[%X]",
handlers=[
rich_logging.RichHandler(
rich_tracebacks=True,
console=console.Console(width=255),
tracebacks_suppress=[click],
)
],
)

logger = logging.getLogger("CLI")

Check warning on line 24 in src/ostorlab/main.py

View check run for this annotation

Codecov / codecov/patch

src/ostorlab/main.py#L24

Added line #L24 was not covered by tests


def main():
rootcli(None)

Check warning on line 28 in src/ostorlab/main.py

View check run for this annotation

Codecov / codecov/patch

src/ostorlab/main.py#L27-L28

Added lines #L27 - L28 were not covered by tests