Skip to content

Commit

Permalink
feat(github): add contrib-lint.yaml workflow (#299)
Browse files Browse the repository at this point in the history
PR: #299
  • Loading branch information
OmarAlJarrah authored Dec 12, 2023
1 parent 7023135 commit 7fc8520
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Quality Checks
name: Code Quality Checks
on: push
jobs:
flake8-lint:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/contribution-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2022 Expedia, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Contribution Quality Checks
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
- review_requested
- auto_merge_enabled
push:
branches: '*'
jobs:
contribution-lint:
name: Contribution Details Validation
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Install Dependencies
run: npm install @commitlint/config-conventional
- name: Run Pull Request Title Validation
uses: JulienKode/pull-request-name-linter-action@v0.5.0
- name: Run Latest Commit Message Validation
uses: wagoid/commitlint-github-action@v5
with:
commitDepth: 1
1 change: 1 addition & 0 deletions .github/workflows/validate-test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ name: Test Coverage Validation
on: push
jobs:
validate-coverage:
name: Test Coverage Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
12 changes: 4 additions & 8 deletions expediagroup/sdk/core/constant/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@

NEW_TOKEN_EXPIRATION_TEMPLATE: str = "New token expires in {0} seconds"

HTTP_HEADERS_LOG_MESSAGE_TEMPLATE: str = dedent(
"""\tHeaders:
HTTP_HEADERS_LOG_MESSAGE_TEMPLATE: str = dedent("""\tHeaders:
\t--- BEGIN ---
{0}
\t--- END ---
"""
)
""")

HTTP_BODY_LOG_MESSAGE_TEMPLATE: str = dedent(
"""
HTTP_BODY_LOG_MESSAGE_TEMPLATE: str = dedent("""
\tBody:
\t--- BEGIN ---
{0}
\t--- END ---
"""
)
""")
1 change: 1 addition & 0 deletions expediagroup/sdk/docsgen/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MarkdownRenderer:
resolvers (dict[str, Any]): A dictionary of resolver functions to assist in rendering.
master_filename (str): The filename for the master documentation file.
"""

master: Master
modules: list[Module]
environment: Environment
Expand Down
1 change: 1 addition & 0 deletions expediagroup/sdk/generator/client/visitors/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Alias:
order(int): A value used in sorting alias position among other aliases, depending on its position in the
inheritance hierarchy.
"""

parent_classname: str
children_classnames: list[str]
order: int = 1
Expand Down
16 changes: 4 additions & 12 deletions release/fraudPreventionV2/src/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def __init__(self, client_config: ClientConfig):

self.__user_agent = f"{sdk_metadata} (Python {python_version}; {os_name} {os_version})"

def screen_account(
self, transaction_id: UUID = uuid4(), body: AccountScreenRequest = None
) -> Union[
def screen_account(self, transaction_id: UUID = uuid4(), body: AccountScreenRequest = None) -> Union[
AccountScreenResponse,
AccountTakeoverBadRequestError,
AccountTakeoverUnauthorizedError,
Expand Down Expand Up @@ -149,9 +147,7 @@ def screen_account(
error_responses=error_responses,
)

def notify_with_account_update(
self, transaction_id: UUID = uuid4(), body: AccountUpdateRequest = None
) -> Union[
def notify_with_account_update(self, transaction_id: UUID = uuid4(), body: AccountUpdateRequest = None) -> Union[
AccountUpdateResponse,
AccountTakeoverBadRequestError,
AccountTakeoverUnauthorizedError,
Expand Down Expand Up @@ -215,9 +211,7 @@ def notify_with_account_update(
error_responses=error_responses,
)

def screen_order(
self, transaction_id: UUID = uuid4(), body: OrderPurchaseScreenRequest = None
) -> Union[
def screen_order(self, transaction_id: UUID = uuid4(), body: OrderPurchaseScreenRequest = None) -> Union[
OrderPurchaseScreenResponse,
BadRequestError,
UnauthorizedError,
Expand Down Expand Up @@ -279,9 +273,7 @@ def screen_order(
error_responses=error_responses,
)

def notify_with_order_update(
self, transaction_id: UUID = uuid4(), body: OrderPurchaseUpdateRequest = None
) -> Union[
def notify_with_order_update(self, transaction_id: UUID = uuid4(), body: OrderPurchaseUpdateRequest = None) -> Union[
OrderPurchaseUpdateResponse,
BadRequestError,
UnauthorizedError,
Expand Down
15 changes: 15 additions & 0 deletions release/fraudPreventionV2/src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2793,76 +2793,91 @@ class OrderPurchaseScreenRequest(

class ExpediaGroupForbiddenErrorException(ExpediaGroupApiException):
r"""Exception wrapping a ForbiddenError object."""

pass


class ExpediaGroupOrderPurchaseUpdateNotFoundErrorException(ExpediaGroupApiException):
r"""Exception wrapping a OrderPurchaseUpdateNotFoundError object."""

pass


class ExpediaGroupGatewayTimeoutErrorException(ExpediaGroupApiException):
r"""Exception wrapping a GatewayTimeoutError object."""

pass


class ExpediaGroupBadRequestErrorException(ExpediaGroupApiException):
r"""Exception wrapping a BadRequestError object."""

pass


class ExpediaGroupAccountTakeoverUnauthorizedErrorException(ExpediaGroupApiException):
r"""Exception wrapping a AccountTakeoverUnauthorizedError object."""

pass


class ExpediaGroupAccountUpdateNotFoundErrorException(ExpediaGroupApiException):
r"""Exception wrapping a AccountUpdateNotFoundError object."""

pass


class ExpediaGroupTooManyRequestsErrorException(ExpediaGroupApiException):
r"""Exception wrapping a TooManyRequestsError object."""

pass


class ExpediaGroupServiceUnavailableErrorException(ExpediaGroupApiException):
r"""Exception wrapping a ServiceUnavailableError object."""

pass


class ExpediaGroupUnauthorizedErrorException(ExpediaGroupApiException):
r"""Exception wrapping a UnauthorizedError object."""

pass


class ExpediaGroupAccountTakeoverBadRequestErrorException(ExpediaGroupApiException):
r"""Exception wrapping a AccountTakeoverBadRequestError object."""

pass


class ExpediaGroupNotFoundErrorException(ExpediaGroupApiException):
r"""Exception wrapping a NotFoundError object."""

pass


class ExpediaGroupRetryableOrderPurchaseScreenFailureException(ExpediaGroupApiException):
r"""Exception wrapping a RetryableOrderPurchaseScreenFailure object."""

pass


class ExpediaGroupRetryableOrderPurchaseUpdateFailureException(ExpediaGroupApiException):
r"""Exception wrapping a RetryableOrderPurchaseUpdateFailure object."""

pass


class ExpediaGroupBadGatewayErrorException(ExpediaGroupApiException):
r"""Exception wrapping a BadGatewayError object."""

pass


class ExpediaGroupInternalServerErrorException(ExpediaGroupApiException):
r"""Exception wrapping a InternalServerError object."""

pass


Expand Down
12 changes: 4 additions & 8 deletions validate_test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,19 @@
from prettytable import PrettyTable

MINIMUM_REQUIRED_COVERAGE_PERCENTAGE: int = 90
FAILURE_MESSAGE_TEMPLATE: str = dedent(
"""
FAILURE_MESSAGE_TEMPLATE: str = dedent("""
> Coverage Validation Failed!
>> Minimum Required Total Coverage Percentage: {0}%
>> Current Total Coverage Percentage: {1}%
>>> Full Coverage Report:
{2}
"""
)
SUCCESS_MESSAGE_TEMPLATE: str = dedent(
"""
""")
SUCCESS_MESSAGE_TEMPLATE: str = dedent("""
> Coverage Validation Succeed!
>> Current Total Coverage Percentage: {0}%
>>> Full Coverage Report:
{1}
"""
)
""")


def validate_test_coverage(report: dict):
Expand Down

0 comments on commit 7fc8520

Please sign in to comment.