Showing 580 of 800 total issues
Function PackageItem
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export const PackageItem = ({ item, blocked, onUpdate, onOutdated }: Props) => {
const [latestLoading, setLatestLoading] = React.useState(true);
const [latestData, setLatestData] =
React.useState<PackageLatestVersionType | 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 createInquirerUI
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createInquirerUI = (uiGroup: UIGroup) => {
let maxNameLength = 0;
let maxFromLength = 0;
[uiGroup.patch, uiGroup.minor, uiGroup.major].forEach((group) => {
Function authProvider
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const authProvider = (API_URL: string): AuthProvider => {
const axiosInstance = axios.create();
axiosInstance.interceptors.response.use(
(response) => {
Function ErrorComponent
has 66 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 ReadyPage
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ReadyPage: React.FC<RefineReadyPageProps> = () => {
return (
<Box
p="4"
display="flex"
Function basicInputFields
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const basicInputFields = (field: InferField) => {
if (
field.type === "text" ||
field.type === "url" ||
field.type === "email" ||
Function getVersionTable
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getVersionTable = (
packages: RefinePackageInstalledVersionData[] = [],
) => {
const tableHead = Object.keys(packages?.[0] || {});
if (!packages || !tableHead.length) return { table: "", width: 0 };
Function basicToRelation
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const basicToRelation: FieldTransformer = (
fields,
resources,
resource,
record,
- 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 fixUseListHasPaginationToPaginationMode
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fixUseListHasPaginationToPaginationMode = (
j: JSCodeshift,
source: Collection,
) => {
const useListHooks = source.find(j.CallExpression, {
Function MockGoogleButton
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MockGoogleButton = () => {
const { mutate } = useLogin();
return (
<button
Function moveConfigProvider
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
const moveConfigProvider = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function booleanFields
has 63 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 booleanFields
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const booleanFields = (field: InferField) => {
if (field.type === "boolean") {
imports.push(["Checkbox", "@chakra-ui/react"]);
if (field.multiple) {
Function operatorMapper
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const operatorMapper = (
operator: CrudOperators,
value: any,
): { [key: string]: any } => {
if (operator === "contains") {
Function run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const run = async (
example: string | boolean | undefined,
destination?: string,
) => {
const pm = findPM();
- 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 assertFormShouldHaveResponseValues
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const assertFormShouldHaveResponseValues = (response: any, ui: UITypes) => {
const body = response?.body;
// assert response values are equal to the form values
switch (ui) {
Function relationHooksCode
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
if (field.multiple) {
imports.push(["useMany", "@refinedev/core"]);
Function relationHooksCode
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
if (field.multiple) {
imports.push(["useMany", "@refinedev/core"]);
let ids = accessor(recordName, field.key);
Function basicInputFields
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const basicInputFields = (field: InferField) => {
if (
field.type === "text" ||
field.type === "url" ||
field.type === "email" ||
Function relationHooksCode
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((field) => {
if (field?.relation && !field.fieldable && field.resource) {
if (field.multiple) {
imports.push(["useMany", "@refinedev/core"]);
let ids = accessor(recordName, field.key);