khalyomede/gridsome-plugin-manifest

View on GitHub

Showing 16 of 16 total issues

File gridsome.server.ts has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { existsSync, writeFileSync } from "fs";
import * as isHexcolor from "is-hexcolor";
import * as mime from "mime-types";
import { sync } from "mkdirp";
import { basename, isAbsolute } from "path";
Severity: Minor
Found in src/gridsome.server.ts - About 4 hrs to fix

    Function constructor has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public constructor(api: IPluginAPI, options: IOptions) {
            this._options = options;
    
            api.beforeBuild(async () => {
                /* tslint:disable:no-console */
    Severity: Major
    Found in src/gridsome.server.ts - About 4 hrs to fix

      Function _checkRelatedApplicationsOption has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          private _checkRelatedApplicationsOption(): void {
              const optionName = "related_applications";
      
              this._throwIfOptionMissing(optionName);
      
      
      Severity: Minor
      Found in src/gridsome.server.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

      Function _checkRelatedApplicationsOption has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private _checkRelatedApplicationsOption(): void {
              const optionName = "related_applications";
      
              this._throwIfOptionMissing(optionName);
      
      
      Severity: Major
      Found in src/gridsome.server.ts - About 2 hrs to fix

        GridsomePluginManifest has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GridsomePluginManifest {
            static readonly pluginName = "gridsome-plugin-manifest";
        
            private readonly _options: IOptions;
        
        
        Severity: Minor
        Found in src/gridsome.server.ts - About 2 hrs to fix

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

              private _checkDirOption(): void {
                  const optionName = "dir";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 225..236

          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 68.

          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

              private _checkDisplayOption(): void {
                  const optionName = "display";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 326..333

          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 68.

          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

              private _checkThemeColorOption(): void {
                  const optionName = "theme_color";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 212..223

          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

              private _checkBackgroundColorOption(): void {
                  const optionName = "background_color";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 313..324

          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

              private _checkScopeOption(): void {
                  const optionName = "scope";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 304..311

          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 63.

          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

              private _checkStartUrlOption(): void {
                  const optionName = "start_url";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 1 other location - About 1 hr to fix
          src/gridsome.server.ts on lines 287..294

          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 63.

          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

              private _throwIfOptionNotHexColor(optionName: string): void {
                  if (!isHexcolor(this._options[optionName])) {
                      throw new TypeError(
                          `"${optionName}" must be a valid hexadecimal color`
                      );
          Severity: Minor
          Found in src/gridsome.server.ts and 1 other location - About 55 mins to fix
          src/gridsome.server.ts on lines 198..202

          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 54.

          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

              private _throwIfOptionNotAbsolutePath(optionName: string): void {
                  if (!isAbsolute(this._options[optionName])) {
                      throw new TypeError(`"${optionName}" must be an absolute path`);
                  }
              }
          Severity: Minor
          Found in src/gridsome.server.ts and 1 other location - About 55 mins to fix
          src/gridsome.server.ts on lines 204..210

          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 54.

          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 3 locations. Consider refactoring.
          Open

              private _checkShortNameOption(): void {
                  const optionName = "short_name";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 2 other locations - About 50 mins to fix
          src/gridsome.server.ts on lines 253..259
          src/gridsome.server.ts on lines 261..267

          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 52.

          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 3 locations. Consider refactoring.
          Open

              private _checkNameOption(): void {
                  const optionName = "name";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 2 other locations - About 50 mins to fix
          src/gridsome.server.ts on lines 261..267
          src/gridsome.server.ts on lines 296..302

          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 52.

          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 3 locations. Consider refactoring.
          Open

              private _checkFileNameOption(): void {
                  const optionName = "file_name";
          
                  this._throwIfOptionMissing(optionName);
                  this._throwIfOptionNotString(optionName);
          Severity: Major
          Found in src/gridsome.server.ts and 2 other locations - About 50 mins to fix
          src/gridsome.server.ts on lines 253..259
          src/gridsome.server.ts on lines 296..302

          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 52.

          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