department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,918 of 12,918 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    <div className="small-6 medium-5 end columns">
      <ProgressButton
        submitButton={submitToContinue}
        onButtonClick={goForward}
        buttonText="Continue"
Severity: Minor
Found in src/platform/forms-system/src/js/components/FormNavButtons.jsx and 1 other location - About 55 mins to fix
src/platform/forms-system/src/js/components/FormNavButtons.jsx on lines 48..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = async (on, config) => {
  if (process.env.CODE_COVERAGE === 'true') {
    require('@cypress/code-coverage/task')(on, config);
    on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
  }
Severity: Minor
Found in src/platform/testing/e2e/cypress/plugins/index.js - About 55 mins to fix

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"

Further reading

Function generateResultsContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const generateResultsContent = async (doc, parent, data) => {
  const results = doc.struct('Sect', {
    title: 'Results',
  });
  parent.add(results);
Severity: Minor
Found in src/platform/pdf/templates/blue_button_report.js - About 55 mins to fix

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"

Further reading

Function generateResultsContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const generateResultsContent = async (doc, parent, data, config) => {
  const results = doc.struct('Sect', {
    title: 'Results',
  });
  parent.add(results);
Severity: Minor
Found in src/platform/pdf/templates/medical_records.js - About 55 mins to fix

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"

Further reading

Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { formConfig, buttonOnly, devOnly } = this.props;
    const devOnlyForceShowFormControls =
      environment.isLocalhost() &&
      !window.Cypress &&
Severity: Minor
Found in src/platform/forms/save-in-progress/SaveInProgressIntro.jsx - About 55 mins to fix

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"

Further reading

Function FormStartControls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const FormStartControls = props => {
  const {
    formId,
    migrations,
    startPage,
Severity: Minor
Found in src/platform/forms/save-in-progress/FormStartControls.jsx - About 55 mins to fix

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"

Further reading

Function testForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const testForm = testConfig => {
  const {
    appName,
    arrayPages = [],
    dataPrefix,
Severity: Minor
Found in src/platform/testing/e2e/cypress/support/form-tester/index.js - About 55 mins to fix

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"

Further reading

Function formatDowntime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const formatDowntime = dateTime => {
  let date;
  const timeZone = 'America/New_York';

  if (dateTime instanceof Object) {
Severity: Minor
Found in src/platform/utilities/date/index.js - About 55 mins to fix

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"

Further reading

Function VaFileInputField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const VaFileInputField = props => {
  const mappedProps = vaFileInputFieldMapping(props);
  const dispatch = useDispatch();
  const [file, setFile] = useState(null);
  const formData = useSelector(state => state.form.data);

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"

Further reading

Function vaTextInputFieldMapping has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function vaTextInputFieldMapping(props) {
  const {
    description,
    textDescription,
    DescriptionField,

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"

Further reading

Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    let beforeText = '';

    if (this.props.beforeText && this.props.beforeText === '«') {
      beforeText = (
Severity: Minor
Found in src/platform/forms-system/src/js/components/ProgressButton.jsx - About 55 mins to fix

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"

Further reading

Function titleUI has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const titleUI = (titleOption, descriptionOption) => {
  const {
    title,
    description,
    headerLevel,
Severity: Minor
Found in src/platform/forms-system/src/js/web-component-patterns/titlePattern.js - About 55 mins to fix

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"

Further reading

Function uiSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function uiSchema(
  label = 'Address',
  useStreet3 = false,
  isRequired = null,
  ignoreRequired = false,
Severity: Minor
Found in src/platform/forms/definitions/address.js - About 55 mins to fix

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"

Further reading

Function removeDeeplyEmptyObjects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function removeDeeplyEmptyObjects(root, checkEmpty = isEmpty) {
  // Check for null because typeof null === 'object', of course. Thanks JavaScript.
  if (typeof root !== 'object' || root === null) {
    return root;
  }
Severity: Minor
Found in src/platform/utilities/data/removeDeeplyEmptyObjects.js - About 55 mins to fix

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"

Further reading

Function FormSaveErrorMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function FormSaveErrorMessage(props) {
  const { route, formConfig, user, form, location, showLoginModal } = props;

  const savedStatus = form?.savedStatus;
  const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
Severity: Minor
Found in src/platform/forms/components/review/FormSaveErrorMessage.jsx - About 55 mins to fix

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"

Further reading

Function useEditOrAddForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function useEditOrAddForm({
  isEdit,
  schema,
  uiSchema,
  data,

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"

Further reading

Function updateUiSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function updateUiSchema(schema, uiSchema, formData) {
  if (!uiSchema) {
    return uiSchema;
  }

Severity: Minor
Found in src/platform/forms-system/src/js/state/helpers.js - About 55 mins to fix

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"

Further reading

Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      uiSchema,
      errorSchema,
      idSchema,
Severity: Minor
Found in src/platform/forms-system/src/js/fields/ArrayField.jsx - About 55 mins to fix

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"

Further reading

Function LoginActions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function LoginActions({ externalApplication }) {
  const [useOAuth, setOAuth] = useState();
  const { OAuth, redirectUri } = getQueryParams();
  const { allowedSignInProviders, allowedSignUpProviders, OAuthEnabled } =
    externalApplicationsConfig[externalApplication] ??
Severity: Minor
Found in src/platform/user/authentication/components/LoginActions.jsx - About 55 mins to fix

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"

Further reading

Function responsesMatchResultsDCs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const responsesMatchResultsDCs = (yesShortNames, pageDCsForFlow) => {
  const onlyYesResponse = pageDCsForFlow?.ONLY;

  // Results page requires "Yes" response for specific question category (i.e. Camp Lejeune)
  if (onlyYesResponse) {
Severity: Minor
Found in src/applications/pact-act/utilities/display-logic-results.js - About 55 mins to fix

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"

Further reading

Severity
Category
Status
Source
Language