crane-cloud/frontend

View on GitHub

Showing 13 of 14 total issues

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

function useAxios() {
const { authToken, logout } = useAuth();
 
const handleResponse = (
resp: AxiosResponse,
Severity: Minor
Found in src/utils/useAxios.ts - About 1 hr to fix

Function LoginForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function LoginForm(props: PaperProps) {
const [type, toggle] = useToggle(["login", "register"]);
const { uploadData, submitting, success, data } = usePost();
const { login } = useAuth();
const navigate = useNavigate();
Severity: Minor
Found in src/pages/Auth/loginPage.tsx - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

if (
props?.required &&
(form[field_name] === undefined ||
form[field_name] === null ||
form[field_name] === "") &&
Severity: Critical
Found in src/hooks/useForm.ts - About 1 hr to fix

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

    const CreateProjectForm = (props: TCreateProjectForm) => {
    const {
    project,
    showTitle = true,
    onCancel = false,
    Severity: Minor
    Found in src/components/Forms/CreateProjectForm.tsx - About 1 hr to fix

    Function usePost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const usePost = () => {
    const [submitting, setSubmitting] = useState(false);
    const [error, setError] = useState<TError>({});
    const [success, setSuccess] = useState(false);
    const [data, setData] = useState<any>();
    Severity: Minor
    Found in src/utils/usePost.tsx - About 1 hr to fix

    Function DatabaseDetails has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    const DatabaseDetails = () => {
    const [deleteConfirmOpened, setDeleteConfirmOpened] = useState(false);
    const [disableConfirmOpened, setDisableConfirmOpened] = useState(false);
    const [enableConfirmOpened, setEnableConfirmOpened] = useState(false);
    const [resetConfirmOpened, setResetConfirmOpened] = useState(false);
    Severity: Minor
    Found in src/pages/databases/DatabaseDetails.tsx - About 55 mins to fix

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

    const ProjectsList = () => {
    const { data: projectsData, getData, loading, success } = useGet();
    const [projects, setProjects] = useState<any[]>([]);
    const [viewMode, toggleViewMode] = useToggle<"grid" | "list">([
    "grid",
    Severity: Minor
    Found in src/components/Lists/ProjectsList.tsx - About 35 mins to fix

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

    const CreateDatabaseForm = (props: any) => {
    const { showTitle = true, database, project_id, onCancel, refresh } = props;
    const { form, updateFormValue, editedForm } = useForm();
    const {
    uploadData,
    Severity: Minor
    Found in src/components/Forms/CreateDatabaseForm.tsx - About 35 mins to fix

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

    const LeftMenu = React.memo(({
    menuType,
    projectId,
    title,
    subtitle,
    Severity: Minor
    Found in src/components/Navbars/LeftMenu.tsx - About 35 mins to fix

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

    const CICDTab = ({
    app,
    setRefresh,
    }: {
    app: any;
    Severity: Minor
    Found in src/pages/Apps/AppSettingsPage.tsx - About 35 mins to fix

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

    const useForm = () => {
    const [form, setForm] = useState<TForm>({});
    const [editedForm, setEditedForm] = useState<any>({});
    const updateFormValue = (key: string, value: TFormUpdateValue) => {
    setForm({
    Severity: Minor
    Found in src/hooks/useForm.ts - About 35 mins to fix

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

    const AppDetailPage = () => {
    const { app_id } = useParams();
    const { app, loading } = useGetApp(app_id || "");
    useSetContainerSize("md");
     
     
    Severity: Minor
    Found in src/pages/Apps/AppDetailPage.tsx - About 25 mins to fix

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

    export const EnvironmentVariablesTable = ({
    envVariables,
    }: {
    envVariables: EnvVariable[];
    }) => {
    Severity: Minor
    Found in src/components/Forms/CreateAppForm.tsx - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language