aureooms/rejuvenate

View on GitHub

Showing 27 of 178 total issues

Function main has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function main(argv) {
    const {command, options, isDefault} = parse(argv.slice(2));

    const globals = {
        tasks: undefined,
Severity: Major
Found in src/main.js - About 5 hrs to fix

    Function subroutine has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    function subroutine({scripts, deps, files, config, lintConfig}) {
        return {
            async postcondition({readPkg, read, assert}) {
                const pkgjson = await readPkg();
                const devDeps = pkg.devDeps(pkgjson);
    Severity: Minor
    Found in src/recipes/add-scripts.js - About 4 hrs to fix

    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 subroutine has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    function subroutine({scripts, deps, files, config}) {
        return {
            async postcondition({readPkg, exists, assert}) {
                const pkgjson = await readPkg();
                const devDeps = pkg.devDeps(pkgjson);
    Severity: Minor
    Found in src/recipes/remove-scripts.js - About 3 hrs to fix

    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 apply has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function apply({readPkg, writePkg, upgrade, install}) {
        // Update package.json
        await update({
            read: readPkg,
            write: writePkg,

    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 fixedOrder has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        (sortToTop, key = (x) => x) =>
        (a, b) => {
            const ka = key(a);
            const kb = key(b);
            if (ka === kb) return 0;
    Severity: Minor
    Found in src/lib/order.js - About 1 hr to fix

    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 filter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        (resolveFromFile, resolveRequire) =>
        (node, {is, n}) => {
            if (is(node, n.ImportDeclaration) || is(node, n.ExportAllDeclaration)) {
                if (!is(node.source, n.Literal)) return false;
                const source = node.source.value;
    Severity: Minor
    Found in src/transforms/ava:test-build.js - About 1 hr to fix

    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 main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function main(argv) {
        const {command, options, isDefault} = parse(argv.slice(2));
    
        const globals = {
            tasks: undefined,
    Severity: Minor
    Found in src/main.js - About 1 hr to fix

    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 filter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        (resolveRequire) =>
        (node, {is, n}) => {
            if (is(node, n.ImportDeclaration) || is(node, n.ExportAllDeclaration)) {
                if (!is(node.source, n.Literal)) return false;
                const source = node.source.value;
    Severity: Minor
    Found in src/transforms/codemod:use-esm-import-syntax.js - About 1 hr to fix

    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 checkStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function checkStatus(status, options, globals) {
        globals.debug({status});
        const {tracking, current, behind} = status;
        if (!current) throw new Error('No current branch');
        if (!tracking) throw new Error('Not tracking any remote branch');
    Severity: Minor
    Found in src/main.js - About 1 hr to fix

      Function edit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              edit(pkgjson) {
                  const {scripts} = pkgjson;
                  scripts.test = 'npm run test:src';
                  scripts['test-cmd'] = 'NODE_LOADER_CONFIG=test/loader/config.js ava';
                  scripts['test:cjs'] =
      Severity: Minor
      Found in src/transforms/ava:test-build.js - About 1 hr to fix

        Function whole has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const whole = (current, [pattern, replacement]) => {
            if (pattern instanceof RegExp) {
                const regexp = new RegExp('^' + pattern.source + '$', pattern.flags);
                return current.replace(regexp, replacement);
            }
        Severity: Minor
        Found in src/lib/lines/replace.js - About 45 mins to fix

        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 checkStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function checkStatus(status, options, globals) {
            globals.debug({status});
            const {tracking, current, behind} = status;
            if (!current) throw new Error('No current branch');
            if (!tracking) throw new Error('Not tracking any remote branch');
        Severity: Minor
        Found in src/main.js - About 45 mins to fix

        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 updateScripts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function updateScripts({scripts}) {
            return {
                async postcondition({readPkg, assert}) {
                    const pkgjson = await readPkg();
                    for (const [script, {newDefinition}] of Object.entries(scripts)) {
        Severity: Minor
        Found in src/recipes/update-scripts-definition.js - About 35 mins to fix

        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 replaceOne has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        async function replaceOne(operations, path, {lines, write, method}) {
            const buffer = [];
            let changed = false;
            for await (const line of lines(path)) {
                const replacedLine = reduce(method, operations, line);
        Severity: Minor
        Found in src/lib/lines/replace.js - About 35 mins to fix

        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

        Avoid too many return statements within this function.
        Open

            return (
                object.name === 'testlink' &&
                property.name === 'href' &&
                operator === '=' &&
                right.value !== newValue(right.value)
        Severity: Major
        Found in src/transforms/docs:use-codecov-as-test-link.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return na < nb ? -1 : 1;
          Severity: Major
          Found in src/lib/order.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return true;
            Severity: Major
            Found in src/transforms/codemod:use-esm-import-syntax.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return false;
              Severity: Major
              Found in src/transforms/ava:test-build.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return (
                        is(callee, n.MemberExpression) &&
                        callee.object.name === 'document' &&
                        callee.property.name === 'querySelectorAll'
                    );
                Severity: Major
                Found in src/transforms/codemod:doc-scripts-header-replace-querySelectorAll.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return false;
                  Severity: Major
                  Found in src/transforms/codemod:use-esm-import-syntax.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language