Showing 580 of 800 total issues
Function transform
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
transform: (content) => {
let newContent = content;
const imports = getImports(content);
imports.map((importItem) => {
Function useCustomConfigSortToSorters
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useCustomConfigSortToSorters = (j: JSCodeshift, source: Collection) => {
const useCustomHooks = source.find(j.CallExpression, {
callee: {
name: "useCustom",
},
Function basicInputFields
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const basicInputFields = (field: InferField) => {
if (
field.type === "text" ||
field.type === "url" ||
field.type === "email" ||
Function createResourcePathWithAction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createResourcePathWithAction = (
resource: ResourceProps,
action: Action,
) => {
const { name, list, create, show, edit } = resource;
Function booleanFields
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(
["Checkbox", "@mui/material"],
["FormControlLabel", "@mui/material"],
Function getProjectType
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getProjectType = (platform?: ProjectTypes): ProjectTypes => {
if (platform) {
return platform;
}
// read dependencies from package.json
Function paginationProperties
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
(prop) => {
const property = (
(hasRefineCoreProps as ObjectProperty).value as ObjectExpression
).properties.find((p: Property) => (p.key as Identifier).name === prop);
Function dateFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/antd"]);
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function imageFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const imageFields = (field: InferField) => {
if (field.type === "image") {
imports.push(["Image", "@chakra-ui/react"]);
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function imageFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const imageFields = (field: InferField) => {
if (field.type === "image") {
imports.push(["ImageField", "@refinedev/antd"]);
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function dateFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dateFields = (field: InferField) => {
if (field.type === "date") {
imports.push(["DateField", "@refinedev/chakra-ui"]);
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function numberFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const numberFields = (field: InferField) => {
if (field.type === "number") {
imports.push(["NumberField", "@refinedev/antd"]);
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function compile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const compile = (filePath: string, params: any): string => {
const content = readFileSync(filePath);
Handlebars.registerHelper("ifIn", (elem, list, options) => {
if (elem.includes(list)) {
Function useButtonCanAccess
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useButtonCanAccess = (
props: ButtonCanAccessProps,
): ButtonCanAccessValues => {
const translate = useTranslate();
const accessControlContext = React.useContext(AccessControlContext);
Function RefineRoutes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const RefineRoutes = ({ children }: RefineRoutesProps) => {
const { resource, action } = useResource();
const { asPath: pathname, isReady } = useRouter();
if (!isReady) {
- 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 updateRefineImports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
const refineCoreImports = root.find(j.ImportDeclaration, {
source: {
value: "@pankod/refine-core",
},
- 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 RefineRoutes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const RefineRoutes = ({ children }: RefineRoutesProps) => {
const { resource, action } = useResource();
const { pathname } = useLocation();
const resourceAction = resource && action ? resource[action] : undefined;
- 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 RefineRoutes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const RefineRoutes = ({ children }: RefineRoutesProps) => {
const { resource, action } = useResource();
const pathname = usePathname();
const resourceAction = resource && action ? resource[action] : undefined;
- 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 transformRefineOptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const transformRefineOptions = (
j: JSCodeshift,
root: Collection<any>,
projectId: string,
) => {
- 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 normalizeData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const normalizeData = (data: any): any => {
if (Array.isArray(data)) {
return data.map((item) => normalizeData(item));
}
- 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"