Skip to content

Commit b121c96

Browse files
committed
Formatting and linting improvements. (#887)
* Add black for code formatting. Remove some linting exclusions. Fix errors. * Fix path. * Don't install quality_checks package. * Fix commands. * Update pre-commit script. * Add lint-staged to lint and format staged files only. * Add husky to manage commit hooks. * Add prettier for MD / YAML / JSON formatting. * Resolve some Sonar warnings. * Add .prettierignore and run prettier on all supported files. * Revert auto formatting of jsc files. * Fix lint error. * Format Terraform.
1 parent 0b3c4e0 commit b121c96

File tree

377 files changed

+12783
-14987
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+12783
-14987
lines changed

.editorconfig

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@ end_of_line = lf
1111
[Makefile]
1212
indent_style = tab
1313

14-
[*.{xml,js,json,yaml}]
14+
[*.{xml,js,json,yaml,yml}]
1515
indent_size = 2
1616

1717
[*.postman_collection.json]
1818
indent_style = tab
19-
20-
[*.yaml]
21-
trim_trailing_whitespace = false
22-
23-
[*.js]
24-
ij_javascript_force_semicolon_style = true
25-
ij_javascript_use_semicolon_after_statement = false
26-
27-
[*.md]
28-
trim_trailing_whitespace = false
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser: [e.g. chrome, safari]
29-
- Version: [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser: [e.g. chrome, safari]
30+
- Version: [e.g. 22]
3031

3132
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser: [e.g. stock browser, safari]
35-
- Version: [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser: [e.g. stock browser, safari]
37+
- Version: [e.g. 22]
3638

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

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/pull_request_template.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
## Summary
2-
* Routine Change
3-
* :exclamation: Breaking Change
4-
* :robot: Operational or Infrastructure Change
5-
* :sparkles: New Feature
6-
* :warning: Potential issues that might be caused by this change
72

8-
Add any other relevant notes or explanations here. **Remove this line if you have nothing to add.**
3+
- Routine Change
4+
- :exclamation: Breaking Change
5+
- :robot: Operational or Infrastructure Change
6+
- :sparkles: New Feature
7+
- :warning: Potential issues that might be caused by this change
98

9+
Add any other relevant notes or explanations here. **Remove this line if you have nothing to add.**
1010

1111
## Reviews Required
12-
* [x] Dev
13-
* [ ] Test
14-
* [ ] Tech Author
15-
* [ ] Product Owner
1612

13+
- [x] Dev
14+
- [ ] Test
15+
- [ ] Tech Author
16+
- [ ] Product Owner
1717

1818
## Review Checklist
19+
1920
:information_source: This section is to be filled in by the **reviewer**.
2021

21-
* [ ] I have reviewed the changes in this PR and they fill all or part of the acceptance criteria of the ticket, and the code is in a mergeable state.
22-
* [ ] If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work.
23-
* [ ] I have ensured the changelog has been updated by the submitter, if necessary.
22+
- [ ] I have reviewed the changes in this PR and they fill all or part of the acceptance criteria of the ticket, and the code is in a mergeable state.
23+
- [ ] If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work.
24+
- [ ] I have ensured the changelog has been updated by the submitter, if necessary.

.github/workflows/create-release-tag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v5
1414
with:
15-
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
15+
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
1616

1717
- name: Install Python 3.9
1818
uses: actions/setup-python@v6
1919
with:
2020
python-version: 3.9
2121

2222
- name: Upgrade python pip
23-
run: python -m pip install --upgrade pip
23+
run: python -m pip install --upgrade pip
2424

2525
- name: Install git
2626
run: pip install gitpython

.github/workflows/deploy-backend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ jobs:
136136
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
137137
with:
138138
python-version: 3.11
139-
cache: 'poetry'
139+
cache: "poetry"
140140

141141
- name: Create MNS Subscription
142142
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
143-
working-directory: './lambdas/mns_subscription'
143+
working-directory: "./lambdas/mns_subscription"
144144
env:
145145
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
146146
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}

.github/workflows/pr-teardown.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
permissions:
2424
id-token: write
2525
contents: read
26-
26+
2727
steps:
2828
- name: Connect to AWS
2929
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Checkout
3939
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
40-
40+
4141
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
4242
with:
4343
terraform_version: "1.12.2"
@@ -55,10 +55,10 @@ jobs:
5555
- uses: actions/setup-python@v6
5656
with:
5757
python-version: 3.11
58-
cache: 'poetry'
58+
cache: "poetry"
5959

6060
- name: Unsubscribe MNS
61-
working-directory: './lambdas/mns_subscription'
61+
working-directory: "./lambdas/mns_subscription"
6262
env:
6363
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}
6464
run: |

.github/workflows/quality-checks.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ env:
1212
LAMBDA_PATH: ${{ github.workspace }}/lambdas
1313

1414
jobs:
15-
lint:
16-
name: Lint specification and Python projects
15+
lint-specification:
16+
name: Lint specification
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v5
21+
22+
- uses: actions/setup-node@v5
23+
with:
24+
node-version: "23.11.0"
25+
cache: "npm"
26+
27+
- name: Install linting dependencies
28+
run: make install-node
29+
30+
- name: Lint
31+
run: make lint
32+
33+
lint-python:
34+
name: Lint Python projects
1735
runs-on: ubuntu-latest
1836

1937
steps:
@@ -22,23 +40,22 @@ jobs:
2240
- name: Install poetry
2341
run: pip install poetry==2.1.4
2442

25-
# Base linting requires 3.8 due to APIM package dependencies. See root README for details under linting.
26-
# Consider upgrading this and poetry deps if we move away from Azure DevOps to using the Proxygen tool.
2743
- uses: actions/setup-python@v6
2844
with:
29-
python-version: 3.8
30-
cache: 'poetry'
31-
32-
- uses: actions/setup-node@v5
33-
with:
34-
node-version: '23.11.0'
35-
cache: 'npm'
45+
python-version: 3.11
46+
cache: "poetry"
3647

3748
- name: Install linting dependencies
38-
run: make install-node && poetry install --no-root
49+
run: poetry install --no-root
50+
working-directory: quality_checks
3951

4052
- name: Lint
41-
run: make lint
53+
run: poetry run make lint
54+
working-directory: quality_checks
55+
56+
- name: Check formatting
57+
run: poetry run make format-check
58+
working-directory: quality_checks
4259

4360
testcoverage_and_sonarcloud:
4461
name: Test Coverage and SonarCloud
@@ -53,7 +70,7 @@ jobs:
5370
- uses: actions/setup-python@v6
5471
with:
5572
python-version: 3.11
56-
cache: 'poetry'
73+
cache: "poetry"
5774

5875
- name: Set up AWS credentials
5976
env:
@@ -110,7 +127,7 @@ jobs:
110127
working-directory: delta_backend
111128
id: delta
112129
env:
113-
PYTHONPATH: delta_backend/src:delta_backend/tests
130+
PYTHONPATH: delta_backend/src:delta_backend/tests
114131
continue-on-error: true
115132
run: |
116133
poetry install
@@ -144,9 +161,9 @@ jobs:
144161
PYTHONPATH: ${{ env.LAMBDA_PATH }}/ack_backend/src:${{ github.workspace }}/ack_backend/tests
145162
continue-on-error: true
146163
run: |
147-
poetry install
148-
poetry run coverage run --source=src -m unittest discover || echo "ack-lambda tests failed" >> ../../failed_tests.txt
149-
poetry run coverage xml -o ../../ack-lambda-coverage.xml
164+
poetry install
165+
poetry run coverage run --source=src -m unittest discover || echo "ack-lambda tests failed" >> ../../failed_tests.txt
166+
poetry run coverage xml -o ../../ack-lambda-coverage.xml
150167
151168
- name: Run unittest with coverage-mns-subscription
152169
working-directory: lambdas/mns_subscription

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a template, not a valid YAML file
2+
/manifest_template.yml
3+
4+
# We hit compile errors in Apigee if these are auto formatted
5+
# TODO - investigate
6+
/proxies/live/apiproxy/resources/jsc/
7+
/proxies/sandbox/apiproxy/resources/jsc/

0 commit comments

Comments
 (0)