busy-web/ember-date-time

View on GitHub

Showing 94 of 144 total issues

Function getInterval has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getInterval(direction=0) {
        let { span, type } = get(this, 'selected');
        let start, end;
        if (!isEmpty(type) && !isNone(span)) {
            start = _time(getStart(this)).valueOf();
Severity: Minor
Found in addon/components/ember-date-range-picker.js - About 1 hr to fix

    Function keyDownEventHandler has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function keyDownEventHandler(target) {
        return function(event) {
            let isOpen = get(target, 'isListOpen');
            let handler = keyEvent({ event });
            if (event.altKey) {
    Severity: Minor
    Found in addon/components/ember-date-range-picker.js - About 1 hr to fix

      Function handleCursor has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function handleCursor(target, action='', triggerChange=true) {
          return new EmberPromise(resolve => {
              later(() => {
                  const { format, selection } = getMeta(target);
                  const value = getValue(target);
      Severity: Minor
      Found in addon/components/private/date-input.js - About 1 hr to fix

        Function setActiveState has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            setActiveState(options={}) {
                if (isNone(get(this, 'stateManager'))) {
                    this.setState();
                }
        
        
        Severity: Minor
        Found in addon/components/ember-date-time-picker.js - About 1 hr to fix

          Function importTransforms has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              importTransforms() {
              return {
                'global': {
                  transform: (tree, options) => {
                    let amdTransform = stew.map(tree, (content, relativePath) => {
          Severity: Minor
          Found in index.js - About 1 hr to fix

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

                importTransforms() {
                return {
                  'global': {
                    transform: (tree, options) => {
                      let amdTransform = stew.map(tree, (content, relativePath) => {
            Severity: Minor
            Found in index.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 sectionBounds has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function sectionBounds(target) {
                let type = sectionFormatType(target);
                let max, min = 1;
                if (type === DAY_FLAG) {
                    const date = _time(get(target, '_date'));
            Severity: Minor
            Found in addon/components/private/date-input.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 setupTime has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                setupTime() {
                    let timestamp = get(this, 'timestamp');
                    let unix = get(this, 'unix');
                    let minDate = get(this, 'minDate');
                    let maxDate = get(this, 'maxDate');
            Severity: Minor
            Found in addon/components/ember-date-time-picker.js - About 1 hr to fix

              Function didInsertElement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  didInsertElement(...args) {
                      this._super(...args);
              
                      const target = this.$().get(0);
              
              
              Severity: Minor
              Found in addon/components/private/date-input.js - About 1 hr to fix

                Function setBounds has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    setBounds(minX, minY, width, height) {
                        // hide box until calculations have been made
                        // safari fix
                        this.svg.__el.style.display = "none";
                        this.svg.snap.attr({ viewBox: `${minX} ${minY} ${width} ${height}` });
                Severity: Minor
                Found in addon/utils/clock.js - About 1 hr to fix

                  Function updateDates has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      updateDates(type, time, calendar, singleSet=false) {
                          let isStart = get(this, 'isStart');
                          if (!get(this, 'allowCustom')) {
                              isStart = true;
                          }
                  Severity: Minor
                  Found in addon/components/ember-date-range-picker.js - About 1 hr to fix

                    Function handleDrag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        handleDrag(num, cb) {
                            const faceAttrs = getAttrs(this.svg.face, ['cx', 'cy']);
                            const angle = getSliceDegree(this.points.length, num);
                    
                            const { plot, arm, text } = this.svg.at(num);
                    Severity: Minor
                    Found in addon/utils/clock.js - About 1 hr to fix

                      Function setState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          setState() {
                              let start = getStart(this);
                              let end = getEnd(this);
                      
                              let timestamp = start;
                      Severity: Minor
                      Found in addon/components/ember-date-range-picker.js - About 1 hr to fix

                        Function formatStringType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        _time.formatStringType = function(fmt) {
                            if (/^D(o|D)?$/.test(fmt)) {
                                return DAY_FLAG;
                            } else if (/^d(o|d|dd|ddd)?$/.test(fmt)) {
                                return WEEKDAY_FLAG;
                        Severity: Minor
                        Found in addon/utils/time.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 getDefaultAction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            getDefaultAction() {
                                if (get(this, 'isCustom')) {
                                    const span = _time.daysApart(getStart(this), getEnd(this)) + 1;
                                    return EmberObject.create({name: loc('Custom'), span, type: 'days'});
                                } else if (!isEmpty(get(this, 'defaultAction'))) {
                        Severity: Minor
                        Found in addon/components/ember-date-range-picker.js - About 1 hr to fix

                          Function keyDown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              keyDown(event) {
                                  if (isModifierKeyActive(this, event)) {
                                      return true;
                                  }
                          
                          
                          Severity: Minor
                          Found in addon/components/private/date-input.js - About 1 hr to fix

                            Function createMetaFor has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            export function createMetaFor(component, key, start, end, min, max, rounder, selectRounder) {
                            Severity: Major
                            Found in addon/utils/clock.js - About 1 hr to fix

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

                              export function getHourMinute(type, timestamp, selectRounder) {
                                  if (type === HOUR_FLAG) {
                                      let hour = parseInt(_time(timestamp).format('H'), 10);
                                      if (hour <= 0) { hour = 12; }                    // enforce hour is not set to 0
                                      if (hour > 12) { hour = hour - 12; }    // enforce hour is 12 hour format
                              Severity: Minor
                              Found in addon/utils/clock/data.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

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

                              _time.typeExp = function(type) {
                                  if (type === DAY_FLAG) {
                                      return /D(o|D)?/;
                                  } else if (type === WEEKDAY_FLAG) {
                                      return /d(o|d|dd|ddd)?/;
                              Severity: Minor
                              Found in addon/utils/time.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

                              Function createSVGPath has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              export function createSVGPath(totalSlices, degree, x, y, start, end) {
                              Severity: Minor
                              Found in addon/utils/clock/math.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language