packages/codemod/src/transformations/refine2-to-refine3.ts
Function updateRefineImports
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
const refineCoreImports = root.find(j.ImportDeclaration, {
source: {
value: "@pankod/refine-core",
},
Function moveConfigProvider
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const moveConfigProvider = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function postTransform
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function postTransform(files: any, flags: any) {
const rootDir = path.join(process.cwd(), files[0]);
const packageJsonPath = path.join(rootDir, "package.json");
const useYarn = checkPackageLock(rootDir) === "yarn.lock";
let packageJsonData;
Function defaultLoginPage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const defaultLoginPage = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function defaultCatchAllPage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const defaultCatchAllPage = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function defaultLayout
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const defaultLayout = (j: JSCodeshift, root: Collection<any>) => {
const refineElement = root.find(j.JSXElement, {
openingElement: {
name: {
name: "Refine",
Function updateRefineImports
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
const refineCoreImports = root.find(j.ImportDeclaration, {
source: {
value: "@pankod/refine-core",
},
- 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 updateSetEditIdToSetId
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const updateSetEditIdToSetId = (j: JSCodeshift, root: Collection<any>) => {
const updatedFormHooks = [
"useEditableTable",
"useModalForm",
"useDrawerForm",