-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some more linting hooks in the pre-commit
- Loading branch information
1 parent
b979164
commit 9ecdfce
Showing
16 changed files
with
132 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Add env variables here | ||
TESTING= | ||
DATASET_ID= | ||
DATASET_LOCATION= | ||
DEBUG= | ||
SLACK_TOKEN= | ||
SLACK_CHANNEL= | ||
ENVIRONMENT= | ||
DATASET_ID= | ||
TABLE_ID= | ||
GOOGLE_APPLICATION_CREDENTIALS= | ||
DATASET_LOCATION= | ||
SLACK_CHANNEL= | ||
SLACK_TOKEN= | ||
TABLE_ID= | ||
TESTING= |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
exclude: "^\ | ||
(third-party/.*)\ | ||
" | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.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 | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
- 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. | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v4.0.0-alpha.8 | ||
hooks: | ||
- id: prettier | ||
files: \.(js|ts|jsx|tsx|css|less|html|json|markdown|md|yaml|yml)$ | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.2.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: [--profile=black] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v17.0.6 | ||
hooks: | ||
- id: clang-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,50 @@ | ||
# gcp-budget-alerts-service | ||
The micro-service is for tracking and monitoring the spending amount at the GCP service. This micro-service elevates an alert whenever the overall budget surpasses or meets predefined thresholds. | ||
|
||
The microservice is for tracking and monitoring the spending amount at the GCP service. This microservice elevates an alert whenever the overall budget surpasses or meets predefined thresholds. | ||
|
||
## Architecture | ||
|
||
 | ||
<h6 align="center">Architecture for the Alert Service</h6> | ||
|
||
<h6 align="center">Architecture for the Alert Service</h6> | ||
|
||
## Installation Guideline | ||
|
||
### Prerequisite | ||
|
||
1. pyenv | ||
2. python 3.8 | ||
3. A Slack App for delivering messages on the channel. [Setup Guideline](./SLACKAPP.md) | ||
|
||
### Steps | ||
|
||
1. Clone the repository | ||
```sh | ||
git clone https://github.com/Sachinbisht27/gcp-budget-alerts-service.git | ||
``` | ||
```sh | ||
git clone https://github.com/Sachinbisht27/gcp-budget-alerts-service.git | ||
``` | ||
2. Switch to project folder and setup the vertual environment | ||
```sh | ||
cd gcp-alerts | ||
python -m venv venv | ||
``` | ||
```sh | ||
cd gcp-alerts | ||
python -m venv venv | ||
``` | ||
3. Activate the virtual environment | ||
```sh | ||
source ./venv/bin/activate | ||
``` | ||
```sh | ||
source ./venv/bin/activate | ||
``` | ||
4. Install the dependencies: | ||
```sh | ||
pip install -r requirements-dev.txt | ||
``` | ||
```sh | ||
pip install -r requirements-dev.txt | ||
``` | ||
5. Set up your .env file by copying .env.example | ||
```sh | ||
cp .env.example .env | ||
``` | ||
```sh | ||
cp .env.example .env | ||
``` | ||
6. Add/update variables in your `.env` file for your environment. | ||
7. Run the following command to get started with pre-commit | ||
```sh | ||
pre-commit install | ||
``` | ||
```sh | ||
pre-commit install | ||
``` | ||
8. Start the server by following command | ||
```sh | ||
functions_framework --target=handle --debug | ||
``` | ||
```sh | ||
functions_framework --target=handle --debug | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,49 @@ | ||
# Create a Slack App | ||
|
||
# Steps to create an app on Slack | ||
## Steps to create an app on Slack | ||
|
||
1. Go to the channel on which you want to install the app | ||
2. Go to the view all members icon on the top right of the channel | ||
|
||
 | ||
|
||
|
||
3. Click on **add app** option | ||
4. Click on **View app directory** | ||
5. Click on the **build** option at the top right of the menu | ||
6. Create an app from scratch | ||
7. Provide a name to the app and assign it to a workspace | ||
8. Go to OAuth and Permission menu | ||
|
||
 | ||
|
||
|
||
9. Under the scope section, give the app permission to write messages | ||
|
||
 | ||
|
||
|
||
10. Install the app to the workspace | ||
|
||
 | ||
|
||
|
||
11. Give permission to the app | ||
|
||
 | ||
|
||
|
||
12. Once the app is installed copy the OAuth Token as it will be used for authentication. | ||
|
||
 | ||
|
||
|
||
13. Go to the channel where you want to add app. | ||
14. Click on the `channel name` . | ||
15. Click on the integrations tab here. | ||
|
||
 | ||
|
||
|
||
16. Then click on the `Add apps`. | ||
|
||
 | ||
|
||
|
||
17. Then recognize the newly created app and add to the channel. | ||
|
||
 | ||
|
||
|
||
You are done installing the app. Enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
from google.cloud import bigquery | ||
|
||
|
||
client = bigquery.Client() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .slack_service import * | ||
from .budget_service import * | ||
from .slack_service import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.