koreezgames/phaser3-ninepatch-plugin

View on GitHub

Showing 10 of 10 total issues

Function create has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function create() {
    console.log("create");
    // We specify the x and y position, the width and height and the key for the image of the image.
    // It will be automatically scaled!
    const metalPanel = this.add.ninePatch(200, 200, 300, 300, "metalPanel_blueCorner", null, {
Severity: Major
Found in example/index.ts - About 4 hrs to fix

    Function exports has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = env => {
        if (!env) env = { production: false, karma: false };
    
        let mode = env.production ? "production" : "development";
        let tsconfig = !env.karma ? "tsconfig.json" : "tsconfig.test.json";
    Severity: Major
    Found in webpack.config.js - About 2 hrs to fix

      Function exports has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = config => {
          var configuration = {
              basePath: "",
              frameworks: ["mocha", "chai", "sinon", "es6-shim"],
              files: [
      Severity: Minor
      Found in karma.conf.js - About 2 hrs to fix

        Function addAll has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Cache.prototype.addAll = function addAll(requests) {
            var cache = this;
        
            // Since DOMExceptions are not constructable:
            function NetworkError(message) {
        Severity: Minor
        Found in static/scripts/cache-polyfill.js - About 1 hr to fix

          Function exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = env => {
              if (!env) env = { production: false, karma: false };
          
              let mode = env.production ? "production" : "development";
              let tsconfig = !env.karma ? "tsconfig.json" : "tsconfig.test.json";
          Severity: Minor
          Found in webpack.config.js - About 55 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

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

                  const textureXs: number[] = [0, this.config.left, this.originFrame.width - this.config.right, this.originFrame.width];
          Severity: Minor
          Found in src/com/koreez/plugin/ninepatch/NinePatch.ts and 1 other location - About 55 mins to fix
          src/com/koreez/plugin/ninepatch/NinePatch.ts on lines 105..105

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

          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

                  const textureYs: number[] = [0, this.config.top, this.originFrame.height - this.config.bottom, this.originFrame.height];
          Severity: Minor
          Found in src/com/koreez/plugin/ninepatch/NinePatch.ts and 1 other location - About 55 mins to fix
          src/com/koreez/plugin/ninepatch/NinePatch.ts on lines 104..104

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

          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

          Consider simplifying this complex logical expression.
          Open

            if (
              nativeAddAll && (!userAgent ||
                (agent === 'Firefox' && version >= 46) ||
                (agent === 'Chrome'  && version >= 50)
              )
          Severity: Major
          Found in static/scripts/cache-polyfill.js - About 40 mins to fix

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

                public get tintFill(): boolean {
                    return this.first && (this.first as Phaser.GameObjects.Image).tintFill;
                }
            Severity: Minor
            Found in src/com/koreez/plugin/ninepatch/NinePatch.ts and 1 other location - About 30 mins to fix
            src/com/koreez/plugin/ninepatch/NinePatch.ts on lines 98..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 45.

            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

                get isTinted(): boolean {
                    return this.first && (this.first as Phaser.GameObjects.Image).isTinted;
                }
            Severity: Minor
            Found in src/com/koreez/plugin/ninepatch/NinePatch.ts and 1 other location - About 30 mins to fix
            src/com/koreez/plugin/ninepatch/NinePatch.ts on lines 85..87

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

            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