cvut/fittable

View on GitHub

Showing 70 of 70 total issues

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

              <button
                type="button"
                className={ 'settings-toggle-btn ' + (locale === 'en' ? ' active' : '') }
                onClick={ handleSettingChange('locale', 'en') }
              >
Severity: Major
Found in src/components/FunctionSettings.jsx and 1 other location - About 1 hr to fix
src/components/FunctionSettings.jsx on lines 52..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 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

              <button
                type="button"
                className={ 'settings-toggle-btn ' + (locale === 'cs' ? ' active' : '') }
                onClick={ handleSettingChange('locale', 'cs') }
              >
Severity: Major
Found in src/components/FunctionSettings.jsx and 1 other location - About 1 hr to fix
src/components/FunctionSettings.jsx on lines 59..65

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

function createDayEvents (props, animationDirection, events) {
  // warn: mutates the given value!
  const hideFilteredEvent = (event) => {
    if (!props.displayFilter[event.type]) {
      event._appear = 'hide'
Severity: Minor
Found in src/components/Timetable.jsx - About 1 hr to fix

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

      render () {
        let functionToRender
    
        if (this.props.opened === 'settings') {
          functionToRender = (
    Severity: Minor
    Found in src/components/FunctionsSidebar.jsx - About 1 hr to fix

      Function getPositionStyle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function getPositionStyle ({layout, align, data, expanded, screenSize}) {
        const length = data._length * 100 + '%'
        const position = data._position * 100 + '%'
      
        const isHorizontal = isScreenLarge(screenSize) && layout === 'horizontal'
      Severity: Minor
      Found in src/components/Event.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 createStore has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createStore (initialState) {
        const middlewares = [
          thunk,
        ]
      
      
      Severity: Minor
      Found in src/store/index.js - About 1 hr to fix

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

          render () {
            return (
              <div className="functions-bar">
                <button
                  type="button"
        Severity: Minor
        Found in src/components/FunctionsBar.jsx - About 1 hr to fix

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

            renderSemesterSelector () {
              const name = semesterName(CP.translate.bind(CP), this.props.semester) ||
                           CP.translate('weekNav.unknown_semester')
              const viewMoment = this.viewDateMoment()
          
          
          Severity: Minor
          Found in src/components/WeekSwitcher.jsx - About 1 hr to fix

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

              render () {
                const icalUrl = this.getIcalUrl()
                return (
                  <div className="function SidebarIcal" ref="rootEl">
                    <div className="clearfix" />
            Severity: Minor
            Found in src/components/SidebarIcal.jsx - About 1 hr to fix

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

                render () {
              
                  return (
                    <div className="week-nav">
                      <button
              Severity: Minor
              Found in src/components/WeekNav.jsx - About 1 hr to fix

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

                function fetchUserCallback (cb) {
                  function requestHandler (request) {
                    if (request.readyState === XMLHttpRequest.DONE) {
                      if (request.status === 200) {
                        // Request successful
                Severity: Minor
                Found in src/callbacks/sirius.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 eventExceptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  eventExceptions () {
                    const { appliedExceptions } = this.props.data.details
                
                    if (appliedExceptions && appliedExceptions.length > 0) {
                      const exceptionDesc = this.props.data.cancelled ? 'detail.cancelled' : 'detail.modified'
                Severity: Minor
                Found in src/components/EventDetail.jsx - About 1 hr to fix

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

                  export function invertLinkNames (linksNames) {
                    const ret = {
                      cs: { courses: {}, teachers: {}, exceptions: {} },
                      en: { courses: {}, teachers: {}, exceptions: {} },
                    }
                  Severity: Minor
                  Found in src/dataManipulation.js - About 1 hr to fix

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

                      eventBasicProps () {
                        const { data } = this.props
                        const seqNumber = data.sequenceNumber || '?'
                    
                        const nameButton = (
                    Severity: Minor
                    Found in src/components/EventDetail.jsx - About 1 hr to fix

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

                        renderMonthSelector () {
                      
                          const viewMoment = this.viewDateMoment()
                      
                          return (
                      Severity: Minor
                      Found in src/components/WeekSwitcher.jsx - About 1 hr to fix

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

                        export function invertLinkNames (linksNames) {
                          const ret = {
                            cs: { courses: {}, teachers: {}, exceptions: {} },
                            en: { courses: {}, teachers: {}, exceptions: {} },
                          }
                        Severity: Minor
                        Found in src/dataManipulation.js - 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

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

                            }, {
                              id: Math.random().toString(36).substring(10).toUpperCase() + query,
                              title: 'Hodge-podge',
                              type: 'room'
                            }, {
                        Severity: Minor
                        Found in src/callbacks/faux.js and 1 other location - About 50 mins to fix
                        src/callbacks/faux.js on lines 209..213

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

                        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

                            }, {
                              id: Math.random().toString(36).substring(10).toUpperCase() + query,
                              title: 'Flim flam',
                              type: 'person'
                            }]);
                        Severity: Minor
                        Found in src/callbacks/faux.js and 1 other location - About 50 mins to fix
                        src/callbacks/faux.js on lines 205..209

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

                        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 propTypes = {
                          horizontal: PropTypes.bool,
                          hours: PropTypes.number.isRequired,
                          offset: PropTypes.number.isRequired,
                          color: PropTypes.string.isRequired,
                        Severity: Minor
                        Found in src/components/Grid.jsx and 1 other location - About 45 mins to fix
                        src/constants/propTypes.js on lines 28..33

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

                        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

                        Avoid deeply nested control flow statements.
                        Open

                                    for (let i = 0; i < ajaxresult.linked.teachers.length; i++) {
                                      // Add teacher link full name
                                      linknames.teachers.push({
                                        id: ajaxresult.linked.teachers[i].id,
                                        name: {
                        Severity: Major
                        Found in src/callbacks/sirius.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language