Showing 580 of 800 total issues
Function action
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
const action = async (_options: OptionValues) => {
inquirer.registerPrompt("autocomplete", inquirerAutoCompletePrompt);
const installedPackages = await getInstalledRefinePackagesFromNodeModules();
- 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 objectInfer
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const objectInfer: FieldInferencer = (
key,
value,
record,
infer,
Function ErrorComponent
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ErrorComponent: React.FC<RefineErrorPageProps> = () => {
const [errorMessage, setErrorMessage] = useState<string>();
const translate = useTranslate();
const { push } = useNavigation();
const go = useGo();
Function DevToolsApp
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const DevToolsApp = () => {
return (
<DevToolsContextProvider __devtools url={location.origin}>
<ReloadOnChanges />
<BrowserRouter>
Function liveProvider
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const liveProvider = (
supabaseClient: SupabaseClient<any, any, any>,
): LiveProvider => {
return {
subscribe: ({
Function Sidebar
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Sidebar = () => {
const itemContainerRef = React.useRef<HTMLDivElement>(null);
const { pathname } = useLocation();
const [itemsToRender, setItemsToRender] = React.useState<typeof items>([]);
Function FeatureSlideMobile
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const FeatureSlideMobile = (props: { className?: string }) => {
return (
<div
className={clsx(
"re-max-w-[640px]",
Function transformCrudOperatorToMuiOperator
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const transformCrudOperatorToMuiOperator = (
operator: CrudOperators,
columnType?: string,
): string => {
switch (columnType) {
Function ExampleImplementation
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ExampleImplementation = () => {
return (
<pre
style={{
display: "block",
Function moveResources
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
const moveResources = (j: JSCodeshift, root: Collection<any>) => {
const newResources: { [key: string]: any }[] = [];
const resourceElements = root.find(j.JSXElement, {
openingElement: {
Function updateRefineImports
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
const refineCoreImports = root.find(j.ImportDeclaration, {
source: {
value: "@pankod/refine-core",
},
Function renameUseFormQueryResultAndMutationResult
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const renameUseFormQueryResultAndMutationResult = (
j: JSCodeshift,
source: Collection,
) => {
const renameProperties = (prop) => {
- 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 renameUseSelectQueryResult
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const renameUseSelectQueryResult = (
j: JSCodeshift,
source: Collection,
) => {
const renameProperties = (prop) => {
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
export const dataProvider = (
apiUrl: string,
httpClient: AxiosInstance = axiosInstance,
): Omit<
Required<DataProvider>,
- 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 mediaUploadMapper
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const mediaUploadMapper = (params: any) => {
Object.keys(params).map((item) => {
if (params[item]) {
const param = params[item].fileList;
const isMediaField = Array.isArray(param);
- 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 reorderImports
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const reorderImports = (content: string): string => {
let newContent = content;
// imports can have comments before them, we need to preserve those comments and import statements.
// so we need to filter out the imports with comments before.
const allImports = getImports(content);
- 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 useResource
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function useResource(
args?: UseResourceLegacyProps | UseResourceParam,
): UseResourceReturnType {
const { resources } = useContext(ResourceContext);
- 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 useCode
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCode = (): UseCodeReturn => {
const { query, isReady } = useRouter();
const {
code: encoded,
hash,
Function convertToLegacy
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertToLegacy(segments: KeySegment[]) {
// for `list`, `many` and `one`
if (segments[0] === "data") {
// [data, dpName, resource, action, ...];
const newSegments = segments.slice(1);
Function generateFilter
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateFilter = (filter: CrudFilter, query: any) => {
switch (filter.operator) {
case "eq":
return query.eq(filter.field, filter.value);
case "ne":