Skip to content

Commit

Permalink
Merge pull request #16 from Sachinbisht27/feature/adding-pre-commit
Browse files Browse the repository at this point in the history
Fixed code standared violation fixes
  • Loading branch information
Sachinbisht27 authored May 8, 2024
2 parents e048735 + ade125f commit 811cf03
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 21 deletions.
33 changes: 16 additions & 17 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
title: "[BUG] "
labels: bug
assignees: Sachinbisht27

---

Expand All @@ -12,27 +12,26 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
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.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Environment (please complete the following information):**
- Webhook Payload ``` here```
- Environment - Production/Staging/other

**Additional context**
Add any other context about the problem here.

**Acceptance Criteria**
Add acceptance criteria here.

**Documentation**
Add whatever documentation will be required here.
12 changes: 9 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
title: "[FEATURE] "
labels: enhancement
assignees: Sachinbisht27

---

Expand All @@ -18,3 +18,9 @@ A clear and concise description of any alternative solutions or features you've

**Additional context**
Add any other context or screenshots about the feature request here.

**Acceptance Criteria**
Add acceptance criteria here.

**Documentation**
Add whatever documentation will be required here.
37 changes: 37 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- Pull Request Title Guidelines -->
<!--
Please follow the format: #<issue_id> <Title>
- <issue_id>: Id of the issue for which the PR belongs to (e.g., #1023)
- <Title>: A brief summary of the change (e.g., Add user authentication functionality)
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
- [ ] I have documented my code wherever required.
- [ ] The changes requires a change to the documentation.
- [ ] I have updated the documentation based on the my changes.
- [ ] I have added tests to cover my changes (if not applicable, please state why)
- [ ] All new and existing tests are passing.
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: pre-commit

on:
pull_request:
push:
branches:
- develop
- main
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ exclude: "^\
"

repos:
- 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
rev: 24.4.2
hooks:
- id: black
args: [--line-length=88]
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- 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/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down
3 changes: 3 additions & 0 deletions app/services/budget_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ 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 @@ -25,5 +25,5 @@ def send_alert(self, slack_block):
logger.info("Alert Sent")
return True
except Exception as e:
logger.error(f"Exception occurred:{e}")
logger.error(f"Exception occurred:{e}. Response: {response}")
return False

0 comments on commit 811cf03

Please sign in to comment.