Skip to content

Commit ac91ab7

Browse files
linting changes (#1748)
Co-authored-by: RamilCDISC <113539111+RamilCDISC@users.noreply.github.com>
1 parent 4c6c46b commit ac91ab7

43 files changed

Lines changed: 634 additions & 289 deletions

Some content is hidden

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

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ exclude = .github,
66
.pytest_cache,
77
cdisc_rules_engine/resources,
88
venv,
9+
.venv,
910
build,
1011
dist

.github/ISSUE_TEMPLATE/1-bug.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ body:
3939
value: https://jira.cdisc.org/projects/CORERULES/issues/CORERULES-
4040
- type: markdown
4141
attributes:
42-
value: "\nIn the next fields, please provide a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)."
42+
value: |
43+
In the next fields, please provide a
44+
[Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example).
4345
- type: input
4446
id: cli_command
4547
validations:

.github/workflows/build-binary.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,46 @@ jobs:
2727
2828
- name: Build Binary (Linux)
2929
if: runner.os == 'Linux'
30-
run: pyinstaller --onedir --contents-directory "." core.py --icon=resources/assets/CORE_logo_sm.ico --dist ./dist/output/${{ inputs.name }} --collect-submodules pyreadstat --add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas --add-data=resources/cache:resources/cache --add-data=resources/templates:resources/templates --add-data=resources/schema:resources/schema --add-data=resources/datasets:resources/datasets --add-data=resources/jsonata:resources/jsonata
30+
run: >-
31+
pyinstaller --onedir --contents-directory "." core.py
32+
--icon=resources/assets/CORE_logo_sm.ico
33+
--dist ./dist/output/${{ inputs.name }}
34+
--collect-submodules pyreadstat
35+
--add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas
36+
--add-data=resources/cache:resources/cache
37+
--add-data=resources/templates:resources/templates
38+
--add-data=resources/schema:resources/schema
39+
--add-data=resources/datasets:resources/datasets
40+
--add-data=resources/jsonata:resources/jsonata
3141
- name: Build Binary (Mac)
3242
if: runner.os == 'macOS'
33-
run: pyinstaller --onedir --contents-directory "." core.py --icon=resources/assets/CORE_logo_sm.icns --dist ./dist/output/${{ inputs.name }} --collect-submodules pyreadstat --add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas --add-data=resources/cache:resources/cache --add-data=resources/templates:resources/templates --add-data=resources/schema:resources/schema --add-data=resources/datasets:resources/datasets --add-data=resources/jsonata:resources/jsonata
43+
run: >-
44+
pyinstaller --onedir --contents-directory "." core.py
45+
--icon=resources/assets/CORE_logo_sm.icns
46+
--dist ./dist/output/${{ inputs.name }}
47+
--collect-submodules pyreadstat
48+
--add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas
49+
--add-data=resources/cache:resources/cache
50+
--add-data=resources/templates:resources/templates
51+
--add-data=resources/schema:resources/schema
52+
--add-data=resources/datasets:resources/datasets
53+
--add-data=resources/jsonata:resources/jsonata
3454
- name: Build Binary (Windows)
3555
if: runner.os == 'Windows'
36-
run: pyinstaller --onedir --contents-directory "." core.py --icon=resources/assets/CORE_logo_sm.ico --dist ./dist/output/${{ inputs.name }} --collect-submodules pyreadstat --add-data="$env:pythonLocation\Lib\site-packages\xmlschema\schemas;xmlschema/schemas" --hidden-import numpy --hidden-import numpy.core._methods --hidden-import numpy.lib.format --add-data="resources/cache;resources/cache" --add-data="resources/templates;resources/templates" --add-data="resources/schema;resources/schema" --add-data="resources/datasets;resources/datasets" --add-data="resources/jsonata;resources/jsonata"
56+
run: >-
57+
pyinstaller --onedir --contents-directory "." core.py
58+
--icon=resources/assets/CORE_logo_sm.ico
59+
--dist ./dist/output/${{ inputs.name }}
60+
--collect-submodules pyreadstat
61+
--add-data="$env:pythonLocation\Lib\site-packages\xmlschema\schemas;xmlschema/schemas"
62+
--hidden-import numpy
63+
--hidden-import numpy.core._methods
64+
--hidden-import numpy.lib.format
65+
--add-data="resources/cache;resources/cache"
66+
--add-data="resources/templates;resources/templates"
67+
--add-data="resources/schema;resources/schema"
68+
--add-data="resources/datasets;resources/datasets"
69+
--add-data="resources/jsonata;resources/jsonata"
3770
- name: Archive Binary
3871
uses: actions/upload-artifact@v6
3972
with:

.github/workflows/check-schema-markdown.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ jobs:
2929
run: |
3030
npm i prettier
3131
npx prettier resources/schema/rule-merged/*.json --write
32-
- uses: CatChen/check-git-status-action@7b45cb4ce3e00a8bce4910dc2d5f2785235a6d7e # v2.1.2
32+
- uses: CatChen/check-git-status-action@7b45cb4ce3e00a8bce4910dc2d5f2785235a6d7e # v2.1.2
3333
with:
3434
fail-if-not-clean: true
3535
request-changes-if-not-clean: ${{ github.event_name == 'pull_request' }}
36-
request-changes-comment: Updated schema has not been merged with markdown descriptions. Please run the "Merge Schema with Markdown Descriptions" workflow to update the merged schema files.
36+
request-changes-comment: >-
37+
Updated schema has not been merged with markdown descriptions.
38+
Please run the "Merge Schema with Markdown Descriptions" workflow
39+
to update the merged schema files.
3740
targets: resources/schema/rule-merged

.github/workflows/deploy-rule-tester.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ permissions:
1616
contents: read
1717

1818
env:
19-
creds: '{"clientId":"${{ vars.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ vars.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ vars.AZURE_TENANT_ID }}"}'
19+
creds: >-
20+
{"clientId":"${{ vars.AZURE_CLIENT_ID }}",
21+
"clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}",
22+
"subscriptionId":"${{ vars.AZURE_SUBSCRIPTION_ID }}",
23+
"tenantId":"${{ vars.AZURE_TENANT_ID }}"}
2024
functionAppName: cdisc-library-conformance-rules-generator-dev
2125
PYTHON_VERSION: "3.12"
2226

@@ -34,7 +38,8 @@ jobs:
3438
with:
3539
app-name: ${{ env.functionAppName }}
3640
mask-inputs: false
37-
app-settings-json: '{"WEBSITE_ENABLE_SYNC_UPDATE_SITE": "1"}' # wait for this step to complete before the webapps-deploy step
41+
# wait for this step to complete before the webapps-deploy step
42+
app-settings-json: '{"WEBSITE_ENABLE_SYNC_UPDATE_SITE": "1"}'
3843
general-settings-json: '{"linuxFxVersion": "PYTHON|${{ env.PYTHON_VERSION }}"}'
3944
slot-name: ${{ vars.AZURE_WEBAPP_SLOT }}
4045

.github/workflows/lint-format.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,34 @@ on:
77
- main
88
permissions:
99
contents: read
10-
1110
jobs:
1211
get_changed_files:
1312
runs-on: ubuntu-latest
1413
outputs:
1514
py: ${{ steps.changes.outputs.py_all_changed_files }}
16-
pretty: ${{ steps.changes.outputs.pretty_all_changed_files }}
15+
yaml: ${{ steps.changes.outputs.yaml_all_changed_files }}
16+
md: ${{ steps.changes.outputs.md_all_changed_files }}
17+
json: ${{ steps.changes.outputs.json_all_changed_files }}
1718
steps:
1819
- name: Checkout repository
1920
uses: actions/checkout@v6
2021
with:
2122
fetch-depth: 0
2223
- name: Get changed files
2324
id: changes
24-
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
25+
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
2526
with:
2627
files_yaml: |
2728
py:
2829
- '**.py'
29-
pretty:
30-
- '**.json'
31-
- '**.md'
30+
yaml:
3231
- '**.yaml'
3332
- '**.yml'
33+
md:
34+
- '**.md'
35+
json:
36+
- '**.json'
3437
separator: " "
35-
3638
check_python_files:
3739
runs-on: ubuntu-latest
3840
needs: get_changed_files
@@ -57,19 +59,50 @@ jobs:
5759
- name: Run black
5860
run: |
5961
black --check ${{needs.get_changed_files.outputs.py}}
60-
61-
check_prettier_files:
62+
check_json_files:
6263
runs-on: ubuntu-latest
6364
needs: get_changed_files
64-
# only run if there are changed files
65-
if: ${{needs.get_changed_files.outputs.pretty}}
65+
if: ${{needs.get_changed_files.outputs.json}}
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@v6
69+
with:
70+
fetch-depth: 0
71+
- name: Run json lint
72+
run: |
73+
for f in ${{needs.get_changed_files.outputs.json}}; do
74+
python -m json.tool $f > /dev/null && echo "$f OK" || exit 1
75+
done
76+
check_yaml_files:
77+
runs-on: ubuntu-latest
78+
needs: get_changed_files
79+
if: ${{needs.get_changed_files.outputs.yaml}}
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v6
83+
with:
84+
fetch-depth: 0
85+
- name: Set up Python
86+
uses: actions/setup-python@v6
87+
with:
88+
python-version: "3.12"
89+
- name: Install yamllint
90+
run: |
91+
pip install yamllint -c requirements-dev.txt
92+
- name: Run yamllint
93+
run: |
94+
yamllint ${{needs.get_changed_files.outputs.yaml}}
95+
check_markdown_files:
96+
runs-on: ubuntu-latest
97+
needs: get_changed_files
98+
if: ${{needs.get_changed_files.outputs.md}}
6699
steps:
67100
- name: Checkout repository
68101
uses: actions/checkout@v6
69102
with:
70103
fetch-depth: 0
71104
- uses: actions/setup-node@v6
72-
- name: Run prettier
105+
- name: Run markdownlint
73106
run: |
74-
npm i prettier
75-
npx prettier --check ${{needs.get_changed_files.outputs.pretty}}
107+
npm i markdownlint-cli2
108+
npx markdownlint-cli2 ${{needs.get_changed_files.outputs.md}}

.github/workflows/prerelease-update-cache.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
with:
1414
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
1515
# git bash: ssh-keygen -t ed25519 -C "github-actions@cdisc.org"
16-
# Add public key (.pub one) as a deploy key at Your repo -> Settings -> Security -> Deploy keys, check "Allow write access".
16+
# Add public key (.pub one) as a deploy key at
17+
# Your repo -> Settings -> Security -> Deploy keys, check "Allow write access".
1718
# Add private key as a secret at Your repo -> Settings -> Security -> Secrets and variables -> Actions
1819
ssh-key: ${{ secrets.GH_ACTION_PRIVATE_KEY }}
1920

.github/workflows/prerelease-update-version.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
uses: actions/checkout@v6
2222
with:
2323
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
24-
# git bash: ssh-keygen -t ed25519 -C "github-actions@cdisc.org"
25-
# Add public key (.pub one) as a deploy key at Your repo -> Settings -> Security -> Deploy keys, check "Allow write access".
26-
# Add private key as a secret at Your repo -> Settings -> Security -> Secrets and variables -> Actions
24+
# Generate SSH key: ssh-keygen -t ed25519 -C "github-actions@cdisc.org"
25+
# Add public key as deploy key (Settings -> Security -> Deploy keys, allow write access)
26+
# Add private key as secret (Settings -> Security -> Secrets and variables -> Actions)
2727
ssh-key: ${{ secrets.GH_ACTION_PRIVATE_KEY }}
2828

2929
- name: Set up Python

0 commit comments

Comments
 (0)