- 
                Notifications
    
You must be signed in to change notification settings  - Fork 37
 
fix(37027): Improve code quality #1210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s of operator "&&"
…of them is redundant.
…s more concise and easier to read
          Test Results  460 files    460 suites   4m 3s ⏱️ Results for commit 9f8091d. ♻️ This comment has been updated with latest results.  | 
    
          Coverage Report
 
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses SonarQube code quality issues by implementing various improvements including replacing deprecated methods with modern alternatives, removing redundant expressions, simplifying conditional checks, and improving import/export patterns.
- Replaced deprecated 
replace()withreplaceAll()andArray()constructor withnew Array() - Added proper 
newkeyword for Error constructors and simplified redundant logical expressions - Refactored import/export statements to use more concise patterns
 
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| hivemq-edge-frontend/src/modules/Workspace/utils/topics-utils.ts | Replaced replace() with replaceAll() for consistency | 
| hivemq-edge-frontend/src/modules/Workspace/hooks/useEdgeFlowContext.ts | Added new keyword to Error constructor | 
| hivemq-edge-frontend/src/modules/Workspace/components/nodes/index.ts | Simplified export statements using direct export syntax | 
| hivemq-edge-frontend/src/modules/Pulse/components/assets/SourcesCell.spec.cy.tsx | Updated Array constructor with new keyword | 
| hivemq-edge-frontend/src/modules/Metrics/components/editor/MetricEditor.tsx | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/modules/Metrics/components/charts/SampleRenderer.tsx | Replaced isNaN() with Number.isFinite() for better type checking | 
| hivemq-edge-frontend/src/modules/EventLog/components/panel/EventDrawer.tsx | Removed unused variables and unnecessary React Fragment | 
| hivemq-edge-frontend/src/modules/DomainOntology/hooks/useGetChordMatrixData.ts | Updated Array constructor with new keyword | 
| hivemq-edge-frontend/src/modules/DomainOntology/components/parts/ChartWrapper.tsx | Removed redundant logical AND expression | 
| hivemq-edge-frontend/src/modules/Bridges/hooks/useBridgeConfig.ts | Added new keyword to Error constructor | 
| hivemq-edge-frontend/src/modules/Auth/hooks/useEdgeFlowContext.spec.ts | Added test file for auth hook | 
| hivemq-edge-frontend/src/modules/Auth/hooks/useAuth.ts | Added new keyword to Error constructor | 
| hivemq-edge-frontend/src/hooks/useGetEdgeTopics/useGetEdgeTopics.ts | Replaced generic sort() with locale-aware comparison | 
| hivemq-edge-frontend/src/hooks/useAccessibleDraggable/useAccessibleDraggable.ts | Added new keyword to Error constructor | 
| hivemq-edge-frontend/src/hooks/useAccessibleDraggable/index.ts | Simplified export statements using direct export syntax | 
| hivemq-edge-frontend/src/extensions/datahub/utils/policy.utils.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/extensions/datahub/hooks/usePolicyGuards.ts | Removed redundant logical AND expression | 
| hivemq-edge-frontend/src/extensions/datahub/hooks/useGetFilteredFunctions.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/extensions/datahub/hooks/useFilteredFunctionsFetcher.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/extensions/datahub/hooks/useDataHubDraftStore.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/extensions/datahub/designer/operation/OperationNode.utils.ts | Simplified conditional checks using optional chaining | 
| hivemq-edge-frontend/src/components/rjsf/utils/getChakra.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/components/rjsf/Widgets/UpDownWidget.tsx | Removed redundant logical AND expressions | 
| hivemq-edge-frontend/src/components/rjsf/Templates/CompactBaseInputTemplate.tsx | Removed redundant logical AND expressions | 
| hivemq-edge-frontend/src/components/rjsf/Form/error-focus.utils.ts | Simplified conditional check using optional chaining | 
| hivemq-edge-frontend/src/components/rjsf/BaseInputTemplate.tsx | Removed redundant logical AND expressions | 
| hivemq-edge-frontend/src/components/rjsf/ArrayFieldItemTemplate.tsx | Removed redundant logical OR expression | 
| hivemq-edge-frontend/src/components/WarningMessage.tsx | Simplified type annotation by removing unnecessary union with undefined | 
| hivemq-edge-frontend/src/components/PaginatedTable/PaginatedTable.spec.cy.tsx | Updated Array constructor with new keyword | 
| hivemq-edge-frontend/src/components/Icons/index.ts | Simplified export statements using direct export syntax | 
| hivemq-edge-frontend/src/api/hooks/useGetMetrics/handlers/index.ts | Updated Array constructor with new keyword | 
| hivemq-edge-frontend/src/api/hooks/useEvents/handlers/index.ts | Updated Array constructor with new keyword | 
| hivemq-edge-frontend/src/test-utils/rjsf/rjsf.mocks.tsx | Simplified type annotation by removing unnecessary union with undefined | 
| hivemq-edge-frontend/src/test-utils/color.ts | Replaced parseInt() with Number.parseInt() | 
| hivemq-edge-frontend/cypress/utils/datahub.utils.ts | Replaced generic sort() with locale-aware comparison | 
| .github/workflows/check.yml | Added debug output for openapi-changed workflow step | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🦣
See https://hivemq.kanbanize.com/ctrl_board/57/cards/37027/details/
A few fixes triggered by
SonnarQubequality checks. Among them: