Skip to content

Commit 962521e

Browse files
authored
Merge pull request #463 from Shopify/paulinakhew-initialize-pre-commit
Add pre-commit with end-of-file-fixer hook
2 parents 1d74c2c + e358d3f commit 962521e

31 files changed

+53
-30
lines changed

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/[email protected]
15+
with:
16+
extra_args: end-of-file-fixer --all-files

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.4.0
6+
hooks:
7+
- id: end-of-file-fixer

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ next_url = page1.next_page_url
196196
page2 = shopify.Product.find(from_=next_url)
197197
```
198198

199+
## Set up pre-commit locally [OPTIONAL]
200+
[Pre-commit](https://pre-commit.com/) is set up as a GitHub action that runs on pull requests and pushes to the `master` branch. If you want to run pre-commit locally, install it and set up the git hook scripts
201+
```shell
202+
pip install -r requirements.txt
203+
pre-commit install
204+
```
205+
199206
## Limitations
200207

201208
Currently there is no support for:

test/api_version_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ def test_two_release_versions_with_same_number_are_equal(self):
4242
version1 = shopify.Release('2019-01')
4343
version2 = shopify.Release('2019-01')
4444
self.assertEqual(version1, version2)
45-

test/currency_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ def test_get_currencies(self):
2020
self.assertEqual("HKD", currencies[3].currency)
2121
self.assertEqual("2018-10-03T14:44:08-04:00", currencies[3].rate_updated_at)
2222
self.assertEqual(False, currencies[3].enabled)
23-

test/discount_code_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,3 @@ def test_delete_a_specific_discount_code(self):
2828
self.fake('price_rules/1213131/discount_codes/34', method='DELETE', body='destroyed')
2929
self.discount_code.destroy()
3030
self.assertEqual('DELETE', self.http.request.get_method())
31-
32-
33-

test/event_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ def test_prefix_uses_resource(self):
99
def test_prefix_doesnt_need_resource(self):
1010
prefix = shopify.Event._prefix()
1111
self.assertEqual("https://this-is-my-test-show.myshopify.com/admin/api/unstable", prefix)
12-

test/fixtures/access_scopes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
"handle": "read_orders"
1111
}
1212
]
13-
}
13+
}

test/fixtures/api_version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"apis":[{"handle":"admin","versions":[{"handle":"2019-04","latest_supported":false,"display_name":"2019-04 (Unsupported)","supported":true},{"handle":"2019-07","latest_supported":false,"display_name":"2019-07 (Unsupported)","supported":true},{"handle":"2019-10","latest_supported":false,"display_name":"2019-10 (Unsupported)","supported":true},{"handle":"2020-01","latest_supported":false,"display_name":"2020-01","supported":true},{"handle":"2020-04","latest_supported":false,"display_name":"2020-04","supported":true},{"handle":"2020-07","latest_supported":false,"display_name":"2020-07","supported":true},{"handle":"2020-10","latest_supported":true,"display_name":"2020-10 (Latest)","supported":true},{"handle":"2021-01","latest_supported":false,"display_name":"2021-01 (Release candidate)","supported":false},{"handle":"unstable","latest_supported":false,"display_name":"unstable","supported":false}]},{"handle":"storefront","versions":[{"handle":"2019-07","latest_supported":false,"display_name":"2019-07 (Unsupported)","supported":true},{"handle":"2019-10","latest_supported":false,"display_name":"2019-10 (Unsupported)","supported":true},{"handle":"2020-01","latest_supported":false,"display_name":"2020-01","supported":true},{"handle":"2020-04","latest_supported":false,"display_name":"2020-04","supported":true},{"handle":"2020-07","latest_supported":false,"display_name":"2020-07","supported":true},{"handle":"2020-10","latest_supported":true,"display_name":"2020-10 (Latest)","supported":true},{"handle":"2021-01","latest_supported":false,"display_name":"2021-01 (Release candidate)","supported":false},{"handle":"unstable","latest_supported":false,"display_name":"unstable","supported":false}]}]}
1+
{"apis":[{"handle":"admin","versions":[{"handle":"2019-04","latest_supported":false,"display_name":"2019-04 (Unsupported)","supported":true},{"handle":"2019-07","latest_supported":false,"display_name":"2019-07 (Unsupported)","supported":true},{"handle":"2019-10","latest_supported":false,"display_name":"2019-10 (Unsupported)","supported":true},{"handle":"2020-01","latest_supported":false,"display_name":"2020-01","supported":true},{"handle":"2020-04","latest_supported":false,"display_name":"2020-04","supported":true},{"handle":"2020-07","latest_supported":false,"display_name":"2020-07","supported":true},{"handle":"2020-10","latest_supported":true,"display_name":"2020-10 (Latest)","supported":true},{"handle":"2021-01","latest_supported":false,"display_name":"2021-01 (Release candidate)","supported":false},{"handle":"unstable","latest_supported":false,"display_name":"unstable","supported":false}]},{"handle":"storefront","versions":[{"handle":"2019-07","latest_supported":false,"display_name":"2019-07 (Unsupported)","supported":true},{"handle":"2019-10","latest_supported":false,"display_name":"2019-10 (Unsupported)","supported":true},{"handle":"2020-01","latest_supported":false,"display_name":"2020-01","supported":true},{"handle":"2020-04","latest_supported":false,"display_name":"2020-04","supported":true},{"handle":"2020-07","latest_supported":false,"display_name":"2020-07","supported":true},{"handle":"2020-10","latest_supported":true,"display_name":"2020-10 (Latest)","supported":true},{"handle":"2021-01","latest_supported":false,"display_name":"2021-01 (Release candidate)","supported":false},{"handle":"unstable","latest_supported":false,"display_name":"unstable","supported":false}]}]}

test/fixtures/article.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"user_id": null,
1313
"tags": "consequuntur, cupiditate, repellendus"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)