Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "common"]
path = common
url = https://github.com/NHSDigital/clinical-data-common.git
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
"python.analysis.showOnlyDirectDependenciesInAutoImport": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.autoIndent": false,
"python.analysis.extraPaths": [
"${workspaceFolder}/common/src"
],
// Mypy configuration
"mypy-type-checker.cwd": "${nearestConfig}",
// Enable re-format on type
Expand Down
1 change: 1 addition & 0 deletions common
Submodule common added at abef56
1 change: 1 addition & 0 deletions gateway-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ dev = [

[tool.mypy]
strict = true
mypy_path = "../common/src"
6 changes: 5 additions & 1 deletion gateway-api/src/gateway_api/handler.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from clinical_data_common import get_hello


class User:
def __init__(self, name: str):
self._name = name
Expand All @@ -10,4 +13,5 @@ def name(self) -> str:
def greet(user: User) -> str:
if user.name == "nonexistent":
raise ValueError("nonexistent user provided.")
return f"Hello, {user.name}!"
greeting = get_hello()
return f"{greeting}{user.name}!"
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[pytest]
bdd_features_base_dir = gateway-api/tests/acceptance/features
pythonpath = common/src
8 changes: 4 additions & 4 deletions scripts/githooks/check-english-usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ function main() {
check=${check:-working-tree-changes}
case $check in
"all")
filter="git ls-files"
filter="git ls-files | grep -v '^common/'"
;;
"staged-changes")
filter="git diff --diff-filter=ACMRT --name-only --cached"
filter="git diff --diff-filter=ACMRT --name-only --cached | grep -v '^common/'"
;;
"working-tree-changes")
filter="git diff --diff-filter=ACMRT --name-only"
filter="git diff --diff-filter=ACMRT --name-only | grep -v '^common/'"
;;
"branch")
filter="git diff --diff-filter=ACMRT --name-only ${BRANCH_NAME:-origin/main}"
filter="git diff --diff-filter=ACMRT --name-only ${BRANCH_NAME:-origin/main} | grep -v '^common/'"
;;
*)
echo "Unrecognised check mode: $check" >&2 && exit 1
Expand Down
4 changes: 2 additions & 2 deletions scripts/githooks/check-file-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function run-editorconfig-natively() {

# shellcheck disable=SC2046,SC2086
editorconfig \
--exclude '.git/' $dry_run_opt $($filter)
--exclude '.git/' --exclude 'common/' $dry_run_opt $($filter)
}

# Run editorconfig in a Docker container.
Expand All @@ -101,7 +101,7 @@ function run-editorconfig-in-docker() {
docker run --rm --platform linux/amd64 \
--volume "$PWD":/check \
"$image" \
sh -c "ec --exclude '.git/' $dry_run_opt \$($filter) /dev/null"
sh -c "ec --exclude '.git/' --exclude 'common/' $dry_run_opt \$($filter) /dev/null"
}

# ==============================================================================
Expand Down
6 changes: 4 additions & 2 deletions scripts/githooks/check-markdown-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ function run-markdownlint-natively() {
# shellcheck disable=SC2086
markdownlint \
$files \
--config "$PWD/scripts/config/.markdownlint.yaml"
--config "$PWD/scripts/config/.markdownlint.yaml" \
--ignore "common/**"
}

# Run markdownlint in a Docker container.
Expand All @@ -90,7 +91,8 @@ function run-markdownlint-in-docker() {
--volume "$PWD":/workdir \
"$image" \
$files \
--config /workdir/scripts/config/.markdownlint.yaml
--config /workdir/scripts/config/.markdownlint.yaml \
--ignore \"common/**\"
}

# ==============================================================================
Expand Down
Loading