just-paja/improtresk-web

View on GitHub

Showing 46 of 176 total issues

Function renderFoodFooter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const renderFoodFooter = (order, isFoodPickingAllowed) => {
  let alert
  const foodSelected = isFoodSelected(order.meals)

  if (order.meals.length === 0) {
Severity: Minor
Found in src/orders/components/OrderFood.jsx - About 1 hr to fix

    Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render () {
        const {
          date,
          disabled,
          form,
    Severity: Minor
    Found in src/orders/components/MealPickerItem.jsx - About 1 hr to fix

      Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render () {
          const {
            autoValue,
            checked,
            error,
      Severity: Minor
      Found in src/forms/components/InputRadio.jsx - About 1 hr to fix

        Function calculatePrice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const calculatePrice = (form, workshops, meals, priceLevel) => {
          let price = 0
          if (!form) {
            return price
          }
        Severity: Minor
        Found in src/orders/selectors/index.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 configureStore has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function configureStore (initialState = {}, history) {
          const middlewares = []
        
          if (history) {
            middlewares.push(routerMiddleware(history))
        Severity: Minor
        Found in src/store.js - About 1 hr to fix

          Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render () {
              const { participant, room, selected } = this.props
              return (
                <Card className={classnames('mb-3', { 'bg-success': selected })}>
                  <CardHeader className={classnames({ 'text-white': selected })}>
          Severity: Minor
          Found in src/roommates/components/RoomPickerItem.jsx - About 1 hr to fix

            Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render () {
                const { photos, ...other } = this.props
                const photosMapped = photos.map(photo => ({
                  caption: photo.caption,
                  src: photo.image,
            Severity: Minor
            Found in src/components/Gallery.jsx - About 1 hr to fix

              Function getSignupText has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const getSignupText = (endAt, startAt, alreadyFull) => {
                if (moment().isBefore(startAt)) {
                  return {
                    disabled: true,
                    showStartDate: true,
              Severity: Minor
              Found in src/participants/components/SignupButton.jsx - About 1 hr to fix

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

                const Prop = ({ children, icon, label }) => (
                  children ? (
                    <li>
                      <Flex>
                        <span className='mr-1'>
                Severity: Minor
                Found in src/components/Prop.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 OrderStatusLabel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                const OrderStatusLabel = ({
                  assigned,
                  cancelled,
                  confirmed,
                  endsAt,
                Severity: Minor
                Found in src/orders/components/OrderStatusLabel.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  render () {
                    const {
                      assigned,
                      capacity,
                      disabled,
                Severity: Minor
                Found in src/orders/components/WorkshopPickerItem.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 (
                    item &&
                    item.reservation &&
                    item.reservation.workshopPrice &&
                    item.reservation.workshopPrice.workshop &&
                Severity: Major
                Found in src/orders/selectors/index.js - About 40 mins to fix

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

                  export const transformLectorRole = (lectors, roles) => (lectorPosition) => {
                    if (lectorPosition && lectors && roles) {
                      const lector = lectors.find(lectorItem => lectorPosition.lector === lectorItem.id)
                      const role = findLectorRoleName(roles, lectorPosition.role)
                      if (lector && role) {
                  Severity: Minor
                  Found in src/workshops/selectors/workshops.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 Input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Input = ({
                    currentLanguage,
                    disabled,
                    dispatch,
                    help,
                  Severity: Minor
                  Found in src/forms/components/Input.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 getFatalErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getFatalErrors = (object, errors = []) => {
                    Object.keys(object).forEach((objectKey) => {
                      const val = object[objectKey]
                  
                      if (val) {
                  Severity: Minor
                  Found in src/selectors/app.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 countReducerFlags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const countReducerFlags = (key, object) =>
                    Object.keys(object).reduce((count, objectKey) => {
                      let total = count
                  
                      if (objectKey === key && object[key]) {
                  Severity: Minor
                  Found in src/selectors/app.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 server has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function server (userConfig = {}) {
                    const app = express()
                    const config = configure(userConfig)
                  
                    logger.level = config.logLevel
                  Severity: Minor
                  Found in src/server/index.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

                  Avoid too many return statements within this function.
                  Open

                      return <Label className='mb-0 text-warning'><Message name='orders.waitingToBePaid' /></Label>
                  Severity: Major
                  Found in src/orders/components/OrderStatusLabel.jsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return <Label className='mb-0 text-warning'><Message name='orders.timedOut' /></Label>
                    Severity: Major
                    Found in src/orders/components/OrderStatusLabel.jsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return <Label className='mb-0 text-danger'><Message name='orders.unconfirmed' /></Label>
                      Severity: Major
                      Found in src/orders/components/OrderStatusLabel.jsx - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language