apollo-elements/apollo-elements

View on GitHub

Showing 113 of 115 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  shouldSubscribe(
    options?: Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>
  ): boolean {
    return (void options, true);
  }
Severity: Major
Found in packages/fast/bases/apollo-subscription.ts and 3 other locations - About 1 hr to fix
packages/fast/bases/apollo-query.ts on lines 55..59
packages/lit-apollo/apollo-query.ts on lines 55..59
packages/lit-apollo/apollo-subscription.ts on lines 115..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    'retweet': webmentions
      .filter(entry => entry['wm-target'] === url)
      .filter(entry => retweet.includes(entry['wm-property']))
      .filter(hasRequiredFields)
      .map(sanitize),
Severity: Major
Found in plugins/rocket-preset-apollo-elements/webmentions.js and 1 other location - About 1 hr to fix
plugins/rocket-preset-apollo-elements/webmentions.js on lines 33..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    'messages': webmentions
      .filter(entry => entry['wm-target'] === url)
      .filter(entry => messages.includes(entry['wm-property']))
      .filter(hasRequiredFields)
      .map(sanitize),
Severity: Major
Found in plugins/rocket-preset-apollo-elements/webmentions.js and 1 other location - About 1 hr to fix
plugins/rocket-preset-apollo-elements/webmentions.js on lines 28..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  shouldSubscribe(
    options?: Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>
  ): boolean {
    return (void options, true);
  }
Severity: Major
Found in packages/lit-apollo/apollo-query.ts and 3 other locations - About 1 hr to fix
packages/fast/bases/apollo-query.ts on lines 55..59
packages/fast/bases/apollo-subscription.ts on lines 135..139
packages/lit-apollo/apollo-subscription.ts on lines 115..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  shouldSubscribe(
    options?: Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>
  ): boolean {
    return (void options, true);
  }
Severity: Major
Found in packages/lit-apollo/apollo-subscription.ts and 3 other locations - About 1 hr to fix
packages/fast/bases/apollo-query.ts on lines 55..59
packages/fast/bases/apollo-subscription.ts on lines 135..139
packages/lit-apollo/apollo-query.ts on lines 55..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

  shouldSubscribe(
    options?: Partial<C.SubscriptionOptions<Variables<D, V>, Data<D>>>
  ): boolean {
    return (void options, true);
  }
Severity: Major
Found in packages/fast/bases/apollo-query.ts and 3 other locations - About 1 hr to fix
packages/fast/bases/apollo-subscription.ts on lines 135..139
packages/lit-apollo/apollo-query.ts on lines 55..59
packages/lit-apollo/apollo-subscription.ts on lines 115..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      const onClick = () => mutate({
        variables: {
          sites: data.sites
            .filter(x => x.selected)
            .map(x => x.id)
    Severity: Major
    Found in docs/guides/usage/local-state/_assets/final.atomico.tsx and 1 other location - About 1 hr to fix
    docs/guides/usage/local-state/_assets/final.haunted.ts on lines 30..36

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      const onClick = () => mutate({
        variables: {
          sites: data.sites
            .filter(x => x.selected)
            .map(x => x.id)
    Severity: Major
    Found in docs/guides/usage/local-state/_assets/final.haunted.ts and 1 other location - About 1 hr to fix
    docs/guides/usage/local-state/_assets/final.atomico.tsx on lines 29..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                subscribe(...args: Parameters<this['controller']['subscribe']>): void {
                  return this.controller.subscribe(...args);
                }
              Severity: Major
              Found in packages/components/apollo-subscription.ts and 2 other locations - About 1 hr to fix
              packages/fast/bases/apollo-subscription.ts on lines 120..122
              packages/lit-apollo/apollo-subscription.ts on lines 100..102

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                subscribe(...args: Parameters<this['controller']['subscribe']>): void {
                  return this.controller.subscribe(...args);
                }
              Severity: Major
              Found in packages/lit-apollo/apollo-subscription.ts and 2 other locations - About 1 hr to fix
              packages/components/apollo-subscription.ts on lines 134..136
              packages/fast/bases/apollo-subscription.ts on lines 120..122

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                subscribe(...args: Parameters<this['controller']['subscribe']>): void {
                  return this.controller.subscribe(...args);
                }
              Severity: Major
              Found in packages/fast/bases/apollo-subscription.ts and 2 other locations - About 1 hr to fix
              packages/components/apollo-subscription.ts on lines 134..136
              packages/lit-apollo/apollo-subscription.ts on lines 100..102

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                @hosted({ path: 'options' })
                @controlled({ path: 'options' })
                @attr({ attribute: 'fetch-policy' })
                  fetchPolicy?: C.WatchQueryFetchPolicy;
              Severity: Major
              Found in packages/fast/bases/apollo-query.ts and 4 other locations - About 1 hr to fix
              packages/fast/bases/apollo-mutation.ts on lines 109..112
              packages/fast/bases/apollo-query.ts on lines 173..176
              packages/fast/bases/apollo-subscription.ts on lines 94..97
              packages/fast/bases/apollo-subscription.ts on lines 103..106

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 57.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                @hosted({ path: 'options' })
                @controlled({ path: 'options' })
                @attr({ attribute: 'error-policy' })
                  errorPolicy?: C.ErrorPolicy;
              Severity: Major
              Found in packages/fast/bases/apollo-subscription.ts and 4 other locations - About 1 hr to fix
              packages/fast/bases/apollo-mutation.ts on lines 109..112
              packages/fast/bases/apollo-query.ts on lines 173..176
              packages/fast/bases/apollo-query.ts on lines 191..194
              packages/fast/bases/apollo-subscription.ts on lines 103..106

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 57.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language