Skip to content

Commit

Permalink
Merge branch 'main' into add-isort-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
samriddhi99 authored Aug 8, 2024
2 parents 1eca625 + 5354a0a commit 3ca50f3
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build & test

on: [push]
on:
push:
pull_request:

jobs:
run_test:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Linting

on: [push]

on:
push:
pull_request:

jobs:
black:
runs-on: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions src/tirith/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from tirith.logging import setup_logging
from tirith.prettyprinter import pretty_print_result_dict
from tirith.status import ExitStatus
from tirith import __version__

from .core import start_policy_evaluation

# TODO: Use at least __name__ for the logger name
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def eprint(*args, **kwargs):
Expand Down Expand Up @@ -84,7 +85,7 @@ def __init__(self, prog="PROG") -> None:
action="store_true",
help="Show detailed logs of from the run",
)
parser.add_argument("--version", action="version", version="1.0.0-beta.12")
parser.add_argument("--version", action="version", version=__version__)

args = parser.parse_args()

Expand Down
4 changes: 2 additions & 2 deletions src/tirith/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from ..providers import PROVIDERS_DICT
from .evaluators import EVALUATORS_DICT

# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def get_evaluator_inputs_from_provider_inputs(provider_inputs, provider_module, input_data):
Expand Down
5 changes: 2 additions & 3 deletions src/tirith/core/evaluators/contained_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


# Checks if :attr: `evaluator_input` is contained in :attr:`evaluator_data`.

Expand Down
5 changes: 2 additions & 3 deletions src/tirith/core/evaluators/contains.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


# Checks if :attr: `evaluator_input` is contained in :attr:`evaluator_data`.

Expand Down
5 changes: 2 additions & 3 deletions src/tirith/core/evaluators/equals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


# Checks if :attr:`value` is equal to :attr:`other`. Automatically casts values to the same type if possible.

Expand Down
6 changes: 3 additions & 3 deletions src/tirith/core/evaluators/not_contained_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


# Checks if :attr: `evaluator_input` is not contained in :attr:`evaluator_data`.

Expand Down
6 changes: 3 additions & 3 deletions src/tirith/core/evaluators/not_contains.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


# Checks if :attr: `evaluator_input` does not contain :attr:`evaluator_data`.

Expand Down
5 changes: 2 additions & 3 deletions src/tirith/core/evaluators/not_equals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

from tirith.utils import sort_collections

from .base_evaluator import BaseEvaluator

# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


# Checks if :attr:`value` is not equal to :attr:`other`. Automatically casts values to the same type if possible.

Expand Down
2 changes: 1 addition & 1 deletion src/tirith/prettyprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def pretty_print_result_dict(final_result_dict: Dict) -> None:
print(TermStyle.fail(f"Check: {check_id}"))
print(f" {TermStyle.fail('FAILED')}")
num_failed_checks += 1
print(" Results:")


for result_num, result_dict in enumerate(check_dict["result"]):
result_message = result_dict["message"]
Expand Down
3 changes: 1 addition & 2 deletions src/tirith/providers/infracost/handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

# TODO: Add at least __name__ as the name of the logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


def __get_all_costs(operation_type, input_data):
Expand Down
4 changes: 2 additions & 2 deletions src/tirith/providers/sg_workflow/handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

# TODO: Add at least __name__ as the name of the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def __getValue(key, data):
Expand Down
2 changes: 1 addition & 1 deletion src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _get_exp_attribute(split_expressions, input_data):
final_data.append(val)
return final_data


def provide(provider_inputs, input_data):
# """Provides the value of the attribute from the input_data"""
outputs = []
Expand Down
2 changes: 1 addition & 1 deletion src/tirith/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

logger = logging.getLogger()
logger = logging.getLogger(__name__)


def sort_collections(inputs):
Expand Down

0 comments on commit 3ca50f3

Please sign in to comment.