Skip to content

Commit

Permalink
Adds pre-commit based git hooks (#294 and #344)
Browse files Browse the repository at this point in the history
  - Replaces existing git hooks with pre-commit framework
    based git hooks.
  - Adds formatting changes introduced by prettier and eslint.

---------
Co-authored-by: Linda Nguyen <[email protected]>
Co-authored-by: Mads Kelberg <[email protected]>
Co-authored-by: lindot09 <[email protected]>
Co-authored-by: lindot11 <[email protected]>
  • Loading branch information
prasadtalasila authored Dec 3, 2023
1 parent 8162d29 commit 3080647
Show file tree
Hide file tree
Showing 54 changed files with 643 additions and 571 deletions.
21 changes: 0 additions & 21 deletions .git-hooks/pre-commit

This file was deleted.

22 changes: 0 additions & 22 deletions .git-hooks/pre-push

This file was deleted.

7 changes: 7 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
default: true
MD033: false
MD013:
code_blocks: false
tables: false
MD046:
style: "fenced"
88 changes: 88 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
default_install_hook_types: [pre-commit, pre-push]

repos:
- repo: local
hooks:
- id: yarn-install-client
name: yarn install client
entry: bash
language: system
files: "^client/.*"
args: ["-c", "cd client && yarn install"]
- id: yarn-install-runner
name: yarn install runner
entry: bash
language: system
files: "^servers/execution/runner/.*"
args: ["-c", "cd servers/execution/runner && yarn install"]
- id: yarn-install-lib
name: yarn install lib
entry: bash
language: system
files: "^servers/lib/.*"
args: ["-c", "cd servers/lib && yarn install"]

- id: yarn-jest-client
name: yarn jest client
entry: bash
language: system
files: "^client/.*"
args: ["-c", "cd client && yarn jest . --coverage=false"]
stages: [pre-push]
- id: yarn-test-runner
name: yarn test runner
entry: bash
language: system
files: "^servers/execution/runner/.*"
args: ["-c", "cd servers/execution/runner && yarn test:nocov"]
stages: [pre-push]
# - id: yarn-test-lib
# name: yarn test lib
# entry: bash
# language: system
# files: "^servers/lib/.*"
# args: ["-c", "cd servers/lib && yarn jest . --coverage=false"]
# stages: [pre-push]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
args: ["--ignore-path", "../.gitignore", "--write"]
files: '^(client|servers/execution/runner|servers/lib)/.*\.(ts|tsx|css|scss)$'
stages: [pre-commit]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.54.0
hooks:
- id: eslint
args: ["--fix"]
files: "^(client|servers/execution/runner|servers/lib)/.*"
stages: [pre-commit]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
hooks:
- id: markdownlint
files: '.*\.md$'
entry: ./script/markdownlint-hook.sh
verbose: true
stages: [pre-commit]

- repo: https://github.com/syntaqx/git-hooks
rev: v0.0.18
hooks:
- id: shellcheck
files: '.*'
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]

8 changes: 4 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

* The INTO-CPS tool suite software and the INTO-CPS Association
* Public License (ICAPL) are obtained from the INTO-CPS Association, either
* from the above address, from the URLs: <http:>http://www.into-cps.org</http:> or
* from the above address, from the URLs: <http://www.into-cps.org> or
* in the INTO-CPS tool suite distribution.
* GNU version 3 is obtained from:
* <http:>http://www.gnu.org/copyleft/gpl.html</http:>.
* <http://www.gnu.org/copyleft/gpl.html>.

* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
Expand Down Expand Up @@ -291,11 +291,11 @@ This Agreement is governed by the laws of Denmark. The place of jurisdiction
for all disagreements related to this Agreement, is Aarhus, Denmark.

The EPL 1.0 license definition has been obtained from:
<http:>http://www.eclipse.org/legal/epl-v10.html</http:>.
<http://www.eclipse.org/legal/epl-v10.html>.
It is also reproduced in the INTO-CPS distribution.

The GPL Version 3 license definition has been obtained from
<http:>http://www.gnu.org/copyleft/gpl.html</http:>.
<http://www.gnu.org/copyleft/gpl.html>.
It is also reproduced in the INTO-CPS distribution.

--- End of Definition of INTO-CPS Association Public License ---
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ to install and use the DTaaS software platform.
You are welcome to open an [issue](https://github.com/INTO-CPS-Association/DTaaS/issues/new/choose)
if there is a suggestion to improve the software.

If you find this repo useful for your research, please consider citing our paper:

```bibtex
@misc{talasila2023digital,
title={Digital Twin as a Service (DTaaS): A Platform for Digital Twin Developers and Users},
author={Prasad Talasila and Cláudio Gomes and Peter Høgh Mikkelsen and Santiago Gil Arboleda and Eduard Kamburjan and Peter Gorm Larsen},
year={2023},
eprint={2305.07244},
archivePrefix={arXiv},
primaryClass={cs.SE}
}
```

## :hammer_and_wrench: Development Setup

This is a mono repo containing code for
Expand Down
4 changes: 4 additions & 0 deletions client/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
8 changes: 4 additions & 4 deletions client/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

* The INTO-CPS tool suite software and the INTO-CPS Association
* Public License (ICAPL) are obtained from the INTO-CPS Association, either
* from the above address, from the URLs: <http:>http://www.into-cps.org</http:> or
* from the above address, from the URLs: <http://www.into-cps.org> or
* in the INTO-CPS tool suite distribution.
* GNU version 3 is obtained from:
* <http:>http://www.gnu.org/copyleft/gpl.html</http:>.
* <http://www.gnu.org/copyleft/gpl.html>.

* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
Expand Down Expand Up @@ -291,11 +291,11 @@ This Agreement is governed by the laws of Denmark. The place of jurisdiction
for all disagreements related to this Agreement, is Aarhus, Denmark.

The EPL 1.0 license definition has been obtained from:
<http:>http://www.eclipse.org/legal/epl-v10.html</http:>.
<http://www.eclipse.org/legal/epl-v10.html>.
It is also reproduced in the INTO-CPS distribution.

The GPL Version 3 license definition has been obtained from
<http:>http://www.gnu.org/copyleft/gpl.html</http:>.
<http://www.gnu.org/copyleft/gpl.html>.
It is also reproduced in the INTO-CPS distribution.

--- End of Definition of INTO-CPS Association Public License ---
22 changes: 0 additions & 22 deletions client/public/static/font/README.md

This file was deleted.

1 change: 0 additions & 1 deletion client/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,3 @@ yarn test -e
This command launches the test runner and executes all end-to-end tests.
Make sure you have an active internet connection while running these tests,
as they simulate real user interactions with your GitLab account.

4 changes: 2 additions & 2 deletions client/test/e2e/playwright/Auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe('Tests on Authentication Flow', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' })
page.getByRole('button', { name: 'Open settings' }),
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);
});
Expand All @@ -23,7 +23,7 @@ test.describe('Tests on Authentication Flow', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' })
page.getByRole('button', { name: 'Open settings' }),
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);

Expand Down
4 changes: 2 additions & 2 deletions client/test/e2e/playwright/Menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.describe('Menu Links from first page (Layout)', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' })
page.getByRole('button', { name: 'Open settings' }),
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);
});
Expand All @@ -19,7 +19,7 @@ test.describe('Menu Links from first page (Layout)', () => {
await links.reduce(async (previousPromise, link) => {
await previousPromise;
const linkElement = await page.locator(
`div[role="button"]:has-text("${link.text}")`
`div[role="button"]:has-text("${link.text}")`,
);
await expect(linkElement).toBeVisible();
}, Promise.resolve());
Expand Down
2 changes: 1 addition & 1 deletion client/test/e2e/playwright/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ setup('authenticate', async ({ page }) => {
// 'Authorize' button did not appear within 4 seconds, so just ignore and continue.
}
await expect(
page.getByRole('button', { name: 'Open settings' })
page.getByRole('button', { name: 'Open settings' }),
).toBeVisible();

const storage = await page.context().storageState();
Expand Down
6 changes: 3 additions & 3 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ registered on Gitlab:

| Gitlab Variable Name | Variable name in Client env.js | Default Value |
|:---|:---|:---|
| OAuth Provider | REACT_APP_AUTH_AUTHORITY | https://gitlab.foo.com/ |
| OAuth Provider | REACT_APP_AUTH_AUTHORITY | <https://gitlab.foo.com/> |
| Application ID | REACT_APP_CLIENT_ID |
| Callback URL | REACT_APP_REDIRECT_URI | https://foo.com/Library |
| Callback URL | REACT_APP_REDIRECT_URI | <https://foo.com/Library> |
| Scopes | REACT_APP_GITLAB_SCOPES | openid, profile, read_user, read_repository, api |

You can also see
Expand Down Expand Up @@ -158,7 +158,7 @@ You can run this script multiple times until the installation is successful.

## Access the application

Now you should be able to access the DTaaS application at: _<http:>https://foo.com</http:>_
Now you should be able to access the DTaaS application at: <https://foo.com>

## References

Expand Down
4 changes: 2 additions & 2 deletions deploy/services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The installation scripts in this directory install:
## Configure and Install

The first step in installation is to specify the config of the services.
There are two configuration files. The __services.yml__ contains most
of configuration settings. The __mqtt-default.conf__ file contains
There are two configuration files. The **services.yml** contains most
of configuration settings. The **mqtt-default.conf** file contains
the MQTT listening port. Update these two config files before proceeding
with the installation of the services.

Expand Down
4 changes: 2 additions & 2 deletions deploy/vagrant/two-machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Please change these to your unique website URLs.

The first step is to define the network identity of the two VMs. For that, you
need _server name_, _hostname_ and _MAC address_. The hostname is the network
URL at which the server can be accessed on the WWW. Please follow these steps
to make this work in your local environment.
URL at which the server can be accessed on the world wide web. Please follow
these steps to make this work in your local environment.

Update the **boxes.json**. There are entries one for each server.
The fields to update are:
Expand Down
Loading

0 comments on commit 3080647

Please sign in to comment.