Showing 756 of 987 total issues
Function CodeViewerComponent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
({ code: rawCode, loading }) => {
const code = React.useMemo(() => {
return prettierFormat(rawCode ?? "");
}, [rawCode]);
- Read upRead up
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 gitInit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function gitInit(root: string, message: string) {
let didInit = false;
try {
execa.commandSync("git --version", { stdio: "ignore", cwd: root });
- Read upRead up
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 DataProvider
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const DataProvider = (
apiUrl: string,
httpClient: AxiosInstance = axiosInstance,
): Required<DataProviderType> => {
return {
- Read upRead up
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 useStepsForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const useStepsForm = <
TQueryFnData extends BaseRecord = BaseRecord,
TError extends HttpError = HttpError,
TVariables extends FieldValues = FieldValues,
TContext extends object = {},
- Read upRead up
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 createTreeView
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const createTreeView = (
resources: IResourceItem[] | IMenuItem[],
): ITreeMenu[] | ITreeMenu[] => {
const tree = [];
const resourcesRouteObject: { [key: string]: any } = {};
- Read upRead up
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 onMutationError
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
onMutationError: (error, _variables, _context) => {
if (disableServerSideValidation) {
refineCoreProps?.onMutationError?.(error, _variables, _context);
return;
}
Function addColumnsToUseDataGrid
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addColumnsToUseDataGrid = (j: JSCodeshift, root: Collection<any>) => {
const dataGridElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "DataGrid",
Function generateFilter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateFilter = (filters?: CrudFilters) => {
const queryFilters: { [key: string]: any } = {};
if (filters) {
filters.map((filter) => {
Function booleanFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(["Checkbox", "antd"]);
if (field.multiple) {
Function getMetaProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getMetaProps = (
identifier?: string,
meta?: InferencerComponentProps["meta"],
actions?: Action[],
) => {
Function richtextFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const richtextFields = (field: InferField) => {
if (field?.type === "richtext") {
imports.push(["MarkdownField", "@refinedev/antd"]);
const dataIndex =
Function dateFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DatePicker", "antd"], ["dayjs", "dayjs", true]);
if (field.multiple) {
Function handleMouseMove
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleMouseMove = (e: MouseEvent) => {
if (resizing?.[1] === "x") {
const diff = e.clientX - (resizePosition?.x ?? e.clientX);
const newWidth =
panelSize.width + (resizing === "lx" ? -diff : diff) * 2;
Function createResourceRoutes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createResourceRoutes = (resources: ResourceProps[]) => {
const routes = resources.flatMap((resource) => {
const actions: {
action: Action;
element: React.ComponentType<any>;
Function Header
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Header: React.FC<RefineLayoutHeaderProps> = () => {
const authProvider = useActiveAuthProvider();
const { data: user } = useGetIdentity({
v3LegacyAuthProviderCompatible: Boolean(authProvider?.isLegacy),
});
Function createTreeView
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createTreeView = (
resources: IResourceItem[] | IMenuItem[],
): ITreeMenu[] | ITreeMenu[] => {
const tree = [];
const resourcesRouteObject: { [key: string]: any } = {};
Function asyncDebounce
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const asyncDebounce = <T extends (...args: any[]) => any>(
func: T,
wait = 1000,
cancelReason?: string,
): DebouncedFunction<T> => {
Function prepareItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(item: FlatTreeItem): TreeMenuItem | undefined => {
if (item?.meta?.hide ?? item?.options?.hide) return undefined;
if (!item?.list && item.children.length === 0) return undefined;
const composed = item.list
Function flattenObjectKeys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const flattenObjectKeys = (obj: any, prefix = "") => {
if (!isNested(obj)) {
return {
[prefix]: obj,
};
Function fn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fn = useCallback(() => {
const parsedSearch = qs.parse(search, { ignoreQueryPrefix: true });
const combinedParams = {
...inferredParams,