Showing 4,177 of 14,709 total issues
Function generateDemographicsContent
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generateDemographicsContent = record => {
return [
{
details: [
{
File form.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { VA_FORM_IDS } from 'platform/forms/constants';
import preSubmitInfo from 'platform/forms/preSubmitInfo';
import FormFooter from 'platform/forms/components/FormFooter';
import { externalServices as services } from 'platform/monitoring/DowntimeNotification';
Function prefillTransformerV2
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function prefillTransformerV2(pages, formData, metadata, state) {
const bankInformation = state.data?.bankInformation || {};
const claimant = state.data?.formData?.data?.attributes?.claimant || {};
const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
const contactInfo = claimant?.contactInfo || {};
Function IntroductionPage
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IntroductionPage = props => {
// focus on element
useEffect(() => {
focusElement('h1');
}, []);
Function FolderHeader
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const FolderHeader = props => {
const { folder, searchProps, threadCount } = props;
const location = useLocation();
const userFacilities = useSelector(state => state?.user?.profile?.facilities);
const showInnerNav =
File questions.jsx
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
export const questions = [
{
id: 'isStaff',
Function validateAddress
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
) => async dispatch => {
const userEnteredAddress = { ...inputAddress };
dispatch({
type: ADDRESS_VALIDATION_INITIALIZE,
fieldName,
Function IntroductionPage
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IntroductionPage = props => {
// Toggle from hearing aid supplies to hearing aid + CPAP supplies.
const {
TOGGLE_NAMES,
useToggleValue,
Function prefillTransformerV2
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function prefillTransformerV2(pages, formData, metadata, state) {
const bankInformation = state.data?.bankInformation || {};
const claimant = state.data?.formData?.data?.attributes?.claimant || {};
const contactInfo = claimant?.contactInfo || {};
const sponsors = state.data?.formData?.attributes?.sponsors;
Function IntroductionPage
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IntroductionPage = props => {
// Toggle from hearing aid supplies to hearing aid + CPAP supplies.
const {
TOGGLE_NAMES,
useToggleValue,
Function PayrollDeductionChecklist
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PayrollDeductionChecklist = props => {
const { goToPath, goBack, setFormData } = props;
const editIndex = getJobIndex();
File mockData.js
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
export const UPDATED_USER_MOCK_DATA = {
'vye::UserInfo': {
remEnt: '2854321', // 28(first 2 numbers) for months .54321 * 30 = res needs to be rounded
certIssueDate: '2019-06-28T00:00:00.000Z',
delDate: '2026-09-03T00:00:00.000Z',
Function venueAddress
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const venueAddress = (formValues, noDRB) => {
if (!formValues) return null;
const boardData = board(formValues);
Function determineVenueAddress
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const determineVenueAddress = (formResponses, noDRB) => {
if (!formResponses) return null;
const boardData = determineBoardObj(formResponses);
Function DocumentUploader
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DocumentUploader = () => {
const [state, setState] = useState({
documentType: '',
documentDescription: '',
errorMessage: null,
Function DocumentUploader
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DocumentUploader = () => {
const [state, setState] = useState({
documentType: '',
documentDescription: '',
errorMessage: null,
Function SpousePayrollDeductionChecklist
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SpousePayrollDeductionChecklist = props => {
const { goToPath, goBack, setFormData } = props;
const editIndex = getJobIndex();
Function RadioWidget
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function RadioWidget(props) {
const { options, formContext = {}, value, disabled, onChange, id } = props;
const { enumOptions, labels = {} } = options;
const dispatch = useDispatch();
File ctaWidgets.js
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Relative imports.
import backendServices from '~/platform/user/profile/constants/backendServices';
import featureFlagNames from '~/platform/utilities/feature-toggles/featureFlagNames';
import { mhvUrl } from '~/platform/site-wide/mhv/utilities';
import { getAppUrl } from '~/platform/utilities/registry-helpers';
Function reduceErrors
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
Open
export const reduceErrors = (errors, pageList, reviewErrors = {}) =>
errors.reduce((processedErrors, error) => {
let errorIndex = null; // save key (index) of array items with __error
const findErrors = (name, err) => {
if (err && typeof err === 'object') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"