just-paja/improtresk-web

View on GitHub

Showing 176 of 176 total issues

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

StayLengthPicker.propTypes = {
  end: PropTypes.string.isRequired,
  input: PropTypes.object.isRequired,
  meta: PropTypes.object.isRequired,
  start: PropTypes.string.isRequired
Severity: Major
Found in src/orders/components/StayLengthPicker.jsx and 1 other location - About 1 hr to fix
src/components/HelmetArticle.jsx on lines 24..29

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 64.

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

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

export const orderChangeWorkshop = ({ formData, order, ...params }) =>
  apiFetchAuthorized(`orders/${order}/`, {
    ...params,
    body: JSON.stringify(formData),
    method: 'PATCH'
Severity: Major
Found in src/api.js and 1 other location - About 1 hr to fix
src/api.js on lines 138..143

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 64.

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

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

HelmetArticle.propTypes = {
  createdAt: PropTypes.string.isRequired,
  description: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired,
  updatedAt: PropTypes.string.isRequired
Severity: Major
Found in src/components/HelmetArticle.jsx and 1 other location - About 1 hr to fix
src/orders/components/StayLengthPicker.jsx on lines 82..87

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 64.

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

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

          <InputRadioGroup
            disabled={disabled}
            name={`food_${id}`}
            label='Hlavní chod'
            onChange={this.handleChangeFood}
Severity: Major
Found in src/orders/components/FoodPickerItem.jsx and 1 other location - About 1 hr to fix
src/orders/components/FoodPickerItem.jsx on lines 56..64

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 63.

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

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

          <InputRadioGroup
            disabled={disabled}
            name={`soup_${id}`}
            label='Polévka'
            onChange={this.handleChangeSoup}
Severity: Major
Found in src/orders/components/FoodPickerItem.jsx and 1 other location - About 1 hr to fix
src/orders/components/FoodPickerItem.jsx on lines 65..73

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 63.

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 render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { input, meta } = this.props
    const dates = this.getDates()
    return (
      <div>
Severity: Minor
Found in src/orders/components/StayLengthPicker.jsx - About 1 hr to fix

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

        const {
          activeRequests,
          currentYear,
          entryPath,
          host,
    Severity: Major
    Found in src/components/App.jsx and 1 other location - About 1 hr to fix
    src/polls/components/PollAnswer.jsx on lines 24..35

    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 62.

    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

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

        const {
          closed,
          description,
          disabled,
          image,
    Severity: Major
    Found in src/polls/components/PollAnswer.jsx and 1 other location - About 1 hr to fix
    src/components/App.jsx on lines 75..86

    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 62.

    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 render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render () {
        const {
          answers,
          closed,
          loading,
    Severity: Minor
    Found in src/polls/components/PollQuestion.jsx - About 1 hr to fix

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

        render () {
          const {
            errors,
            loading,
            meals,
      Severity: Minor
      Found in src/participants/components/ChangeFood.jsx - About 1 hr to fix

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

          render () {
            const {
              errors,
              loading,
              submitErrors,
        Severity: Minor
        Found in src/participants/components/ChangeWorkshop.jsx - About 1 hr to fix

          Function server has 32 lines of code (exceeds 25 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 1 hr to fix

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

              render () {
                const {
                  signupsClosed,
                  onSignupsOpen,
                  signupsOpen,
            Severity: Minor
            Found in src/pages/components/Signup.jsx - About 1 hr to fix

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

                render () {
                  const {
                    changeWorkshop,
                    order,
                    onChangeWorkshopChange,
              Severity: Minor
              Found in src/pages/components/ChangeWorkshop.jsx - About 1 hr to fix

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

                  constructor () {
                    super()
                    this.handleChange = this.handleChange.bind(this)
                    this.handleSubmit = this.handleSubmit.bind(this)
                  }
                Severity: Major
                Found in src/participants/components/ChangeWorkshop.jsx and 3 other locations - About 1 hr to fix
                src/orders/components/FoodPickerItem.jsx on lines 17..21
                src/participants/components/ChangeFood.jsx on lines 11..15
                src/roommates/components/RoomPickerItem.jsx on lines 18..22

                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 60.

                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

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

                  constructor () {
                    super()
                    this.handleJoin = this.handleJoin.bind(this)
                    this.handleLeave = this.handleLeave.bind(this)
                  }
                Severity: Major
                Found in src/roommates/components/RoomPickerItem.jsx and 3 other locations - About 1 hr to fix
                src/orders/components/FoodPickerItem.jsx on lines 17..21
                src/participants/components/ChangeFood.jsx on lines 11..15
                src/participants/components/ChangeWorkshop.jsx on lines 11..15

                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 60.

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

                const RegistrationStatus = ({
                  activeOrder,
                  onCancel,
                  onConfirm,
                  registrationsCloseDate
                Severity: Minor
                Found in src/orders/components/RegistrationStatus.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

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

                    yield call(fetchResource, api.fetchCapacity, {
                      actions: {
                        start: constants.YEAR_CAPACITY_UPDATE_STARTED,
                        success: constants.YEAR_CAPACITY_UPDATE_SUCCESS,
                        fail: constants.YEAR_CAPACITY_UPDATE_ERROR
                Severity: Major
                Found in src/years/sagas/fetchYearCapacity.js and 1 other location - About 1 hr to fix
                src/years/sagas/fetchYearCapacity.js on lines 17..24

                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 60.

                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

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

                  constructor () {
                    super()
                    this.handleChangeFood = this.handleChangeFood.bind(this)
                    this.handleChangeSoup = this.handleChangeSoup.bind(this)
                  }
                Severity: Major
                Found in src/orders/components/FoodPickerItem.jsx and 3 other locations - About 1 hr to fix
                src/participants/components/ChangeFood.jsx on lines 11..15
                src/participants/components/ChangeWorkshop.jsx on lines 11..15
                src/roommates/components/RoomPickerItem.jsx on lines 18..22

                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 60.

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

                  year => (year && year.priceLevels ? year.priceLevels
                    .slice()
                    .sort((a, b) => {
                      if (a.takesEffectOn > b.takesEffectOn) {
                        return -1
                Severity: Minor
                Found in src/years/selectors/yearPrices.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

                Severity
                Category
                Status
                Source
                Language