FujitsuLaboratories/cattaz

View on GitHub

Showing 29 of 110 total issues

File KanbanApplication.jsx has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import isEqual from 'lodash/isEqual';
import assign from 'lodash/assign';
import clone from 'lodash/clone';
Severity: Minor
Found in src/apps/KanbanApplication.jsx - About 7 hrs to fix

    Function renderCustomHast has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

      static renderCustomHast(customHast, ctx = {}) {
        function h(name, properties, children) {
          if (name.indexOf('app:') === 0) {
            const appName = name.substring(4);
            const appComponent = Apps[appName];
    Severity: Minor
    Found in src/WikiParser.js - About 5 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 render has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { modalIsOpen, deletePageName, deleteErrorMsg } = this.state;
        const modalStyles = {
          wrapper: {
            content: {
    Severity: Major
    Found in src/Main.jsx - About 5 hrs to fix

      Function componentDidMount has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        componentDidMount() {
          const { data } = this.props;
          const map = MapModel.deserialize(data);
          const doc = this.refIframe.current.contentWindow.document;
          doc.open();
      Severity: Major
      Found in src/apps/MapApplication.jsx - About 3 hrs to fix

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

          render() {
            const { data } = this.props;
            const { voted } = this.state;
            const model = VoteHelpfulModel.deserialize(data);
            const colors = { No: '#da3d3d', Yes: '#218bce' };
        Severity: Major
        Found in src/apps/VoteHelpfulApplication.jsx - About 3 hrs to fix

          File AppEnabledWikiEditorCodeMirror.jsx has 296 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import PropTypes from 'prop-types';
          import { diffChars } from 'diff';
          import { UnControlled as CodeMirror } from 'react-codemirror2';
          import 'codemirror/mode/markdown/markdown';
          Severity: Minor
          Found in src/AppEnabledWikiEditorCodeMirror.jsx - About 3 hrs to fix

            File Main.jsx has 294 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import { Link as RouterLink } from 'react-router-dom';
            import TimeAgo from 'react-timeago';
            import Modal from 'react-modal';
            import { createHashHistory } from 'history';
            Severity: Minor
            Found in src/Main.jsx - About 3 hrs to fix

              Function renderAnswers has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderAnswers(model) {
                  const { editing } = this.state;
                  const header = (
                    <tr>
                      <th>Attendees / Date</th>
              Severity: Major
              Found in src/apps/DateMatcherApplication.jsx - About 2 hrs to fix

                Function renderListPages has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  renderListPages() {
                    const { pages, currentPageNum, getPagesError } = this.state;
                    const metadataStyle = {
                      margin: '0 0 0 0.5em',
                      color: 'grey',
                Severity: Major
                Found in src/Main.jsx - About 2 hrs to fix

                  Function renderCustomHast has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static renderCustomHast(customHast, ctx = {}) {
                      function h(name, properties, children) {
                        if (name.indexOf('app:') === 0) {
                          const appName = name.substring(4);
                          const appComponent = Apps[appName];
                  Severity: Major
                  Found in src/WikiParser.js - About 2 hrs to fix

                    Function handleAppEdit has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      handleAppEdit(newText, appContext) {
                        const cm = this.refEditor.current.editor;
                        const startFencedStr = cm.getLine(appContext.position.start.line - 1);
                        const [backticks] = WikiParser.getExtraFencingChars(startFencedStr, newText);
                        if (backticks) {
                    Severity: Major
                    Found in src/AppEnabledWikiEditorCodeMirror.jsx - About 2 hrs to fix

                      Function h has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function h(name, properties, children) {
                            if (name.indexOf('app:') === 0) {
                              const appName = name.substring(4);
                              const appComponent = Apps[appName];
                              const position = JSON.parse(properties.position);
                      Severity: Minor
                      Found in src/WikiParser.js - About 1 hr to fix

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

                          render() {
                            const { doc, match } = this.props;
                            const pageName = match.params.page;
                            const roomName = doc ? null : pageName;
                            const defaultValue = doc ? `loading ${pageName}...` : `syncing with ${pageName}...`;
                        Severity: Minor
                        Found in src/Page.jsx - About 1 hr to fix

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

                          function configure(baseConfig, mode) {
                            const { config } = baseConfig;
                            config.devtool = mode === 'PRODUCTION' ? 'source-map' : 'eval-source-map';
                            config.resolve.extensions.push('.jsx');
                            config.plugins.push(new CopyWebpackPlugin({
                          Severity: Minor
                          Found in .storybook/webpack.config.js - About 1 hr to fix

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

                              render() {
                                const { data } = this.props;
                                const draw = DrawModel.deserialize(data);
                                const { electedTemp, start } = this.state;
                                let dispElected = electedTemp || draw.elected;
                            Severity: Minor
                            Found in src/apps/DrawApplication.jsx - About 1 hr to fix

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

                                render() {
                                  const { data } = this.props;
                                  const model = ReversiModel.deserialize(data);
                                  const cells = model.getCells();
                                  const counts = model.getStoneCounts();
                              Severity: Minor
                              Found in src/apps/ReversiApplication.jsx - About 1 hr to fix

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

                                  render() {
                                    const { data } = this.props;
                                    const model = VoteCryptoModel.deserialize(data);
                                    const { voteMessage, errorMessage } = this.state;
                                    let votingResult = '';
                                Severity: Minor
                                Found in src/apps/VoteCryptoApplication.jsx - About 1 hr to fix

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

                                    async getListPages() {
                                      try {
                                        const response = await window.fetch(`${url}/pages`, {
                                          headers,
                                        });
                                  Severity: Minor
                                  Found in src/Main.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 attendees has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      const attendees = Object.keys(model.attendees).map((attendeeName) => {
                                        const ans = model.attendees[attendeeName] || {};
                                        const isEditingRow = attendeeName === editing;
                                        return (
                                          <tr key={attendeeName}>
                                  Severity: Minor
                                  Found in src/apps/DateMatcherApplication.jsx - About 1 hr to fix

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

                                      static deserialize(str) {
                                        try {
                                          const reList = /^[*-]\s*(.*)$/;
                                          const reItem = /^\s+[*-]\s*(.*)$/;
                                          const reText = /^([*_]*)(.*?)([*_]*)$/;
                                    Severity: Minor
                                    Found in src/apps/KanbanApplication.jsx - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language