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

Failing pre-commit fixes #21

Merged
merged 5 commits into from
May 21, 2024
Merged
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
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ about: Create a report to help us improve
title: "[BUG] "
labels: bug
assignees: Sachinbisht27

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Set webhook payload '...'
2. Trigger webhook '....'
3. See the error


**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- Webhook Payload ``` here```
- Environment - Production/Staging/other

- Webhook Payload ` here`
- Environment - Production/Staging/other

**Additional context**
Add any other context about the problem here.
Expand Down
9 changes: 3 additions & 6 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---


1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: "[FEATURE] "
labels: enhancement
assignees: Sachinbisht27

---

**Is your feature request related to a problem? Please describe.**
Expand Down
9 changes: 6 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ Example of Pull Request Title: #1023 Add user authentication functionality
-->

#[ISSUE_ID]

<!--- If there is an open issue, please link to the issue here by replacing [ISSUE_ID]-->
<!-- Make sure the PR is against the `develop` branch -->

### Please complete the following steps and check these boxes before filing your PR:


### Types of changes

<!--- What types of changes does your code introduce? -->

- [ ] Bug fix (a change which fixes an issue)
- [ ] New feature (a change which adds functionality)


### Short description of what this resolves:

<!--- Describe your changes in detail -->
<!--- Why these change required? What problem does it solve? -->


### Checklist:

<!--- Mark the checkboxes accordingly. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] I have performed a self-review of my own code.
- [ ] The code follows the style guidelines of this project.
- [ ] The code changes are passing the CI checks
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
58 changes: 31 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,49 @@ exclude: "^\
"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
- id: debug-statements
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
- id: debug-statements
- id: requirements-txt-fixer

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- id: black
args: [--line-length=88]
- repo: https://github.com/PyCQA/flake8

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- id: flake8
exclude: __init__.py
args: [--max-line-length=170]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files # prevents giant files from being committed.
- id: check-case-conflict # checks for files that would conflict in case-insensitive filesystems.
- id: check-merge-conflict # checks for files that contain merge conflict strings.
- id: check-yaml # checks yaml files for parseable syntax.
- id: detect-private-key # detects the presence of private keys.
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline.
- id: fix-byte-order-marker # removes utf-8 byte order marker.
- id: mixed-line-ending # replaces or checks mixed line ending.
- id: requirements-txt-fixer # sorts entries in requirements.txt.
- id: trailing-whitespace # trims trailing whitespace.
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ The microservice is for tracking and monitoring the spending amount at the GCP s

1. Clone the repository
```sh
git clone https://github.com/Sachinbisht27/gcp-budget-alerts-service.git
git clone https://github.com/ColoredCow/gcp-budget-alerts-service.git
```
2. Switch to project folder and setup the vertual environment
```sh
cd gcp-alerts
cd gcp-budget-alerts-service
python -m venv venv
```
3. Activate the virtual environment
Expand Down
3 changes: 1 addition & 2 deletions app/helpers/notification_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Notification Helper Module
"""Notification Helper Module.

This module provides functions for sending notifications.
"""
Expand Down
3 changes: 0 additions & 3 deletions app/services/budget_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ def _parse_interval(self, alert_data):
)
return interval.strftime("%Y-%m-%d %H:%M")

if notify:
self.insert_new_threshold(cost, budget, budget_name, threshold)

def _is_current_month(self, interval_str):
"""Checks if the interval falls within the current month."""
current_year_month = datetime.datetime.utcnow().strftime("%Y-%m")
Expand Down
2 changes: 1 addition & 1 deletion app/services/slack_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):

def send_alert(self, slack_block):
try:
self.slack_client.chat_postMessage(
response = self.slack_client.chat_postMessage(
channel=self.channel_name,
blocks=slack_block["blocks"],
)
Expand Down
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@


def handle(payload, context):
"""
Function to handle billing alerts.
"""Function to handle billing alerts.

Args:
payload (dict): Payload containing alert attributes and data.
Expand Down
4 changes: 0 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
functions-framework==3.2.0
google-cloud-logging==3.5.0
google_cloud_bigquery==3.11.4
werkzeug>=3.0.3
aiohttp>=3.9.4
gunicorn>=22.0.0
pre-commit==2.20.0
python-dotenv==0.20.0
slackclient==2.9.4
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
aiohttp>=3.9.4
functions-framework==3.2.0
google-cloud-logging==3.5.0
google_cloud_bigquery==3.11.4
Werkzeug==3.0.3
gunicorn>=22.0.0
pre-commit==3.6.2
slackclient==2.9.4
Werkzeug==2.3.7
aiohttp>=3.9.4
gunicorn>=22.0.0
Werkzeug==3.0.3
Loading