mitjajez/SONCE

View on GitHub

Showing 34 of 138 total issues

File circuits-show.js has 766 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import './circuits-show.html';

import { Template } from 'meteor/peerlibrary:blaze-components';
import { Mongo } from 'meteor/mongo';
import { ReactiveDict } from 'meteor/reactive-dict';
Severity: Major
Found in imports/ui/components/circuits-show.js - About 1 day to fix

    Function circuitShowOnCreated has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
    Open

    Template.Circuits_show.onCreated(function circuitShowOnCreated() {
      Session.setDefault('component2add', false);
    
      this.state = new ReactiveDict();
      this.state.setDefault({
    Severity: Minor
    Found in imports/ui/components/circuits-show.js - About 1 day 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 circuitShowOnCreated has 211 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Template.Circuits_show.onCreated(function circuitShowOnCreated() {
      Session.setDefault('component2add', false);
    
      this.state = new ReactiveDict();
      this.state.setDefault({
    Severity: Major
    Found in imports/ui/components/circuits-show.js - About 1 day to fix

      Function newNetPathPoint has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      export const newNetPathPoint = (d, T) => { // ['a-x', 'a-l', 'l', 'l-a', 'a-y']
        const p = d ? getLastPointFromPathD(d) : {x:0, y:0};
      
        let str = '';
        let dl = 0;
      Severity: Minor
      Found in imports/ui/lib/nets.js - About 5 hrs 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

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

      Template.Circuits_show.events({
        // COMMON --------------------------------------------------------------------
        'click .js-view-circuit' (event, instance) {
          event.preventDefault();
          instance.state.set('acting', 'viewing');
      Severity: Minor
      Found in imports/ui/components/circuits-show.js - About 3 hrs to fix

        Function circuitsInfoOnCreated has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Template.Circuit_info.onCreated(function circuitsInfoOnCreated() {
          this.getCircuitId = () => FlowRouter.getParam('_id');
        
          this.state = new ReactiveDict();
          this.state.setDefault({
        Severity: Major
        Found in imports/ui/components/flex-tabs/circuit-info.js - About 3 hrs to fix

          Function symbolsEditorOnCreated has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Template.Symbols_editor.onCreated(function symbolsEditorOnCreated() {
            this.autorun(() => {
              new SimpleSchema({
                symbol: { type: Function },
                symbolReady: { type: Boolean },
          Severity: Major
          Found in imports/ui/components/symbols-editor/symbols-editor.js - About 2 hrs to fix

            Function processRelativeTime has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function processRelativeTime(number, withoutSuffix, key, isFuture) {
                    var result = number + ' ';
                    switch (key) {
                    case 's':
                        return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
            Severity: Major
            Found in private/moment-locales/sl.js - About 2 hrs to fix

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

              Template.Circuits_show.helpers({
                mouse: () => Template.instance().state.get('mouse'),
                zoom: () => Template.instance().state.get('zoom'),
                pan: () => Template.instance().state.get('pan'),
                viewZoom() {
              Severity: Minor
              Found in imports/ui/components/circuits-show.js - About 2 hrs to fix

                Function click .wiring .js-wire has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  'click .wiring .js-wire'(event, instance) {
                    const name = instance.$(event.currentTarget).attr('name');
                    const T = instance.state.get('mouse');
                    const p = instance.snapToGrid(T);
                    // console.log( `CLICK on WIRE ${name}` );
                Severity: Major
                Found in imports/ui/components/circuits-show.js - About 2 hrs to fix

                  Function click .wiring .js-active-pin has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    'click .wiring .js-active-pin' (event, instance) {
                      const $pin = instance.$( '.js-active-pin' );
                      const p = {
                        id: $pin.attr('id'),
                        x: $pin.attr('cx'),
                  Severity: Major
                  Found in imports/ui/components/circuits-show.js - About 2 hrs to fix

                    Function newNetPathPoint has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      this.newNetPathPoint = (T) => { // ['a-x', 'a-l', 'l', 'l-a', 'a-y']
                        const d = this.$('.js-active-wire').data().wire.d;
                        const p = d ? getLastPointFromPathD(d) : {x:0, y:0};
                    //    let p = {x:0, y:0};
                    //    if(d) {
                    Severity: Minor
                    Found in imports/ui/components/circuits-show.js - About 1 hr to fix

                      Function saveSetting has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        this.saveSetting = () => {
                          const cid = this.getCircuitId();
                          switch (this.state.get('editing')) {
                          case 'circuitName': {
                            const name = this.$('input[name=circuitName]').val();
                      Severity: Minor
                      Found in imports/ui/components/flex-tabs/circuit-info.js - About 1 hr to fix

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

                        export const newNetPathPoint = (d, T) => { // ['a-x', 'a-l', 'l', 'l-a', 'a-y']
                          const p = d ? getLastPointFromPathD(d) : {x:0, y:0};
                        
                          let str = '';
                          let dl = 0;
                        Severity: Minor
                        Found in imports/ui/lib/nets.js - About 1 hr to fix

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

                          Template.Circuit_info.onCreated(function circuitsInfoOnCreated() {
                            this.getCircuitId = () => FlowRouter.getParam('_id');
                          
                            this.state = new ReactiveDict();
                            this.state.setDefault({
                          Severity: Minor
                          Found in imports/ui/components/flex-tabs/circuit-info.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 symbolsEditorOnCreated has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Template.Symbols_editor.onCreated(function symbolsEditorOnCreated() {
                            this.autorun(() => {
                              new SimpleSchema({
                                symbol: { type: Function },
                                symbolReady: { type: Boolean },
                          Severity: Minor
                          Found in imports/ui/components/symbols-editor/symbols-editor.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 click .wiring .js-active-pin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                            'click .wiring .js-active-pin' (event, instance) {
                              const $pin = instance.$( '.js-active-pin' );
                              const p = {
                                id: $pin.attr('id'),
                                x: $pin.attr('cx'),
                          Severity: Minor
                          Found in imports/ui/components/circuits-show.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 getEventPoint has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            this.getEventPoint = (event, mode) => {
                              const T = { x:0, y:0 };
                              if (event.type.indexOf('mouse') > -1) {
                                //event.type === 'mousemove'
                                if(mode === 'svg') {
                          Severity: Minor
                          Found in imports/ui/components/circuits-show.js - About 1 hr to fix

                            Function getLastPointFromPathD has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const getLastPointFromPathD = (d) => {
                              const p = {x:0, y:0};
                              Snap.parsePathString(d).map((s) => {
                                switch (s[0]) {
                                case 'M':
                            Severity: Minor
                            Found in imports/ui/lib/svg.js - About 1 hr to fix

                              Function circuitsGraphOnCreated has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              Template.Circuit_graph.onCreated(function circuitsGraphOnCreated() {
                                this.getCircuitId = () => FlowRouter.getParam('_id');
                              
                                this.autorun(() => {
                                  this.subscribe('elements.inCircuit', this.getCircuitId());
                              Severity: Minor
                              Found in imports/ui/components/flex-tabs/circuit-graph.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language