Showing 580 of 800 total issues
Function ResizablePane
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const ResizablePane = ({ placement, visible, children }: Props) => {
const [hover, setHover] = React.useState(false);
const [resizing, setResizing] = React.useState<
"lx" | "rx" | "ty" | "by" | null
>(null);
- 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 OnboardingForm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const OnboardingForm = () => {
const [loading, setLoading] = React.useState(false);
const { handleSubmit, control, setValue, setError, formState } =
useForm<MeUpdateVariables>({
defaultValues: {
- 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 useResourceParams
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useResourceParams(props?: Props): ResourceParams {
const { select, identifier: inferredIdentifier } = useResource();
const resourceToCheck = props?.resource ?? inferredIdentifier;
const { identifier = undefined, resource = undefined } = resourceToCheck
? select(resourceToCheck, true)
- 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 printImports
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const printImports = (imports: Array<ImportElement>) => {
const byModule = imports.reduce(
(acc, [element, module, isDefault]) => {
if (!acc[module]) {
acc[module] = [] as Array<
Function emailFields
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const emailFields = (field: InferField) => {
if (field.type === "email") {
imports.push(
["TagField", "@refinedev/antd"],
["EmailField", "@refinedev/antd"],
Function urlFields
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const urlFields = (field: InferField) => {
if (field.type === "url") {
imports.push(
["UrlField", "@refinedev/antd"],
["TagField", "@refinedev/antd"],
Function booleanFields
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
if (field.multiple) {
return undefined;
}
Function printFiles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const printFiles = () => {
const chalks = [];
chalks.push(chalk.dim(`File${files.length > 1 ? "s" : ""} created:`));
chalks.push(
Function getAllVersionsOfPackage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getAllVersionsOfPackage = async (
packageName: string,
): Promise<string[]> => {
const pm = "npm";
Function useResourceParams
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useResourceParams(props?: Props): ResourceParams {
const { select, identifier: inferredIdentifier } = useResource();
const resourceToCheck = props?.resource ?? inferredIdentifier;
const { identifier = undefined, resource = undefined } = resourceToCheck
? select(resourceToCheck, true)
Function useGetToPath
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useGetToPath = (): GetToPathFn => {
const routerType = useRouterType();
const { resource: resourceFromRoute, resources } = useResource();
const parsed = useParsed();
Function useGo
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useGo = () => {
const routerContext = useContext(RouterContext);
const { select: resourceSelect } = useResource();
const getToPath = useGetToPath();
Function queryKeys
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const queryKeys = (
resource?: string,
dataProviderName?: string,
meta?: MetaQuery,
/**
Function assertDocumentTitle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const assertDocumentTitle = (resource: string, action?: IAction) => {
switch (action) {
case "list":
cy.document()
.its("title")
Function textFields
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const textFields = (field: InferField) => {
if (
field.type === "text" ||
field.type === "email" ||
field.type === "date" ||
Function relationHooksCode
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
imports.push(["useAutocomplete", "@refinedev/mui"]);
let val = accessor(recordName, field.key, field.accessor, false);
Function UnsavedPrompt
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UnsavedPrompt: React.FC = () => {
const { Prompt } = useRouterContext();
const translate = useTranslate();
Function useRedirectionAfterSubmission
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
() => {
const { show, edit, list, create } = useNavigation();
const handleSubmitWithRedirect = useCallback(
({
Function useRefreshButton
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useRefreshButton(
props: RefreshButtonProps,
): RefreshButtonValues {
const translate = useTranslate();
const { keys, preferLegacyKeys } = useKeys();
Function transform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
transform: (content) => {
let newContent = content;
const imports = getImports(content);
imports.map((importItem) => {