simlify/simlify

View on GitHub

Showing 22 of 22 total issues

NodeBase has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

export class NodeBase {
  id: string;
  parentFlow: Flow;
  inputPorts: InputPort[];
  outputPorts: OutputPort[];
Severity: Minor
Found in packages/server/src/nodes/nodeBase/NodeBase.ts - About 2 hrs to fix

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

    function Bezier(props) {
      const {
        width,
        height,
        className = '',
    Severity: Major
    Found in packages/client/app/components/Bezier/Bezier.js - About 2 hrs to fix

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

        createOptions() {
          const options: OptionsBase = {
            settings: [
              {
                name: 'host',
      Severity: Minor
      Found in packages/server/src/nodes/nodeTemplates/MQTT.ts - About 1 hr to fix

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

          render() {
            const { isImportDialogOpen, isDeleteDialogOpen } = this.state;
            const { flows, currentFlowIndex, currentFlowState } = this.props.flowData;
            const { availableNodes, selectedNodeModel } = this.props.nodeData;
        
        
        Severity: Minor
        Found in packages/client/app/view/Simulator/Simulator.js - About 1 hr to fix

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

          function renderActions(handleClose, handleDelete) {
            return(
              <DialogActions>
                <Button onClick={handleClose} color="primary">
                  Cancle
          packages/client/app/view/Simulator/ImportDialog/ImportDialog.js on lines 11..22

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

          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

          function renderActions(handleClose, handleImport) {
            return(
              <DialogActions>
                <Button onClick={handleClose} color="primary">
                  Cancle
          packages/client/app/view/Simulator/DeleteDialog/DeleteDialog.js on lines 10..21

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

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

          export default function ImportDialog(props) {
            const { onClose, onImport, open } = props;
            let jsonFieldRef;
          
            const handleClose = () => {
          Severity: Minor
          Found in packages/client/app/view/Simulator/ImportDialog/ImportDialog.js - About 1 hr to fix

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

              constructor(parentFlow: Flow, nodeId: string) {
                super(parentFlow, nodeId);
                this.nodeCategory = NodeCategory.Conversion;
            
                super.addPort(new InputPort(this, portTypeFactory.createAnyPortType(), 'input1', 0));
            Severity: Minor
            Found in packages/server/src/nodes/nodeTemplates/JSON.ts - About 1 hr to fix

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

              function Bezier(props) {
                const {
                  width,
                  height,
                  className = '',
              Severity: Minor
              Found in packages/client/app/components/Bezier/Bezier.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 TextField has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const TextField = (props) => {
                const {
                  label = '',
                  id = '',
                  defaultValue = '',
              Severity: Minor
              Found in packages/client/app/components/TextField/TextField.js - About 1 hr to fix

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

                function renderBezierCurve(node, options) {
                  const { points, invertedCurve } = options.variables;
                  const [ isCurveDecreasing, setCurveDecreasing ] = useState(invertedCurve);
                
                  const handleSwitchChange = (value) => {

                  Function DropDownButton has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function DropDownButton(props) {
                    const [isOpen, setOpen] = React.useState(false);
                    const [anchorEl, setAnchorEl] = React.useState(null);
                  
                    const handleToggle = (event) => {
                  Severity: Minor
                  Found in packages/client/app/components/DropDownButton/DropDownButton.js - About 1 hr to fix

                    Function createSettings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      createSettings() {
                        return [
                          {
                            name: 'Port',
                            description: 'Port of the OPCUA server',
                    Severity: Minor
                    Found in packages/server/src/nodes/nodeTemplates/OPCUA.ts - About 1 hr to fix

                      Function renderDragHandle has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        position,
                        width,
                        height,
                        setHandlerDown,
                        handlerId = 1,
                      Severity: Minor
                      Found in packages/client/app/components/Bezier/Bezier.js - About 45 mins to fix

                        Function registerNodesFromFolder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const registerNodesFromFolder = (folderPath: string) => {
                          return new Promise((resolve, reject) => {
                            fs.readdir(folderPath, (err, files) => {
                              if (err) return reject(err);
                              files.forEach((fileName) => {
                        Severity: Minor
                        Found in packages/server/src/nodes/nodeRegistry/index.ts - 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 connectNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const connectNodes = (commonData) => (req, res) => {
                            const { flowId } = req.params;
                            const {
                                sourceNodeId,
                                sourcePortId,
                        Severity: Minor
                        Found in packages/server/src/client-api/endpoints/nodes/nodes.controller.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 DropDownButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function DropDownButton(props) {
                          const [isOpen, setOpen] = React.useState(false);
                          const [anchorEl, setAnchorEl] = React.useState(null);
                        
                          const handleToggle = (event) => {
                        Severity: Minor
                        Found in packages/client/app/components/DropDownButton/DropDownButton.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 ImportDialog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function ImportDialog(props) {
                          const { onClose, onImport, open } = props;
                          let jsonFieldRef;
                        
                          const handleClose = () => {
                        Severity: Minor
                        Found in packages/client/app/view/Simulator/ImportDialog/ImportDialog.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

                        Function validateFlowJSON has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function validateFlowJSON(jsonStringified) {
                          let jsonFlow;
                        
                          if(typeof jsonStringified === 'string') {
                            try {
                        Severity: Minor
                        Found in packages/client/helper/validateFlowJSON.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

                        Function DeleteDialog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function DeleteDialog(props) {
                          const { onClose, onDelete, open } = props;
                        
                          const handleClose = () => {
                            if (onClose) onClose();
                        Severity: Minor
                        Found in packages/client/app/view/Simulator/DeleteDialog/DeleteDialog.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