sebinbenjamin/image-res-generator

View on GitHub

Showing 57 of 57 total issues

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

function checkIconFile(iconFileName) {
  const result = sharp(iconFileName);
  return result.metadata().then(image => {
    if (
      image.width === image.height &&
Severity: Major
Found in src/core/image-manager.js and 1 other location - About 7 hrs to fix
src/core/image-manager.js on lines 34..49

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

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

function checkSplashFile(splashFileName) {
  const result = sharp(splashFileName);
  return result.metadata().then(image => {
    if (
      image.width === image.height &&
Severity: Major
Found in src/core/image-manager.js and 1 other location - About 7 hrs to fix
src/core/image-manager.js on lines 11..26

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

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

    if (promiseArrayIcons.length) {
      Promise.all(promiseArrayIcons)
        .then(success => {
          const configType = success[0].config.type;
          const configPlatform = success[0].config.platform;
Severity: Major
Found in src/core/generator.js and 1 other location - About 3 hrs to fix
src/core/generator.js on lines 101..114

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

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

    if (promiseArraySplash.length) {
      Promise.all(promiseArraySplash)
        .then(success => {
          const configType = success[0].config.type;
          const configPlatform = success[0].config.platform;
Severity: Major
Found in src/core/generator.js and 1 other location - About 3 hrs to fix
src/core/generator.js on lines 87..100

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

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

function generateForConfig(imageObj, settings, config) {
  const platformPath = path.join(settings.outputDirectory, config.path);
  return fs.ensureDir(platformPath).then(() => {
    // const sectionName = `Generating ${config.type} files for ${config.platform}`;
    const { definitions } = config;
Severity: Minor
Found in src/core/generator.js - About 1 hr to fix

    Function getValidFileName has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function getValidFileName(inputFileName) {
      let fileName = inputFileName.slice(); // * TODO: refactor to immutable
      let result;
      const ext = path.extname(fileName);
    
    
    Severity: Minor
    Found in src/core/fs-manager.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 updatePlatforms has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function updatePlatforms(settings) {
      if (settings.configPath) {
        for (const platform in PLATFORM_DEFS) {
          if (Object.prototype.hasOwnProperty.call(PLATFORM_DEFS, platform)) {
            const iconConfig = PLATFORM_DEFS[platform].definitions[0];
    Severity: Minor
    Found in src/core/platform-manager.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

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

      error: str => {
        const consoleOutput = ` ${colors.red('✗')} ${str}`;
        console.info(consoleOutput);
      },
    Severity: Minor
    Found in src/utils/display.js and 1 other location - About 45 mins to fix
    src/utils/display.js on lines 8..11

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

    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

      success: str => {
        const consoleOutput = ` ${colors.green('✓')} ${str}`;
        console.info(consoleOutput);
      },
    Severity: Minor
    Found in src/utils/display.js and 1 other location - About 45 mins to fix
    src/utils/display.js on lines 12..15

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

    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

      if (settings.makeIcon) {
        checkIconFile(settings.iconFile).then(image => {
          imageObjects.icon = image;
        });
      }
    Severity: Minor
    Found in src/core/image-manager.js and 1 other location - About 35 mins to fix
    src/core/image-manager.js on lines 75..79

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

    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

      if (settings.makeSplash) {
        checkSplashFile(settings.splashFile).then(image => {
          imageObjects.splash = image;
        });
      }
    Severity: Minor
    Found in src/core/image-manager.js and 1 other location - About 35 mins to fix
    src/core/image-manager.js on lines 70..74

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

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

    function generate(imageObj, settings, gSelectedPlatforms) {
      display.header('Generating files');
      display.info('=================');
      const configs = [];
      // * TO DO: Refactor if possible
    Severity: Minor
    Found in src/core/generator.js - 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

    Replace image with (image)
    Open

      return result.metadata().then(image => {
    Severity: Minor
    Found in src/core/image-manager.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace exists with (exists)
    Open

      fs.pathExists(dir).then(exists => {
    Severity: Minor
    Found in src/core/fs-manager.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace image with (image)
    Open

        checkSplashFile(settings.splashFile).then(image => {
    Severity: Minor
    Found in src/core/image-manager.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace str with (str)
    Open

      header: str => {
    Severity: Minor
    Found in src/utils/display.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Insert ··
    Open

          config: {
    Severity: Minor
    Found in src/core/generator.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ······ with ········
    Open

          },
    Severity: Minor
    Found in src/core/generator.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace config with (config)
    Open

      const filteredConfigs = configs.filter(config => {
    Severity: Minor
    Found in src/core/generator.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace image with (image)
    Open

      return result.metadata().then(image => {
    Severity: Minor
    Found in src/core/image-manager.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Severity
    Category
    Status
    Source
    Language