cvut/fittable

View on GitHub

Showing 37 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

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

      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

        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

            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

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

                render () {
                  const layout = isScreenLarge(this.props.screenSize) ? this.props.layout : 'vertical'
                  const dayCount = (this.props.days7 || isScreenSmall(this.props.screenSize) ? 7 : 5)
              
                  const timeline = createTimeline(this.props.grid)
              Severity: Major
              Found in src/components/Timetable.jsx - About 2 hrs to fix

                Function semesterDataCallback has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var semesterDataCallback = function(callback) {
                
                  setTimeout(function() {
                
                    callback([{
                Severity: Minor
                Found in src/callbacks/faux.js - About 1 hr to fix

                  Function render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render () {
                  
                      const viewMoment = this.viewDateMoment()
                      const monthEnd = viewMoment().endOf('month').endOf('isoWeek')
                      const weeks = [ [], [], [], [], [], [], [] ]
                  Severity: Minor
                  Found in src/components/WeekSwitcher.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 render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render () {
                      const searchResultsClass = 'Search-results' +
                        (this.props.searchResults.length ? ' is-active' : '')
                  
                      return (
                  Severity: Minor
                  Found in src/components/Search.jsx - About 1 hr to fix

                    Function data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            const data = responseEvents.map(event => {
                              // And add new event to array
                              const newEvent = {
                                id: event.id,
                                name: event.name,
                    Severity: Minor
                    Found in src/callbacks/sirius.js - About 1 hr to fix

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

                        render () {
                          const { expanded, data, colored, onClick } = this.props
                      
                          const onClickVal = expanded ? null : data.id
                          const headSpaceStyle = expanded ? {height: EVENT_HEAD_HEIGHT} : {}
                      Severity: Minor
                      Found in src/components/Event.jsx - About 1 hr to fix

                        Function calculateOverlap has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function calculateOverlap (events) {
                          let lastend = moment(0)
                        
                          const sortByStart = ({startsAt: lhs}, {startsAt: rhs}) => {
                            const lhsD = moment(lhs)
                        Severity: Minor
                        Found in src/timetable.js - About 1 hr to fix

                          Function data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function data (state = initialState, action) {
                            switch (action.type) {
                              case EVENTS_LOAD_STARTED:
                                return {
                                  ...state,
                          Severity: Minor
                          Found in src/reducers/dataReducer.js - About 1 hr to fix

                            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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language