cvut/fittable

View on GitHub

Showing 37 of 70 total issues

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

                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

                  Avoid deeply nested control flow statements.
                  Open

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

                    Avoid deeply nested control flow statements.
                    Open

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

                      Function calculateOverlap has a Cognitive Complexity of 8 (exceeds 5 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 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 NowIndicator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function NowIndicator ({
                          currentDate, timeline, viewDate, days7, screenSize, horizontalLayout }) {
                      
                        const now = moment(currentDate)
                      
                      
                      Severity: Minor
                      Found in src/components/NowIndicator.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 semesterDataCallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function semesterDataCallback (callback) {
                        function requestHandler (request) {
                          if (request.readyState === XMLHttpRequest.DONE) {
                      
                            // Request successful
                      Severity: Minor
                      Found in src/callbacks/sirius.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 viewDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        viewDate () {
                          const rangeFun = this.props.days7 ? weekRange : workWeekRange
                      
                          // FIXME: remove moment dependency
                          const [weekStart, weekEnd] = rangeFun(this.props.viewDate).map(d => moment(d))
                      Severity: Minor
                      Found in src/components/WeekNav.jsx - About 25 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 searchCallback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function searchCallback (query, callback) {
                        function requestHandler (request) {
                          if (request.readyState === XMLHttpRequest.DONE) {
                            if (request.status === 200) {
                              // Request successful
                      Severity: Minor
                      Found in src/callbacks/sirius.js - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language