From 2b213fea4f38ee52cdab76261302745bafb19bec Mon Sep 17 00:00:00 2001 From: lindot11 Date: Fri, 1 Dec 2023 17:23:12 +0100 Subject: [PATCH] hooks for shellcheck, json and yaml check --- .pre-commit-config.yaml | 18 ++++++++++++++++++ client/src/components/tab/TabComponent.tsx | 2 +- client/src/route/library/Library.tsx | 2 +- .../unitTests/Components/TabComponent.test.tsx | 6 +++--- script/docs.sh | 2 +- script/env.sh | 6 +++++- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6864d8691..9355dd775 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,3 +66,21 @@ repos: - id: markdownlint files: '^(client|servers/execution/runner|servers/lib)/.*\.md$' stages: [pre-commit] + + - repo: https://github.com/syntaqx/git-hooks + rev: v0.0.18 + hooks: + - id: shellcheck + files: '^(docs|deploy|script|ssl)/.*' + stages: [pre-commit] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-json + files: '^(docs|deploy|script|ssl)/.*' + stages: [pre-commit] + - id: check-yaml + files: '^(docs|deploy|script|ssl)/.*' + stages: [pre-commit] + \ No newline at end of file diff --git a/client/src/components/tab/TabComponent.tsx b/client/src/components/tab/TabComponent.tsx index bbcec27c2..6ce250893 100644 --- a/client/src/components/tab/TabComponent.tsx +++ b/client/src/components/tab/TabComponent.tsx @@ -24,7 +24,7 @@ function renderScopeTabList(scope: TabData[][], subIndex: number): JSX.Element { function renderScopeTabPanels( scope: TabData[][], - subIndex: number + subIndex: number, ): JSX.Element { return ( <> diff --git a/client/src/route/library/Library.tsx b/client/src/route/library/Library.tsx index fd13c6b5e..75356056d 100644 --- a/client/src/route/library/Library.tsx +++ b/client/src/route/library/Library.tsx @@ -32,7 +32,7 @@ export function createCombinedTabs() { /> ), - })) + })), ); } diff --git a/client/test/unitTests/Components/TabComponent.test.tsx b/client/test/unitTests/Components/TabComponent.test.tsx index 0c1751da4..881c1683d 100644 --- a/client/test/unitTests/Components/TabComponent.test.tsx +++ b/client/test/unitTests/Components/TabComponent.test.tsx @@ -11,7 +11,7 @@ describe('TabComponent', () => { test('renders an empty tab', () => { const { getByText } = render( - + , ); const emptyTab = getByText('Functions'); expect(emptyTab).toBeInTheDocument(); @@ -60,10 +60,10 @@ describe('TabComponent', () => { } expect( - screen.queryByText(assetTypeTabs[0].body.props.children) + screen.queryByText(assetTypeTabs[0].body.props.children), ).not.toBeInTheDocument(); expect( - screen.queryByText(assetTypeTabs[1].body.props.children) + screen.queryByText(assetTypeTabs[1].body.props.children), ).not.toBeInTheDocument(); }); diff --git a/script/docs.sh b/script/docs.sh index 252ec3ec3..4978519a6 100755 --- a/script/docs.sh +++ b/script/docs.sh @@ -13,7 +13,7 @@ COMMIT_HASH=$(git rev-parse --short HEAD) export COMMIT_HASH export MKDOCS_ENABLE_PDF_EXPORT=1 -echo ${VERSION} +echo "${VERSION}" if [ -d site ] then rm -rf site diff --git a/script/env.sh b/script/env.sh index e875e1c3c..2c1e71b16 100755 --- a/script/env.sh +++ b/script/env.sh @@ -22,6 +22,10 @@ sudo -H pip3 install qrcode sudo apt-get install -y rubygems sudo gem install mdl +# Install shellcheck +sudo apt-get install -y shellcheck + # Install madge for generating dependency graphs of typescript projects sudo apt-get install -y graphviz -sudo npm install -g madge \ No newline at end of file +sudo npm install -g madge +