ci: format the GameDB and make sure it stays that way

This commit is contained in:
Tyler Wilding 2022-05-22 21:10:47 -04:00 committed by refractionpcsx2
parent b54facdbd8
commit 9ba42ec950
4 changed files with 48 additions and 39 deletions

View File

@ -14,6 +14,7 @@ on:
jobs: jobs:
lint: lint:
name: Lint and Validate GameDB
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
@ -30,4 +31,4 @@ jobs:
- name: Check Formatting - name: Check Formatting
run: | run: |
npm install -g prettier npm install -g prettier
prettier --check ./bin/Resources/GameIndex.yaml prettier --check ./bin/resources/GameIndex.yaml

View File

@ -213,7 +213,7 @@ option_validation_handlers = {
class UniqueKeyLoader(yaml.FullLoader): class UniqueKeyLoader(yaml.FullLoader):
def construct_mapping(self, node, deep=False): def construct_mapping(self, node, deep=False):
mapping = set() mapping = set()
for key_node, value_node in node.value: for key_node, _ in node.value:
key = self.construct_object(key_node, deep=deep) key = self.construct_object(key_node, deep=deep)
if key in mapping: if key in mapping:
raise ValueError(f"Duplicate {key!r} key found in YAML.") raise ValueError(f"Duplicate {key!r} key found in YAML.")

8
.prettierrc.yaml Normal file
View File

@ -0,0 +1,8 @@
overrides:
- files: "**/GameIndex.yaml"
options:
tabWidth: 2
useTabs: false
quoteProps: consistent
endOfLine: auto
proseWrap: preserve