Showing 132 of 502 total issues

Function renderMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const renderMessage = (id, messageString, titleString) => {
  const noteId = `${id}.note`
  let note = i18n.m(noteId)
  if (
    Object.prototype.toString.call(note) === '[object String]'
Severity: Minor
Found in src/components/Form/Field/Field.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 componentDidMount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidMount() {
    if (this.props.children) {
      let arr = []
      for (let child of this.props.children) {
        if (child && child.type === 'option') {
Severity: Minor
Found in src/components/Form/Dropdown/Dropdown.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

Consider simplifying this complex logical expression.
Open

      if (props.required) {
        const country = countryString(props.country)
        switch (country) {
          case 'United States':
          case 'POSTOFFICE':
Severity: Major
Found in src/components/Form/Location/Address.jsx - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

          if (
            a.Item && a.Item.Dates && validDate(a.Item.Dates.to)
            && b.Item && b.Item.Dates && validDate(b.Item.Dates.to)
          ) {
            const aDateObj = a.Item.Dates.to
    Severity: Major
    Found in src/components/Section/History/Employment/Employment.jsx - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if (url === '' && window) {
            const loc = window.location || {}
            const protocol = loc.protocol || 'http:'
            const hostname = loc.hostname || 'localhost'
            const port = loc.port || '8080'
      Severity: Major
      Found in src/config/environment.js - About 40 mins to fix

        Method Service.CountExpr has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (service *Service) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
        Severity: Minor
        Found in api/postgresql/db.go - About 35 mins to fix

          Method DatabaseService.Array has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (service *DatabaseService) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
          Severity: Minor
          Found in api/mock/database.go - About 35 mins to fix

            Method Service.Array has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (service *Service) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
            Severity: Minor
            Found in api/postgresql/db.go - About 35 mins to fix

              Method DatabaseService.CountExpr has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (service *DatabaseService) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
              Severity: Minor
              Found in api/mock/database.go - About 35 mins to fix

                Method SaveHandler.ServeHTTP has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                Open

                func (service SaveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
                
                    // Get account information
                    account, _ := AccountAndSessionFromRequestContext(r)
                
                
                Severity: Minor
                Found in api/http/save.go - 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

                Method applicationPackager.locationOverrideLayout has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                Open

                func (p applicationPackager) locationOverrideLayout(data map[string]interface{}, override string) (template.HTML, error) {
                    // Deserialize the initial payload from a JSON structure
                    payload := &api.Payload{}
                    // entity, err := payload.UnmarshalEntity(getInterfaceAsBytes(data))
                    entity, err := payload.UnmarshalEntity(getInterfaceAsBytes(data))
                Severity: Minor
                Found in api/xml/xml.go - 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

                Function sectionTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                const sectionTitle = (el) => {
                  const content = closest(el, '.section-content')
                
                  if (!content) {
                    return null
                Severity: Minor
                Found in src/components/ErrorList/ErrorList.jsx - 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

                Function handleInitSuccess has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function* handleInitSuccess(action, path = '/form/identification/intro') {
                  const { response } = action
                
                  if (response && response.data) {
                    const { Status, Hash } = response.data
                Severity: Minor
                Found in src/sagas/initialize.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

                Function updateSingleCountry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  updateSingleCountry(values) {
                    const { value } = values
                    let arr
                    let capitalizedCountry
                    if (value) {
                Severity: Minor
                Found in src/components/Form/Country/Country.jsx - 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

                Function getSplitValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                const getSplitValue = (key, raw, delim1, delim2) => {
                  const vars = raw.split(delim1)
                
                  for (let i = 0; i < vars.length; i += 1) {
                    const pair = vars[i].split(delim2)
                Severity: Minor
                Found in src/services/api.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

                Function componentWillReceiveProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  componentWillReceiveProps(next) {
                    const updates = {}
                
                    if (next.receiveProps) {
                      if (next.value !== this.state.value) {
                Severity: Minor
                Found in src/components/Form/Dropdown/Dropdown.jsx - 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

                Function AddressSummary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const AddressSummary = (props, unknown = '') => {
                  if (!props) {
                    return unknown
                  }
                
                
                Severity: Minor
                Found in src/components/Summary/AddressSummary.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

                Function countryString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const countryString = (country) => {
                  if (validate.isHash(country)) {
                    if (country.value === null) return null
                    if (country.value === undefined) return undefined
                
                
                Severity: Minor
                Found in src/validators/location.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

                Method Service.validate has 11 return statements (exceeds 10 allowed).
                Open

                func (service *Service) validate(response *saml.Response, original string) error {
                    if response.Version != "2.0" {
                        return errors.New("unsupported SAML Version")
                    }
                
                
                Severity: Major
                Found in api/saml/saml.go - About 35 mins to fix

                  Function EducationSummaryProgress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const EducationSummaryProgress = (props) => {
                    const { items, errors } = props
                  
                    const validSchoolItems = items.filter((i) => {
                      if (!i.Item) return false
                  Severity: Minor
                  Found in src/components/Section/History/Education/EducationSummaryProgress.jsx - 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