Showing 580 of 800 total issues
Function getWantedWithPreferredWildcard
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getWantedWithPreferredWildcard = (
packageName: RefinePackageInstalledVersionData["name"],
versionWanted: RefinePackageInstalledVersionData["wanted"],
): string => {
const dependencies = getDependenciesWithVersion();
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 usePagination
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const usePagination = (
props: UsePaginationProps,
): {
current: number;
prev?: number;
- 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 relationToFieldable
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const relationToFieldable: FieldTransformer = (
fields,
resources,
resource,
record,
- 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 deepHasKey
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const deepHasKey = (obj: Record<string, any>, keys: string[]) => {
// traverse all keys in the object
for (const k in obj) {
// if the key is in the object, return true
if (keys.includes(k)) {
- 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 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 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 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 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 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 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 getMetaProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getMetaProps = (
identifier?: string,
meta?: InferencerComponentProps["meta"],
actions?: Action[],
) => {
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 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 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 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 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 mapOperator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const mapOperator = (operator: CrudOperators) => {
switch (operator) {
case "ne":
return "neq";
case "nin":
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;