Skip to content

Commit 3f6d5a0

Browse files
authored
Merge pull request #1004
* fix(29953): fix bug with missing arguments * fix(29953): fix bug with missing arguments * refactor(29953): refactor the function fetcher * test(29953): add tests * refactor(29953): refactor policy validation to incorporate content va… * fix(29953): fix bug with definition of the DataHub.transform function * fix(29953): fix bug with filtering * test(29953): fix test * refactor(29953): refactor the mapping of schema validation * refactor(29953): refactor the functions fetch * test(29953): fix tests * test(29953): fix tests * test(29953): add tests * fix(29953): linting * chore(29953): add sonarjs linting rules * test(29953): add tests
1 parent 6564266 commit 3f6d5a0

29 files changed

+886
-378
lines changed

hivemq-edge-frontend/eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import tsEslint from 'typescript-eslint'
77
import eslintConfigPrettier from 'eslint-config-prettier'
88
import pluginCypress from 'eslint-plugin-cypress/flat'
99
import pluginQuery from '@tanstack/eslint-plugin-query'
10+
import sonarjs from 'eslint-plugin-sonarjs'
1011

1112
export default tsEslint.config(
1213
{ ignores: ['dist', '**/__generated__/*'] },
@@ -29,6 +30,7 @@ export default tsEslint.config(
2930
'react-hooks': reactHooks,
3031
'react-refresh': reactRefresh,
3132
cypress: pluginCypress,
33+
sonarjs,
3234
},
3335
rules: {
3436
...reactHooks.configs.recommended.rules,
@@ -51,6 +53,24 @@ export default tsEslint.config(
5153
'cypress/no-unnecessary-waiting': 'error',
5254
'@typescript-eslint/consistent-type-imports': 'error',
5355
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
56+
// temporary sonarQube rules
57+
'sonarjs/todo-tag': 'off',
58+
'sonarjs/no-all-duplicated-branches': 'off',
59+
'sonarjs/no-duplicate-in-composite': 'off',
60+
'sonarjs/no-duplicate-string': 'off',
61+
'sonarjs/no-duplicated-branches': 'off',
62+
// 'sonarjs/no-ignored-exceptions': 'off',
63+
// 'sonarjs/no-commented-code': 'off',
64+
// 'sonarjs/no-nested-functions': 'off',
65+
// 'sonarjs/cognitive-complexity': 'warn',
66+
// 'sonarjs/no-small-switch': 'warn',
67+
// 'sonarjs/no-nested-conditional': 'warn',
68+
},
69+
},
70+
{
71+
files: ['**/*.spec.cy.tsx'],
72+
rules: {
73+
'sonarjs/no-duplicate-string': 'off',
5474
},
5575
}
5676
)

hivemq-edge-frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
"eslint-plugin-react": "7.37.5",
153153
"eslint-plugin-react-hooks": "5.2.0",
154154
"eslint-plugin-react-refresh": "0.4.20",
155+
"eslint-plugin-sonarjs": "^3.0.2",
155156
"fs-extra": "11.3.0",
156157
"globals": "16.1.0",
157158
"i18next-pseudo": "2.2.1",
@@ -165,7 +166,7 @@
165166
"stylelint-config-standard-scss": "14.0.0",
166167
"typescript": "5.7.3",
167168
"typescript-eslint": "8.32.1",
168-
"vite": "6.2.5",
169+
"vite": "6.2.7",
169170
"vite-plugin-istanbul": "6.0.2",
170171
"vitest": "3.1.1"
171172
},

hivemq-edge-frontend/pnpm-lock.yaml

Lines changed: 82 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hivemq-edge-frontend/src/extensions/datahub/__test-utils__/react-flow.mocks.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { styleDefaultEdge } from '@/extensions/datahub/utils/edge.utils.ts'
2626
import { MOCK_DEFAULT_NODE } from '@/__test-utils__/react-flow/nodes.ts'
2727
import { MockChecksStoreWrapper, MockStoreWrapper } from '@datahub/__test-utils__/MockStoreWrapper.tsx'
2828

29+
const MOCK_POLICY_ID = 'my-policy-id'
30+
2931
export const MOCK_INITIAL_POLICY = () => {
3032
const baseNode: Node<{ label: string }> = {
3133
id: '0',
@@ -49,7 +51,7 @@ export const MOCK_INITIAL_POLICY = () => {
4951

5052
const dataPolicyNode: Node<DataPolicyData> = {
5153
id: '3',
52-
data: { id: 'my-policy-id' },
54+
data: { id: MOCK_POLICY_ID },
5355
type: DataHubNodeType.DATA_POLICY,
5456
position: { x: 345, y: 105 },
5557
}
@@ -87,7 +89,7 @@ export const MOCK_INITIAL_POLICY = () => {
8789

8890
const behaviorPolicyNode: Node<BehaviorPolicyData> = {
8991
id: '7',
90-
data: { id: 'my-policy-id', model: BehaviorPolicyType.MQTT_EVENT },
92+
data: { id: MOCK_POLICY_ID, model: BehaviorPolicyType.MQTT_EVENT },
9193
type: DataHubNodeType.BEHAVIOR_POLICY,
9294
position: { x: 345, y: 195 },
9395
}
@@ -176,7 +178,7 @@ export const MOCK_INITIAL_POLICY = () => {
176178
export const MOCK_NODE_DATA_POLICY: Node<DataPolicyData> = {
177179
id: 'node-id',
178180
type: DataHubNodeType.DATA_POLICY,
179-
data: { id: 'my-policy-id' },
181+
data: { id: MOCK_POLICY_ID },
180182
...MOCK_DEFAULT_NODE,
181183
position: { x: 0, y: 0 },
182184
}

0 commit comments

Comments
 (0)