wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

Function constructor has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public constructor() {
    this.renderings.push(() => {
      this.cy = Cytoscape({
        elements: [],
        boxSelectionEnabled: false,
Severity: Major
Found in src/ts/permutator/findTimetableVisualizer.ts - About 2 hrs to fix

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

      public render() {
        let style = {
          ...tableStyle,
        };
        style = {
    Severity: Major
    Found in src/ts/react/panels/stackPanel.tsx - About 2 hrs to fix

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

      fs.writeFile(containerFileName, containerSnippet, function (err) {
        if (err) {
          return console.log(err);
        }
        shell.exec(`code ${containerFileName}`);
      Severity: Major
      Found in scripts/generate-view-container.js and 1 other location - About 2 hrs to fix
      scripts/generate-view-container.js on lines 45..51

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

      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

      fs.writeFile(viewFileName, viewSnippet, function (err) {
        if (err) {
          return console.log(err);
        }
        shell.exec(`code ${viewFileName}`);
      Severity: Major
      Found in scripts/generate-view-container.js and 1 other location - About 2 hrs to fix
      scripts/generate-view-container.js on lines 79..85

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

      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 GenerateSlotAndDayLayouts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export function GenerateSlotAndDayLayouts(
        rawSlots: ISlotViewModel[],
        xOffset: number,
        yOffset: number
      ): [ReactGridLayout.Layout[], ReactGridLayout.Layout[]] {
      Severity: Minor
      Found in src/ts/react/timetableView/generateSlotAndDayLayouts.ts - About 2 hrs 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 moveElement has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
        if (l.static) return layout;
      
        // Short-circuit if nothing to do.
        if (l.y === y && l.x === x) return layout;
      Severity: Minor
      Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 2 hrs 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 processGridItem has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        ReactGridLayout.prototype.processGridItem = function processGridItem(child) {
          if (!child.key) return;
          var l = (0, _utils.getLayoutItem)(this.state.layout, String(child.key));
          if (!l) return null;
          var _props4 = this.props,

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

          public render() {
            const buttonStyle: React.CSSProperties = {
              marginRight: "10px",
            };
            return (
        Severity: Minor
        Found in src/ts/react/getSemStartDateDialog.tsx - About 2 hrs to fix

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

            public render() {
              const expectedHitCount = this.props.expectedHitCount();
              const percentage = (
                (expectedHitCount / this.props.actualHitCount) *
                100
          Severity: Minor
          Found in src/ts/react/algorithmVisualizerView.tsx - About 2 hrs to fix

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

            const ParseStudentHtmlToRawSlot = (() => {
              const currentYear = new Date().getFullYear();
              if (currentYear > 2019) {
                console.log("Using ParseStudentHtmlToRawSlot_v2");
                return ParseStudentHtmlToRawSlot_v2;
            Severity: Major
            Found in src/ts/react/login.tsx and 1 other location - About 2 hrs to fix
            src/ts/react/fgoView.tsx on lines 11..20

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

            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 ParseFgoHtmlToRawSlot = (() => {
              const currentYear = new Date().getFullYear();
              if (currentYear > 2019) {
                console.log("Using ParseFgoHtmlToRawSlot_v2");
                return ParseFgoHtmlToRawSlot_v2;
            Severity: Major
            Found in src/ts/react/fgoView.tsx and 1 other location - About 2 hrs to fix
            src/ts/react/login.tsx on lines 19..28

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

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

              public render() {
                const divStyle: React.CSSProperties = {
                  background: this.props.isSelected ? Colors.Azure : Colors.White,
                };
                const primary = (
            Severity: Minor
            Found in src/ts/react/subjectView.tsx - About 1 hr to fix

              Function ParseStudentHtmlToRawSlot_v2 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function ParseStudentHtmlToRawSlot_v2(html: string): RawSlot[] {
                const result = new Array<RawSlot>();
                const htmlDoc = new DOMParser().parseFromString(html, "text/html");
                // @ts-ignore
                const tableRows = Array.from(
              Severity: Minor
              Found in src/ts/parser/parseStudentHtmlToRawSlot_v2.ts - 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 moveElementAwayFromCollision has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              function moveElementAwayFromCollision(layout, collidesWith, itemToMove, isUserAction, compactType, cols) {
              
                var compactH = compactType === 'horizontal';
                var compactV = compactType === 'vertical';
                var preventCollision = false; // we're already colliding
              Severity: Minor
              Found in src/ts/modified_node_modules/react-grid-layout/build/utils.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

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

                maxH: function maxH(props, propName) {
                  var value = props[propName];
                  if (typeof value !== 'number') return new Error('maxHeight not Number');
                  if (value < props.h || value < props.minH) return new Error('maxHeight smaller than item height/minHeight');
                },
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 450..454
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 456..460

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

              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

                minH: function minH(props, propName) {
                  var value = props[propName];
                  if (typeof value !== 'number') return new Error('minHeight not Number');
                  if (value > props.h || value > props.maxH) return new Error('minHeight larger than item height/maxHeight');
                },
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 450..454
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 462..466

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

              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

                maxW: function maxW(props, propName) {
                  var value = props[propName];
                  if (typeof value !== 'number') return new Error('maxWidth not Number');
                  if (value < props.w || value < props.minW) return new Error('maxWidth smaller than item width/minWidth');
                },
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 456..460
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 462..466

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

              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

                  var _props8 = this.props,
                      x = _props8.x,
                      y = _props8.y,
                      w = _props8.w,
                      h = _props8.h,
              src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 309..316

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

              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

                  var _props3 = this.props,
                      width = _props3.width,
                      cols = _props3.cols,
                      margin = _props3.margin,
                      containerPadding = _props3.containerPadding,
              src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 387..394

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

              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

                for (let i = 0; i < timetables.length; i++) {
                  for (let j = 0; j < 7; j++) {
                    result[j] |= timetables[i].DayTimeMatrix[j];
                  }
                }
              Severity: Major
              Found in src/ts/model/matrix/generateTotalMatrix.ts and 1 other location - About 1 hr to fix
              src/ts/model/matrix/generateTotalMatrix.ts on lines 82..86

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

              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

              Severity
              Category
              Status
              Source
              Language