18F/State-TalentMAP

View on GitHub

Showing 14 of 15 total issues

Function login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function* login(credentials = {}) {
  const isSAML = auth.isSAMLAuth();
  let token = null;

  // if credentials is null, don't attempt login, to prevent a loop
Severity: Minor
Found in src/login/sagas.js - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { term, isNewTerm, hasErrored, submitGlossaryTerm } = this.props;
    const {
      editorHidden,
      newTitle,

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 11 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { details } = this.props;
    const { shouldShowDescriptionEditor, newDescriptionContent,
      shouldDisplayFullDescription } = this.state;

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 11 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { loading } = this.state;
    const {
      as: type,
      className,
Severity: Minor
Found in src/Components/Favorite/Favorite.jsx - About 1 hr 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 getProps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function getProps(options, roles, params = {}) {
  const missingRoles = difference(options.roles, roles);
  const props = {
    title: options.text,
    iconName: options.icon,

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 loginWatcher has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function* loginWatcher() {
  const evaluate = true;
  // Check if user entered already logged in or not
  while (evaluate) {
    const isSAML = (process.env.LOGIN_MODE === 'saml');
Severity: Minor
Found in src/login/sagas.js - About 1 hr 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 focusByFirstOfHeader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const focusByFirstOfHeader = (timeout = 1) => {
  setTimeout(() => {
    let element = document.getElementsByTagName('h1');
    if (element) { element = element[1]; }
    if (!element) { element = document.getElementsByTagName('h2')[0]; }
Severity: Minor
Found in src/utilities.js - About 1 hr 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 setupDefaultValues has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  setupDefaultValues(props) {
    const { skillsWasUpdated, gradeWasUpdated, qWasUpdated, bureauWasUpdated } = this.state;
    const { userProfile, defaultFilters } = props;

    // set default values for our filters
Severity: Minor
Found in src/Components/ResultsMultiSearchHeader/ResultsMultiSearchHeader.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 PositionInformation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PositionInformation = ({ assignment }) => {
  const assignmentStartDate = assignment.start_date ? formatDate(assignment.start_date) : false;
  const isActive = assignment.status === 'active';
  let assignmentEndDate;
  if (isActive) {

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 8 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { details } = this.props;
    const { shouldShowWebsiteEditor, shouldShowPocEditor,
      newWebsiteContent, newPocContent } = this.state;

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 ErrorMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ErrorMessage = ({ showEmptyWarning, error }) => {
  const showResponseError = isObject(error) ? error.hasErrored : error; // Deprecated prop
  const isError = (showEmptyWarning || showResponseError);

  let message;

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 ResultsCard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ResultsCard = (props) => {
  const options = {};
  const {
    id,
    result,
Severity: Minor
Found in src/Components/ResultsCard/ResultsCard.jsx - About 45 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 propSort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const propSort = (propName, nestedPropName) => (a, b) => {
  let A = a[propName];
  if (nestedPropName) { A = a[propName][nestedPropName]; }
  A = A.toString().toLowerCase();
  let B = b[propName];
Severity: Minor
Found in src/utilities.js - About 45 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 difference has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const difference = (base, object) => transform(object, (result, value, key) => {
  /* eslint-disable no-param-reassign */
  if (!isEqual(value, base[key])) {
    result[key] = isObject(value) && isObject(base[key]) ?
      difference(base[key], value) :
Severity: Minor
Found in src/utilities.js - About 35 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