apollo-elements/apollo-elements

View on GitHub

Showing 15 of 115 total issues

Function defineOnHTMLElement has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function defineOnHTMLElement<T extends HTMLElement & {
  controller: ApolloController<unknown, unknown>;
  requestUpdate?(name?: string, old?: unknown): void;
}>(
  proto: T,
Severity: Minor
Found in packages/core/decorators.ts - About 2 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

File component.ts has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { ComponentOptions, Operation } from './options';

import Case from 'case';

import { promisify } from 'util';
Severity: Minor
Found in packages/create/component.ts - About 2 hrs to fix

    File prompt.ts has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import type { BaseOptions, AppOptions, ComponentOptions } from './options';
    
    import { app } from './app.js';
    import { component } from './component.js';
    
    
    Severity: Minor
    Found in packages/create/prompt.ts - About 2 hrs to fix

      Function githubTag has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function githubTag() {
        return {
          parse(tagToken) {
            this.repo = tagToken.args;
          },
      Severity: Minor
      Found in plugins/rocket-preset-apollo-elements/liquid/github.js - About 1 hr to fix

        Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async render() {
              const url = new URL(`/repos/${this.repo}`, 'https://api.github.com/');
              const headers = { 'Accept': 'application/vnd.github.v3+json' };
              const repo = await fetch(url.toString(), { headers }).then(x => x.json());
              return `
        Severity: Minor
        Found in plugins/rocket-preset-apollo-elements/liquid/github.js - About 1 hr to fix

          Function resolveLocalFilesFromTypeScriptSources has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export function resolveLocalFilesFromTypeScriptSources({ rootDir }) {
            return {
              name: 'resolve-local-monorepo-packages-from-ts-sources',
              async transformImport({ source, context }) {
                const isNodeModule = source.match(/node_modules/) || context.path.match(/node_modules/);
          Severity: Minor
          Found in plugins/resolve-local.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 promptComponent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function promptComponent(
            options?: PromptOptions<ComponentOptions>
          ): Promise<ComponentOptions> {
            return {
              ...options,
          Severity: Minor
          Found in packages/create/prompt.ts - About 1 hr to fix

            Function typeCheck has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              typeCheck() {
                /* eslint-disable max-len, func-call-spacing, no-multi-spaces */
            
                // ApolloElementInterface
                assertType<ApolloClient<NormalizedCacheObject>> (this.client);
            Severity: Minor
            Found in test/type-check.ts - About 1 hr to fix

              Function typeCheck has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                typeCheck() {
                  /* eslint-disable max-len, func-call-spacing, no-multi-spaces */
              
                  // ApolloElementInterface
                  assertType<ApolloClient<NormalizedCacheObject>> (this.client!);
              Severity: Minor
              Found in test/type-check.ts - About 1 hr to fix

                Function promptApp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export async function promptApp(options: PromptOptions<AppOptions>): Promise<AppOptions> {
                  return {
                    ...options,
                    ...await inquirer.prompt([{
                      type: 'input',
                Severity: Minor
                Found in packages/create/prompt.ts - About 1 hr to fix

                  Function eleventy has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    eleventy(eleventyConfig) {
                      eleventyConfig
                        .addPassthroughCopy('decks/azconf-dev-2021/**/*.{js,png,svg,jpg,webp,woff,woff2}');
                      eleventyConfig.addFilter('formatDate', date =>
                        date instanceof Date ? date.toDateString() : date);
                  Severity: Minor
                  Found in rocket.config.js - About 1 hr to fix

                    Function initFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function initFiles(options: AppOptions) {
                      if (!options.silent)
                        console.log(`\n${cyan('Scaffolding App Files')}...\n`);
                      const templatePath = path.resolve(__dirname, 'template', 'app');
                      await ncp(templatePath, options.directory);
                    Severity: Minor
                    Found in packages/create/app.ts - About 1 hr to fix

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

                      function tryToResolve(source, context, rootDir) {
                        let resolved = '';
                      
                        try {
                          const require = createRequire(rootDir);
                      Severity: Minor
                      Found in plugins/resolve-local.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 codegen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export async function codegen(options: BaseOptions): Promise<ExecaReturnValue|void> {
                        if (!options.codegen) return;
                        if (!options.silent)
                          console.log(`\n${cyan('Generating types from schema')}...\n`);
                        try {
                      Severity: Minor
                      Found in packages/create/codegen.ts - 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 execStart has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      async function execStart(options: AppOptions) {
                        if (!options.start) {
                          if (!options.silent) console.log('Launch aborted\n');
                        } else {
                          if (!options.silent) console.log('🚀 Prepare for Takeoff...\n');
                      Severity: Minor
                      Found in packages/create/app.ts - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language