Skip to content

Commit

Permalink
Merge branch 'StackGuardian:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kushal9897 authored Oct 22, 2024
2 parents 52c88b3 + 5eef345 commit e5b660d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pydosctyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint and Test

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydocstyle
- name: Run pydocstyle
run: |
pydocstyle
2 changes: 2 additions & 0 deletions .pydocstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pydocstyle]
ignore = D203,D213,D406,D407,D415,D100,D101,D102,D103,D104,D107,D200,D205,D212,D400,D401,D402,D404
11 changes: 11 additions & 0 deletions src/tirith/logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Sets up logging configuration for the application.
"""

import logging
import logging.config
import sys
Expand Down Expand Up @@ -38,6 +42,13 @@


def setup_logging(verbose: bool = False):
"""
Set up logging configuration.
:param verbose: If set to `True` will log all messages higher than DEBUG
level, otherwise it will log the messages that are higher
than INFO level ('INFO', 'WARNING', 'CRITICAL')
"""
if verbose:
DEFAULT_LOGGING_CONFIG["root"]["handlers"] = ["console_stderr_verbose"]
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
8 changes: 4 additions & 4 deletions src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def provider_config_operator(input_data: dict, provider_inputs: dict, outputs: l
outputs.append(
{
"value": ProviderError(severity_value=99),
"err": "`terraform_provider_full_name` must be provided in the provider input (severity_value: 99))",
"err": "`terraform_provider_full_name` must be provided in the provider input (severity_value: 99)",
}
)
return
Expand Down Expand Up @@ -274,7 +274,7 @@ def direct_dependencies_operator(input_data: dict, provider_inputs: dict, output
outputs.append(
{
"value": ProviderError(severity_value=99),
"err": "`terraform_resource_type` must be provided in the provider input (severity_value: 99))",
"err": "`terraform_resource_type` must be provided in the provider input (severity_value: 99)",
}
)
return
Expand Down Expand Up @@ -453,7 +453,7 @@ def direct_references_operator(input_data: dict, provider_inputs: dict, outputs:
outputs.append(
{
"value": ProviderError(severity_value=99),
"err": "Only one of `referenced_by` or `references_to` must be provided in the provider input (severity_value: 99))",
"err": "Only one of `referenced_by` or `references_to` must be provided in the provider input (severity_value: 99)",
}
)
return
Expand All @@ -471,7 +471,7 @@ def direct_references_operator(input_data: dict, provider_inputs: dict, outputs:
outputs.append(
{
"value": ProviderError(severity_value=99),
"err": "`terraform_resource_type` must be provided in the provider input (severity_value: 99))",
"err": "`terraform_resource_type` must be provided in the provider input (severity_value: 99)",
}
)
return
Expand Down
2 changes: 1 addition & 1 deletion tests/providers/terraform_plan/test_direct_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_direct_references_to_and_by_should_raise_error():
"Only one of `referenced_by` or "
"`references_to` must be provided in "
"the provider input (severity_value: "
"99))"
"99)"
)


Expand Down

0 comments on commit e5b660d

Please sign in to comment.