engine-bay/admin-portal

View on GitHub

Showing 33 of 112 total issues

Function NavigationMenu has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const NavigationMenu = () => {
  const translate = useTranslate();
  return (
    <Menu>
      <Menu.DashboardItem primaryText={translate("dashboard")} />
Severity: Minor
Found in EngineBay.AdminPortal/AdminPortal/src/components/NavigationMenu.tsx - About 1 hr to fix

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

    export const VariableEdit = () => {
      const translate = useTranslate();
      return (
        <Edit
          resource="data-variable-blueprints"
    Severity: Minor
    Found in EngineBay.AdminPortal/AdminPortal/src/pages/variables/Variables.tsx - About 1 hr to fix

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

      export const DataTableField = (props: DataTableFieldProps) => {
        const record = useRecordContext(props);
      
        const { dataTableRowBlueprints, dataTableColumnBlueprints } = record;
      
      
      Severity: Minor
      Found in EngineBay.AdminPortal/AdminPortal/src/components/DataTableField.tsx - About 1 hr to fix

        Function WorkbookShow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const WorkbookShow = () => {
          const translate = useTranslate();
          return (
            <Show resource="workbooks" title={translate("workbook")}>
              <TabbedShowLayout>
        Severity: Minor
        Found in EngineBay.AdminPortal/AdminPortal/src/pages/workbooks/Workbooks.tsx - About 1 hr to fix

          Function StudioList has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const StudioList = () => {
            const translate = useTranslate();
          
            const filters = [
              <TextInput
          Severity: Minor
          Found in EngineBay.AdminPortal/AdminPortal/src/pages/studio/Studio.tsx - About 1 hr to fix

            Function StudioShowActions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const StudioShowActions = () => {
                return (
                  <TopToolbar>
                    {!editingLayout && <EditButton />}
                    {!editingLayout && (
            Severity: Minor
            Found in EngineBay.AdminPortal/AdminPortal/src/pages/studio/Studio.tsx - About 1 hr to fix

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

              export const TableEdit = () => {
                const translate = useTranslate();
                return (
                  <Edit
                    resource="data-table-blueprints"
              Severity: Minor
              Found in EngineBay.AdminPortal/AdminPortal/src/pages/tables/Tables.tsx - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                    for (const dataTableBlueprint of dataTableBlueprints) {
                                        localOnlyCellValue = localOnlyCellValue.replace(dataTableBlueprint.name, '');
                                    }

                  Avoid deeply nested control flow statements.
                  Open

                                      for (const globalDataVariableBlueprint of allDataVariableBlueprints) {
                                          localOnlyCellValue = localOnlyCellValue.replace(globalDataVariableBlueprint.name, '');
                                      }

                    Avoid deeply nested control flow statements.
                    Open

                                        for (let i = start.c; i <= end.c; i++) {
                                            const key = utils.encode_range({ s: { c: i, r: j }, e: { c: i, r: j } })
                                            const cellObject = wb.Sheets[worksheetName][key];
                                            const value = cellObject.w;
                                            dataTableRowBlueprint.dataTableCellBlueprints.push({

                      Avoid deeply nested control flow statements.
                      Open

                                          if (localOnlyCellValue.includes(dataVariableBlueprint.name)) {
                                              inputDataVariableBlueprints.push({
                                                  name: dataVariableBlueprint.name,
                                                  namespace: dataVariableBlueprint.namespace,
                                                  type: dataVariableBlueprint.type

                        Consider simplifying this complex logical expression.
                        Open

                                if (cell.isDynamic && cell.value.includes(":")) {
                                    console.log("Cell has a range in it:")
                                    console.log(cell)
                                    const parts = cell.value.split(':');
                                    const pairs = parts.length / 2;

                          Function WorkbookTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const WorkbookTree = ({
                            //   selectedElement,
                            onBlueprintSelected,
                            onElementSelected,
                          }: {
                          Severity: Minor
                          Found in EngineBay.AdminPortal/AdminPortal/src/pages/studio/WorkbookTree.tsx - 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

                          Severity
                          Category
                          Status
                          Source
                          Language