Skip to content

Commit

Permalink
Merge pull request #985 from maykinmedia/feature/small-things
Browse files Browse the repository at this point in the history
Bullet alignment and xx-placeholder validation
  • Loading branch information
joeribekker authored Sep 20, 2024
2 parents b15e7bc + 7ee45e9 commit f156354
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 18 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
- name: Install dependencies
run: |
pip install "pip<24" -U
pip install -r requirements/setuptools.txt
pip install -r requirements/ci.txt
Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
python src/manage.py spectacular --validate --fail-on-warn --file openapi.yaml
- name: Store generated OAS
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: sdg-oas
path: openapi.yaml
Expand Down Expand Up @@ -144,7 +145,7 @@ jobs:

- name: Store Docker image artifact
if: github.event_name == 'push' # Only needed for docker-push job
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: docker-image
path: image.tar
Expand All @@ -157,7 +158,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download generated OAS
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: sdg-oas
- name: Check for OAS changes
Expand All @@ -170,7 +171,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download generated OAS
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: sdg-oas
- name: Use Node.js
Expand All @@ -188,7 +189,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download generated OAS
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: sdg-oas
- name: Use Node.js
Expand All @@ -208,7 +209,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download generated OAS
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: sdg-oas
- name: Use Node.js
Expand Down Expand Up @@ -245,7 +246,7 @@ jobs:
- uses: actions/checkout@v3

- name: Download built image
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: docker-image

Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'
- name: Install dependencies
run: |
pip install "pip<24" -U
pip install -r requirements/ci.txt
- uses: isort/[email protected]
with:
requirementsFiles: requirements/ci.txt
sortPaths: "src"
configuration: '--check-only --diff'

Expand All @@ -26,9 +29,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'
- name: Install dependencies
run: |
pip install "pip<24" -U
pip install -r requirements/ci.txt
- name: Run black
run: |
Expand All @@ -42,9 +46,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'
- name: Install dependencies
run: |
pip install "pip<24" -U
pip install -r requirements/ci.txt
- name: Run flake8
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Ensure we use the latest version of pip
RUN pip install pip -U
RUN pip install "pip<24" -U
COPY ./requirements /app/requirements
RUN pip install -r requirements/setuptools.txt
RUN pip install -r requirements/production.txt
Expand Down
23 changes: 18 additions & 5 deletions src/sdg/scss/components/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,36 @@
}

ol {
counter-reset: li;
list-style: none;

li {
margin: 5px 0px 5px 16px;
counter-increment: li;
display:table-row;
}

li:before {
content: counter(li) '.';
color: #777;
width: 16px;
display: table-cell;
vertical-align: top;
}
}

ul {
list-style: none;

li {
list-style-type: none;
padding-left: 16px;
display:table-row;
}

li:before {
content: "";
display: inline-block;
margin-left: -16px;
color: #777;
width: 16px;
display: table-cell;
vertical-align: top;
}

}
Expand Down
11 changes: 11 additions & 0 deletions src/sdg/utils/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,26 @@ def test_validate_placeholders(self):
"test [example_placeholder] test",
"test [[placeholder]]",
"test XX",
"test xx",
"test with XXX",
"test with xxx",
"test XXXXXX placeholder",
"test xxxxxx placeholder",
"test\n[markdown link](https://example.com)\n[name]",
]
for text in invalid_texts:
with self.subTest(invalid_text=text):
self.assertTrue(validate_placeholders(text))

valid_texts = [
"test X",
"test x",
"test X not-a-placeholder",
"test x not-a-placeholder",
"test YY",
"test yy",
"test YYYYYY not-a-placeholder",
"test yyyyyy not-a-placeholder",
"[markdown link](https://example.com)",
"test [markdown link](https://example.com) here",
"test\n[markdown link](https://example.com)",
Expand Down
2 changes: 1 addition & 1 deletion src/sdg/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def validate_placeholders(value, form=None, field_name=None):
i.e. [placeholder] or XXX
"""
placeholder_re = re.compile(r"\[.*?](?!\()|X{2,}")
placeholder_re = re.compile(r"\[.*?](?!\()|[Xx]{2,}")

if (form and not field_name) or (not form and field_name):
raise ValueError("Both form and field_name or neither must be provided")
Expand Down

0 comments on commit f156354

Please sign in to comment.