cvut/fittable

View on GitHub

Showing 70 of 70 total issues

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

  callbacks: PropTypes.shape({
    search: PropTypes.func,
    data: PropTypes.func.isRequired,
    semesterData: PropTypes.func.isRequired,
    dateChange: PropTypes.func.isRequired,
Severity: Minor
Found in src/constants/propTypes.js and 1 other location - About 45 mins to fix
src/components/Grid.jsx on lines 8..13

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

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

  const ret = {
    cs: { courses: {}, teachers: {}, exceptions: {} },
    en: { courses: {}, teachers: {}, exceptions: {} },
  }
Severity: Minor
Found in src/dataManipulation.js and 1 other location - About 45 mins to fix
src/reducers/dataReducer.js on lines 7..10

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

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

        linkNames: {
          cs: { courses: {}, teachers: {}, exceptions: {} },
          en: { courses: {}, teachers: {}, exceptions: {} },
        },
      Severity: Minor
      Found in src/reducers/dataReducer.js and 1 other location - About 45 mins to fix
      src/dataManipulation.js on lines 4..7

      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

      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