-
Notifications
You must be signed in to change notification settings - Fork 61
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
WebApp update - Code quality #37
WebApp update - Code quality #37
Conversation
Omarley7
commented
Apr 10, 2023
•
edited
Loading
edited
- Many issues from code climate have been addressed.
- Added .gittattibute so WSL can run scripts on Windows machines with configuring line endings locally
- Readme has been updated
- React-tabs have been implemented instead of MUI tabs to reduce code and accommodate code climate issues.
- Extended E2E test on menu to cover 100% of navigation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## feature/distributed-demo #37 +/- ##
=============================================================
+ Coverage 49.07% 62.21% +13.14%
=============================================================
Files 31 31
Lines 324 352 +28
Branches 2 7 +5
=============================================================
+ Hits 159 219 +60
+ Misses 163 127 -36
- Partials 2 6 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Other comments: I've missed these changes over time. The react-iframe npm package has been removed from src/components/Iframe.tsx. Doesn't it provide better functionality than the existing code?
client/test/e2e/Menu.test.ts
Outdated
await page.goto('/sanalysis'); | ||
await page.locator('div[role="button"]:has-text("Library")').click(); | ||
await expect(page).toHaveURL('/library'); | ||
links.forEach((link) => { |
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.
This is a strange convention. Usually we put code inside test.describe() function. Now we are iterating on the test() function itself. Can you move the link.forEach() into test.describe()?
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.
I'm pretty sure I read somewhere that it's also convention to loop outside of the test() function if needed (of course I failed to find where I read it).
- In this case, we will have identical tests for each route. (Loop 1)
- Each route navigates to every link to check if it works. (Loop 2)
Looping twice inside the test gave us many issues.
For now I've taken it out of the PR, and will look into it more in detail for the next PR.
await page.goto('/library'); | ||
await page.locator('div[role="button"]:has-text("Digital Twins")').click(); | ||
await expect(page).toHaveURL('/digitaltwins'); | ||
interface TestLink { |
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.
nice refactoring
import TabPanel, { a11yProps } from 'components/tab/subcomponents/TabPanel'; | ||
import { useState, SyntheticEvent } from 'react'; | ||
import { Paper } from '@mui/material'; | ||
import TabRender from './subcomponents/TabRender'; |
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.
There seems to be a circular dependency between TabComponents and TabRender.
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.
Also as a convention, things in parent directories depend on sub-directories, except when they are in different packages, or in different parts of directory structure. For example, code in src/components/subcomponents/TabRender.tsx can depend on src/utility/sample.tsx but not on src/components/Components.tsx.
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.
@DaloonOfDoom took a look at this and fixed it
At this moment, about 75% of the code quality issues are in client/. Is it possible to fix more code quality issues in this PR? |
8678627
to
7152af5
Compare
@Omarley7, the scope of this PR seems to be expanding quite a bit. Can you please list the improvements and downgrades made in this PR so far? |
@prasadtalasila I was hoping to include the issue discussed in #42. |
* DUGK-57 Updated readme instructions. Ultra clear build instructions. * DUGK-57 removed 'test'
* DUGK-61 Refactored /e2e/Menu.test.ts * DUGK-61 work in progress, not ready to merge * DUGK-61 The test works for now * DUGK-61 Fixed loop issue in menu test --------- Co-authored-by: Omar <[email protected]>
Added gitattributes for line endings Convert to react-tabs. Add unit tests. simplify type TabData Husky now only checks certain directories within client
* removed husky * DUGK-65 Removed husky from scripts * DUGK-65 Pre-push Fixed. Now comparing to origin/current-branch instead of default * DUGK-65 Added config script and updated readme * DUGK-65 Added hook script to prepare * Formatting * DUGK-65 CodeClimate issues fixed * DUGK-65 Removed husky from readme. Also changed echo to printf
Raised threshold of similar-code to 45 (default for TS) Fixed a lot of configuration errors.
Fixed additional codeclimate issues in client scripts.
If coverage is not met, the whole pipeline breaks instead of continuing. This temp fix will run the tests twice. Collect coverage during second.
This allows test coverage below threshold to be uploaded.
Implemented global mocks. Removed fullsize from iframe props. Fixed all failing tests. Added 'src/util/envUtil.ts' as getter for global env for easier testing. 'test/__mocks__/' now contains global mocks for components and page. Removed all redundant render() functions from tests. Replaced 'test/unitTest/config' dir with 'test/unitTest/jest.setup.ts' Removed iframe mock. Needs to exists for tests. Can be located by title.
b3c0222
to
072008f
Compare
- E2E menu test optimization - Pipeline errors in test.bash
Here's the update @prasadtalasila Scope of this PRPriority number 1 was to reduce CodeClimte issues. To achieve that the following changes have been made:
Pipeline improvements
Client improvements
Not covered yet
|
Readme looks good to us, only thing is that we have to use sudo for the bash script/install.bash, to install correctly since we use a Ubuntu VM, but i'm guessing it's not required with the suggested setup of "vagrant virtual machine". |
…7/DTaaS-Bachelor-new-GUI into feature/distributed-demo
Code Climate has analyzed commit 76c87f2 and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
23330ad
into
INTO-CPS-Association:feature/distributed-demo