Showing 750 of 983 total issues
Function transformer
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function transformer(file: FileInfo, api: API, options: any) {
const j = api.jscodeshift;
const source = j(file.source);
const rootElement = source.find(j.JSXElement, {
Function useResource
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useResource(
args?: UseResourceLegacyProps | UseResourceParam,
): UseResourceReturnType {
const { resources } = useContext(ResourceContext);
Function bootstrap
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
const bootstrap = () => {
const packageJson = JSON.parse(
readFileSync(`${__dirname}/../package.json`, "utf8"),
);
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 useDataGrid
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function useDataGrid<
TQueryFnData extends BaseRecord = BaseRecord,
TError extends HttpError = HttpError,
TSearchVariables = unknown,
TData extends BaseRecord = TQueryFnData,
- 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 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 liveProvider
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const liveProvider = (
supabaseClient: SupabaseClient<any, any, any>,
): LiveProvider => {
return {
subscribe: ({
Function DevToolsApp
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const DevToolsApp = () => {
return (
<DevToolsContextProvider __devtools>
<ReloadOnChanges />
<BrowserRouter>
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 Create
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const Create: React.FC<CreateProps> = ({
title,
children,
saveButtonProps: saveButtonPropsFromProps,
resource: resourceFromProps,
- 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 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 renderTreeView
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderTreeView = (tree: ITreeMenu[]) => {
return tree.map((item) => {
const { label, route, name, icon, children } = item;
const isSelected = item.key === selectedKey;
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 Create
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const Create: React.FC<CreateProps> = (props) => {
const {
children,
saveButtonProps: saveButtonPropsFromProps,
isLoading,
- 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 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"