cvut/fittable

View on GitHub

Showing 70 of 70 total issues

Function dataCallback has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

function dataCallback ({calendarType, dateFrom, dateTo, calendarId}, callback) {
  // FIXME: until `me` is a valid shortcut on Sirius
  if (calendarId === 'me' && calendarType === 'people') {
    calendarId = username
  }
Severity: Minor
Found in src/callbacks/sirius.js - About 1 day 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

  handleNextClick () {
    const shiftFun = shiftDate(this.props.viewDate)
    const skipWeekend = !this.props.days7 && this.props.viewDate.getDay() === 5

    let shiftBy
Severity: Major
Found in src/components/Controls.jsx and 1 other location - About 5 hrs to fix
src/components/Controls.jsx on lines 29..41

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

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

  handlePrevClick () {
    const shiftFun = shiftDate(this.props.viewDate)
    const skipWeekend = !this.props.days7 && this.props.viewDate.getDay() === 1

    let shiftBy
Severity: Major
Found in src/components/Controls.jsx and 1 other location - About 5 hrs to fix
src/components/Controls.jsx on lines 46..58

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

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 3 locations. Consider refactoring.
Open

        <div className="row">
          <div className="column small-3">
            <div className="switch small">
              <input
                id="setting-days7"
Severity: Major
Found in src/components/FunctionSettings.jsx and 2 other locations - About 5 hrs to fix
src/components/FunctionSettings.jsx on lines 70..88
src/components/FunctionSettings.jsx on lines 108..126

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

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 3 locations. Consider refactoring.
Open

        <div className="row">
          <div className="column small-3">
            <div className="switch small">
              <input
                id="setting-facultygrid"
Severity: Major
Found in src/components/FunctionSettings.jsx and 2 other locations - About 5 hrs to fix
src/components/FunctionSettings.jsx on lines 70..88
src/components/FunctionSettings.jsx on lines 89..107

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

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 3 locations. Consider refactoring.
Open

        <div className="row">
          <div className="column small-3">
            <div className="switch small">
              <input
                id="setting-colors"
Severity: Major
Found in src/components/FunctionSettings.jsx and 2 other locations - About 5 hrs to fix
src/components/FunctionSettings.jsx on lines 89..107
src/components/FunctionSettings.jsx on lines 108..126

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

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

var dataCallback = function(params, callback) {
  const {calendarType, calendarId, dateFrom: from, dateTo: to} = params

  setTimeout(function(from, to) {
    var data = [];
Severity: Major
Found in src/callbacks/faux.js - About 4 hrs to fix

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

      render () {
        const { locale, layout, eventsColors, fullWeek, facultyGrid } = this.props.settings
        const handleSettingChange = (k, v) => this.props.onSettingChange.bind(null, k, v)
        return (
          <div
    Severity: Major
    Found in src/components/FunctionSettings.jsx - About 4 hrs to fix

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

            case 'unauthorized':
              return (
                <div className="error-message">
                  <i className="icon fa fa-lock"></i>
                  <h2>{CP.translate('errors.unauthorized_title')}</h2>
      Severity: Major
      Found in src/components/ErrorMessage.jsx and 1 other location - About 4 hrs to fix
      src/components/ErrorMessage.jsx on lines 104..115

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

      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

            case 'servererror':
              return (
                <div className="error-message">
                  <i className="icon fa fa-lock"></i>
                  <h2>{CP.translate('errors.unauthorized_title')}</h2>
      Severity: Major
      Found in src/components/ErrorMessage.jsx and 1 other location - About 4 hrs to fix
      src/components/ErrorMessage.jsx on lines 92..103

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

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

        render () {
          const {onErrorHide, type, visible} = this.props
          if (!visible) {
            // null or false is legit to render for React
            return null
      Severity: Major
      Found in src/components/ErrorMessage.jsx - About 4 hrs to fix

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

            }, {
              id: "18000-B151",
              semester: "B151",
              faculty: 18000,
              startsOn: fmoment('2015-10-05'),
        Severity: Major
        Found in src/callbacks/faux.js and 1 other location - About 3 hrs to fix
        src/callbacks/faux.js on lines 147..169

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

        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

            callback([{
              id: "18000-B142",
              semester: "B142",
              faculty: 18000,
              startsOn: fmoment('2015-02-16'),
        Severity: Major
        Found in src/callbacks/faux.js and 1 other location - About 3 hrs to fix
        src/callbacks/faux.js on lines 169..191

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

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

          function requestHandler (request) {
            if (request.readyState === XMLHttpRequest.DONE) {
              if (request.status === 200) {
                // Request successful
                const ajaxresult = JSON.parse(request.responseText)
        Severity: Major
        Found in src/callbacks/sirius.js - About 3 hrs to fix

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

            render () {
              // FIXME: side effects!!!
          
              const props = this.props
              const { locale, layout, fullWeek, eventsColors, facultyGrid } = props.settings
          Severity: Major
          Found in src/containers/FittableContainer.jsx - About 3 hrs to fix

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

                  case 'ownnotfound':
                    return (
                      <div className="error-message">
                        <i className="icon fa fa-calendar-o"></i>
                        <h2>{CP.translate('errors.ownnotfound_title')}</h2>
            Severity: Major
            Found in src/components/ErrorMessage.jsx and 1 other location - About 3 hrs to fix
            src/components/ErrorMessage.jsx on lines 57..67

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

            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

                  case 'notfound':
                    return (
                      <div className="error-message">
                        <i className="icon fa fa-calendar-o"></i>
                        <h2>{CP.translate('errors.notfound_title')}</h2>
            Severity: Major
            Found in src/components/ErrorMessage.jsx and 1 other location - About 3 hrs to fix
            src/components/ErrorMessage.jsx on lines 68..78

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

            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

                    <div className="column small-3 gr-go">
                      <button
                        type="button"
                        className="gr-go-btn"
                        onClick={this.onDateChange(viewMoment().add(1, 'months').startOf('isoWeek'))}
            Severity: Major
            Found in src/components/WeekSwitcher.jsx and 1 other location - About 2 hrs to fix
            src/components/WeekSwitcher.jsx on lines 75..83

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

            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

                    <div className="column small-3 gr-go">
                      <button
                        type="button"
                        className="gr-go-btn"
                        onClick={this.onDateChange(viewMoment().subtract(1, 'months').startOf('isoWeek'))}
            Severity: Major
            Found in src/components/WeekSwitcher.jsx and 1 other location - About 2 hrs to fix
            src/components/WeekSwitcher.jsx on lines 87..95

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

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

              render () {
            
                const viewMoment = this.viewDateMoment()
                const monthEnd = viewMoment().endOf('month').endOf('isoWeek')
                const weeks = [ [], [], [], [], [], [], [] ]
            Severity: Major
            Found in src/components/WeekSwitcher.jsx - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language