Skip to content
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
21 changes: 18 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
repos:
- repo: git@github.com:Yelp/detect-secrets
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0 # last version to support py36
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
exclude: .(svg|ipynb)$
- id: fix-encoding-pragma
args: [--remove]
- id: no-commit-to-branch
args: [--branch, develop, --branch, master, --pattern, release/.*]
- id: pretty-format-json
args: [--autofix]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: git@github.com:Yelp/detect-secrets
rev: v0.13.0
hooks:
- id: detect-secrets
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']

2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ pipeline {
}
}
}
}
}
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Sample usage:

```python
from queueclient import InMemoryQueueClient

q = InMemoryQueueClient(queue_id='uuid')

# msg can be any python object
q.enqueue(msg="message")

# from worker
msg = q.dequeue()
assert msg == "message"
Expand All @@ -33,7 +33,7 @@ Sample usage:

```python
from queueclient import DepotQueueClient

q = DepotQueueClient(host="depot.service.consul", queue_id="uuid")
assert q.status() is True

Expand All @@ -43,7 +43,7 @@ Sample usage:

```python
from queueclient import DepotQueueClient

q = DepotQueueClient(host="depot.service.consul", queue_id="uuid")

# retrieve previous message
Expand All @@ -61,28 +61,28 @@ Sample usage:
```python
import json
from queueclient import RabbitMQClient

# requires a custom call back function, and assumes body is a json object
def consumer_callback(body):
msg = json.loads(body)

assert msg
assert msg["did"] == "AAAAA"
assert msg["size"] == 123

q = RabbitMQClient(host="localhost", port=5672, vhost="/", queue_id="qid", username="guest", password="guest")
response = q.enqueue(msg=dict(did="AAAAA", size=123))
assert response is True

# this line blocks, call q.close() to cancel
q.consume(consumer_callback)
```


## Setup pre-commit hook to check for secrets

We use [pre-commit](https://pre-commit.com/) to setup pre-commit hooks for this repo.
We use [detect-secrets](https://github.com/Yelp/detect-secrets) to search for secrets being committed into the repo.
We use [detect-secrets](https://github.com/Yelp/detect-secrets) to search for secrets being committed into the repo.

To install the pre-commit hook, run
```
Expand All @@ -94,7 +94,7 @@ To update the .secrets.baseline file run
detect-secrets scan --update .secrets.baseline
```

`.secrets.baseline` contains all the string that were caught by detect-secrets but are not stored in plain text. Audit the baseline to view the secrets .
`.secrets.baseline` contains all the string that were caught by detect-secrets but are not stored in plain text. Audit the baseline to view the secrets .

```
detect-secrets audit .secrets.baseline
Expand All @@ -107,7 +107,7 @@ $ sudo apt install rabbitmq-server
```

run tests via tox
```bash
```bash
$ tox
```

Expand Down