Showing 812 of 823 total issues
Function textFields
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const textFields = (field: InferField) => {
if (field.type === "text") {
imports.push(
["TagField", "@refinedev/chakra-ui"],
["TextField", "@refinedev/chakra-ui"],
Function imageFields
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const imageFields = (field: InferField) => {
if (field.type === "image") {
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
Function sorterToSorters
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sorterToSorters = (j: JSCodeshift, source: Collection) => {
const willCheckHooks = ["useExport"];
willCheckHooks.forEach((hookName) => {
const useListHooks = source.find(j.CallExpression, {
Function ThemedHeader
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ThemedHeader: React.FC<RefineThemedLayoutHeaderProps> = () => {
const theme = useMantineTheme();
const authProvider = useActiveAuthProvider();
const { data: user } = useGetIdentity({
Function resourceNametoResource
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const resourceNametoResource = (j: JSCodeshift, source: Collection) => {
const willCheckHooks = ["useExport", "useImport"];
willCheckHooks.forEach((hookName) => {
const useListHooks = source.find(j.CallExpression, {
Function mapped
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mapped: Array<InferField> = fields.map((field) => {
if (
!field.relation &&
(field.type === "text" ||
field.type === "richtext" ||
Function booleanFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(["Checkbox", "@mantine/core"]);
initialValues = {
Function richtextFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const richtextFields = (field: InferField) => {
if (field.type === "richtext") {
imports.push(["Textarea", "@mantine/core"]);
initialValues = {
Function relationHooksCode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["GetManyResponse", "@refinedev/core"]);
imports.push(["useMany", "@refinedev/core"]);
Function relationHooksCode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["GetManyResponse", "@refinedev/core"]);
imports.push(["useMany", "@refinedev/core"]);
Function textFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const textFields = (field: InferField) => {
if (field.type === "text") {
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
return jsx`
Function booleanFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
if (field.multiple) {
const val = accessor("item", undefined, field.accessor);
return jsx`
Function relationHooksCode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["GetManyResponse", "@refinedev/core"]);
imports.push(["useMany", "@refinedev/core"]);
Function placement
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const placement = React.useMemo(() => {
const tooltipBaseSize = { width: 22, height: 22 };
const nameWidth = name.length * 7.5;
const tooltipSize = {
width: tooltipBaseSize.width + nameWidth,
Function CommandBar
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CommandBar: React.FC = () => {
const searchStyle = {
padding: "12px 16px",
fontSize: "16px",
width: "100%",
Function useRefineContext
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useRefineContext = () => {
const {
Footer,
Header,
Layout,
Function transformCrudFiltersToFilterModel
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const transformCrudFiltersToFilterModel = (
crudFilters: CrudFilters,
columnsType?: Record<string, string>,
): GridFilterModel | undefined => {
const gridFilterItems: GridFilterItem[] = [];
Function generateFilter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const generateFilter = (filter: CrudFilter, deep = 10): string => {
const nextDeep = deep - 1;
if (nextDeep < 0) {
throw new Error("Max deep reached");
- 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 createResourcePathWithAction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const createResourcePathWithAction = (
resource: ResourceProps,
action: Action,
) => {
const { name, list, create, show, edit } = resource;
- 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 SelectableElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const SelectableElement = ({
element,
name,
onSelect,
}: {
- 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"