angliafarmers/ember-material-design-datepicker

View on GitHub

Showing 12 of 12 total issues

File md-datepicker.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Ember from 'ember';
import layout from '../templates/components/md-datepicker';

export default Ember.Component.extend({
  layout,
Severity: Minor
Found in addon/components/md-datepicker.js - About 3 hrs to fix

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

      isEarly: Ember.computed('dateText', 'minDate', 'format', 'useStrictMode', function() {
        let dateText = this.get('dateText');
        let minDate = this.get('minDate');
    
        if (!minDate) {
    Severity: Major
    Found in addon/components/md-datepicker.js and 1 other location - About 3 hrs to fix
    addon/components/md-datepicker.js on lines 177..186

    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

      isLate: Ember.computed('dateText', 'maxDate', 'format', 'useStrictMode', function() {
        let dateText = this.get('dateText');
        let maxDate = this.get('maxDate');
    
        if (!maxDate) {
    Severity: Major
    Found in addon/components/md-datepicker.js and 1 other location - About 3 hrs to fix
    addon/components/md-datepicker.js on lines 167..176

    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

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

    export default Ember.Component.extend({
      layout,
      classNames: ['md-datepicker-group'],
      locale: null,
      init() {
    Severity: Minor
    Found in addon/components/md-datepicker.js - About 2 hrs to fix

      Function daySpans has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        daySpans: Ember.computed('viewingDate', 'selectedDate', 'minDate', 'maxDate', 'hourOffset', function() {
          let viewingDate = this.get('viewingDate');
          let selectedDate = this.get('selectedDate');
          let minDate = this.get('minDate');
          let maxDate = this.get('maxDate');
      Severity: Minor
      Found in addon/components/md-datepicker.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 daySpans has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        daySpans: Ember.computed('viewingDate', 'selectedDate', 'minDate', 'maxDate', 'hourOffset', function() {
          let viewingDate = this.get('viewingDate');
          let selectedDate = this.get('selectedDate');
          let minDate = this.get('minDate');
          let maxDate = this.get('maxDate');
      Severity: Minor
      Found in addon/components/md-datepicker.js - About 1 hr to fix

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

          selectedTime: Ember.computed('selectedDate', function() {
            let selectedDate = this.get('selectedDate');
            if (selectedDate) {
              return this.getMoment(selectedDate).format('HH:mm');
            }
        Severity: Major
        Found in addon/components/md-datepicker.js and 1 other location - About 1 hr to fix
        addon/components/md-datepicker.js on lines 243..249

        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

          selectedYear: Ember.computed('selectedDate', function() {
            let selectedDate = this.get('selectedDate');
            if (selectedDate) {
              return this.getMoment(selectedDate).format('YYYY');
            }
        Severity: Major
        Found in addon/components/md-datepicker.js and 1 other location - About 1 hr to fix
        addon/components/md-datepicker.js on lines 250..256

        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

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

            dateClicked(dayspan) {
              let date = dayspan.date;
              let isValid = true;
        
              // Preserve selected time
        Severity: Minor
        Found in addon/components/md-datepicker.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

            if (this.get('isEarly')) {
              return 'Date entered must be on or after ' + this.getMoment(this.get('minDate')).format(format);
            }
        Severity: Minor
        Found in addon/components/md-datepicker.js and 1 other location - About 35 mins to fix
        addon/components/md-datepicker.js on lines 140..142

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

        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 (this.get('isLate')) {
              return 'Date entered must be on or before ' + this.getMoment(this.get('maxDate')).format(format);
            }
        Severity: Minor
        Found in addon/components/md-datepicker.js and 1 other location - About 35 mins to fix
        addon/components/md-datepicker.js on lines 136..138

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

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

            keyUp() {
              this.set('isDirty', true);
        
              let dateText = this.get('dateText');
              let isValid = this.get('isValidDate');
        Severity: Minor
        Found in addon/components/md-datepicker.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