Skip to content
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

feat: add er spa #793

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: add er spa #793

wants to merge 5 commits into from

Conversation

daniel-belcher
Copy link
Collaborator

Purpose

Add ER Spa. Also added some new options to dependency wrapper and section styling as needed for the form. New options include checking for bad values as a condition, loose condition matching for checking if at least one condition matched, and section styling for the wrapper of the content.

Linked Issues to Close

ticket

Approach

New dependency conditions are a base approach checking if value included in either array or primitive. Section styling follows our normal styling approach of merging with our pre-defined styles. Form is massive, extracted as many repeatable sections as possible, but it's still a lot to go through.

@daniel-belcher daniel-belcher added type: FEAT Submit new features status: READY PR is ready for review status: TESTING PR is being tested by QA labels Sep 25, 2024
@daniel-belcher daniel-belcher self-assigned this Sep 25, 2024
Copy link
Contributor

github-actions bot commented Sep 25, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 61.61% 4526 / 7346
🔵 Statements 61.15% 4794 / 7839
🔵 Functions 53.89% 1224 / 2271
🔵 Branches 32.6% 853 / 2616
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
lib/packages/shared-types/forms.ts 100% 100% 100% 100%
react-app/src/components/RHF/Section.tsx 100% 100% 100% 100%
react-app/src/components/RHF/dependencyWrapper.tsx 58.92% 50% 72.72% 61.11% 14-15, 15, 31, 36-43, 37-39, 42, 45-52, 46-48, 51, 54-57, 60-63, 106-120, 107, 109-110, 110, 110, 112, 114, 116-117, 117, 117, 119, 126
Generated in workflow #287

}
});
} else {
return !!dependentValue[i] && !(dependentValue[i] === d?.expectedValue);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this function.

}
case "notOnlyBadValue":
if (Array.isArray(dependentValue[i])) {
return !(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this function.

);
};

const triggerCheckSwitch = (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function triggerCheckSwitch has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.

]);
let newValArr = [...value, ...dependency.effect.newValue];

if (dependency.effect.checkUnique)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

]);
let newValArr = [...value, dependency.effect.newValue];

if (dependency.effect.checkUnique)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

Copy link

codeclimate bot commented Sep 25, 2024

Code Climate has analyzed commit d3d83a0 and detected 5 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 2

The test coverage on the diff in this pull request is 28.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 61.6% (-0.1% change).

View more on Code Climate.

Copy link
Collaborator

@jdinh8124 jdinh8124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see I don't see any issues, but I think I need another pair of eyes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: READY PR is ready for review status: TESTING PR is being tested by QA type: FEAT Submit new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants