engine-bay/admin-portal

View on GitHub

Showing 33 of 112 total issues

Function generateBlueprintsFromCells has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

export const generateBlueprintsFromCells = (wb: SheetJSWorkbook, worksheetName: string, allCells: Cell[], cells: Cell[]) => {

    const blueprints: Blueprint[] = [];
    const expressionBlueprints: ExpressionBlueprint[] = [];
    const dataVariableBlueprints: DataVariableBlueprint[] = [];

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

export const generateBlueprintsFromCells = (wb: SheetJSWorkbook, worksheetName: string, allCells: Cell[], cells: Cell[]) => {

    const blueprints: Blueprint[] = [];
    const expressionBlueprints: ExpressionBlueprint[] = [];
    const dataVariableBlueprints: DataVariableBlueprint[] = [];

    Function importBlueprints has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    export const importBlueprints = async (file: Blob) => {
        return new Promise<Blueprint[]>((resolve) => {
            const reader = new FileReader();
            reader.readAsArrayBuffer(file)
    
    
    Severity: Minor
    Found in EngineBay.AdminPortal/AdminPortal/src/lib/imports/importBlueprints.ts - About 7 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 StudioShow has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const StudioShow = () => {
      const translate = useTranslate();
    
      const [layout, setLayout] = useLocalStorage<Layout[]>(
        "studio.layout",
    Severity: Major
    Found in EngineBay.AdminPortal/AdminPortal/src/pages/studio/Studio.tsx - About 3 hrs to fix

      Function App has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const App = () => {
        // this sets up a basic client-side cache
        const queryClient = new QueryClient({
          defaultOptions: {
            queries: {
      Severity: Major
      Found in EngineBay.AdminPortal/AdminPortal/src/App.tsx - About 3 hrs to fix

        Function BlueprintShow has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const BlueprintShow = () => {
          const translate = useTranslate();
          return (
            <Show resource="blueprints" title={translate("blueprint")}>
              <TabbedShowLayout>
        Severity: Major
        Found in EngineBay.AdminPortal/AdminPortal/src/pages/blueprints/Blueprints.tsx - About 3 hrs to fix

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

          export const importBlueprints = async (file: Blob) => {
              return new Promise<Blueprint[]>((resolve) => {
                  const reader = new FileReader();
                  reader.readAsArrayBuffer(file)
          
          
          Severity: Major
          Found in EngineBay.AdminPortal/AdminPortal/src/lib/imports/importBlueprints.ts - About 3 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                if (blueprint) {
                  for (const expressionBlueprint of blueprint.expressionBlueprints) {
                    initialNodes.push({
                      id: expressionBlueprint.id || uuidv4(),
                      data: {

              Function onload has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      reader.onload = () => {
                          const wb = read(reader.result);
              
                          let blueprints: Blueprint[] = [];
              
              
              Severity: Major
              Found in EngineBay.AdminPortal/AdminPortal/src/lib/imports/importBlueprints.ts - About 3 hrs to fix

                File BlueprintVisualizer.tsx has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { useEffect, useState } from "react";
                import ReactFlow, {
                  Background,
                  Controls,
                  Node,

                  Function updatedTreeData has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          (blueprint: Blueprint) => {
                            const expressionBlueprintChildren =
                              blueprint.expressionBlueprints.map((expressionBlueprint) => {
                                return {
                                  nodeId: expressionBlueprint.id,
                  Severity: Major
                  Found in EngineBay.AdminPortal/AdminPortal/src/pages/studio/WorkbookTree.tsx - About 2 hrs to fix

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

                    export const ExpressionShow = () => {
                      const translate = useTranslate();
                      return (
                        <Show resource="expression-blueprints" title={translate("expression")}>
                          <TabbedShowLayout>

                      Function BlueprintList has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const BlueprintList = () => {
                        const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                        const translate = useTranslate();
                        const filters = [
                          <TextInput
                      Severity: Major
                      Found in EngineBay.AdminPortal/AdminPortal/src/pages/blueprints/Blueprints.tsx - About 2 hrs to fix

                        Function TriggerShow has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const TriggerShow = () => {
                          const translate = useTranslate();
                          return (
                            <Show resource="trigger-blueprints" title={translate("trigger")}>
                              <TabbedShowLayout>
                        Severity: Major
                        Found in EngineBay.AdminPortal/AdminPortal/src/pages/triggers/Triggers.tsx - About 2 hrs to fix

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

                          export const WorkbookImport = () => {
                            const translate = useTranslate();
                            const [create] = useCreate();
                            const redirect = useRedirect();
                            const saveWorkbook = async (data: WorkbookImportFormData) => {
                          Severity: Major
                          Found in EngineBay.AdminPortal/AdminPortal/src/pages/workbooks/Workbooks.tsx - About 2 hrs to fix

                            Function ExpressionList has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ExpressionList = () => {
                              const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                              const translate = useTranslate();
                            
                              const filters = [

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

                              export const WorkbookList = () => {
                                const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                                const translate = useTranslate();
                              
                                const filters = [
                              Severity: Minor
                              Found in EngineBay.AdminPortal/AdminPortal/src/pages/workbooks/Workbooks.tsx - About 1 hr to fix

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

                                export const VariableList = () => {
                                  const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                                  const translate = useTranslate();
                                
                                  const filters = [
                                Severity: Minor
                                Found in EngineBay.AdminPortal/AdminPortal/src/pages/variables/Variables.tsx - About 1 hr to fix

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

                                  export const TableList = () => {
                                    const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                                    const translate = useTranslate();
                                  
                                    const filters = [
                                  Severity: Minor
                                  Found in EngineBay.AdminPortal/AdminPortal/src/pages/tables/Tables.tsx - About 1 hr to fix

                                    Function TriggerList has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const TriggerList = () => {
                                      const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down("sm"));
                                      const translate = useTranslate();
                                    
                                      const filters = [
                                    Severity: Minor
                                    Found in EngineBay.AdminPortal/AdminPortal/src/pages/triggers/Triggers.tsx - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language