jplusplus/the-accountant

View on GitHub

Showing 35 of 35 total issues

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

function StackService(Slice, I18n) {
  // Symbols declarion for private attributes and methods
  const _meta = Symbol('meta');
  const _slice = Symbol('slice');
  const _parent = Symbol('parent');
Severity: Minor
Found in src/components/stack/stack.service.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 modernizrRun has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function modernizrRun($window) {
  // Here are all the values we will test. If you want to use just one or two, comment out the lines of test you don't need.
  const tests = [
    // False positive in IE, supports SVG clip-path, but not on HTML element
    {name: 'svg', value: 'url(#test)'},
Severity: Minor
Found in src/modernizr.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

    finalSlice() {
      this.lastStack.finalSlice();
      // Invalidate the journey cache key
      this.invalidateJourney();
      // Emit an event
Severity: Major
Found in src/components/game/game.service.js and 1 other location - About 1 hr to fix
src/components/game/game.service.js on lines 128..134

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

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

    continue() {
      this.lastStack.continue();
      // Invalidate the journey cache key
      this.invalidateJourney();
      // Emit an event
Severity: Major
Found in src/components/game/game.service.js and 1 other location - About 1 hr to fix
src/components/game/game.service.js on lines 135..141

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

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 gameService has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

function gameService($log, $rootScope, Step, Var, Ending, Character, I18n, memoizeMixin) {
Severity: Major
Found in src/components/game/game.service.js - About 1 hr to fix

    Function controller has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      controller($state, $scope, $timeout, hotkeys, $transitions, $localForage, $translate) {
    Severity: Major
    Found in src/containers/main/main.js - About 50 mins to fix

      Function StepService has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function StepService(Choice, Slice, Stack, I18n, Explainer, $rootScope, $log) {
      Severity: Major
      Found in src/components/step/step.service.js - About 50 mins to fix

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

              this[_meta].endings = _.castArray(this[_meta].endings).map(meta => new Ending(meta, this));
        Severity: Minor
        Found in src/components/game/game.service.js and 1 other location - About 50 mins to fix
        src/components/game/game.service.js on lines 18..18

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

              this[_meta].steps = _.castArray(this[_meta].steps).map(meta => new Step(meta, this));
        Severity: Minor
        Found in src/components/game/game.service.js and 1 other location - About 50 mins to fix
        src/components/game/game.service.js on lines 20..20

        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

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

        function StepService(Choice, Slice, Stack, I18n, Explainer, $rootScope, $log) {
          // Symbols declarion for private attributes and methods
          const _meta = Symbol('meta');
          const _game = Symbol('game');
        
        
        Severity: Minor
        Found in src/components/step/step.service.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

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

              ['select', 'isCurrent', 'hasCondition', 'undo', 'displayHelper', 'continue'].forEach(m => {
                this[m] = this[m].bind(this);
              });
        Severity: Minor
        Found in src/components/step/step.service.js and 1 other location - About 40 mins to fix
        src/components/stack/stack.service.js on lines 21..23

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

        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

              ['sliceFilter', 'isStartingSlice', 'isFirstSlice', 'isLastSlice', 'clusterFilter', 'continue'].forEach(m => {
                this[m] = this[m].bind(this);
              });
        Severity: Minor
        Found in src/components/stack/stack.service.js and 1 other location - About 40 mins to fix
        src/components/step/step.service.js on lines 18..20

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

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

        function webpackWrapper(watch, conf, done) {
          const webpackBundler = webpack(conf);
        
          const webpackChangeHandler = (err, stats) => {
            if (err) {
        Severity: Minor
        Found in gulp_tasks/webpack.js - 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 SliceService has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function SliceService(I18n) {
          // Symbols declarion for private attributes and methods
          const _stack = Symbol('stack');
        
          class Slice extends I18n {
        Severity: Minor
        Found in src/components/slice/slice.service.js - 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 ChartService has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function ChartService($filter, I18n, memoizeMixin) {
          // Symbols declarion for private attributes and methods
          const _game = Symbol('game');
          const _id = Symbol('id');
        
        
        Severity: Minor
        Found in src/components/chart/chart.service.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

        Severity
        Category
        Status
        Source
        Language