mitjajez/SONCE

View on GitHub

Showing 138 of 138 total issues

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

    find() {
      const query = {
        _id: cid,
        $or: [{ owner: { $exists: false } }, { userId }],
      };
Severity: Major
Found in imports/api/elements/server/publications.js and 1 other location - About 2 hrs to fix
imports/api/wires/server/publications.js on lines 15..28

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

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

    find() {
      const query = {
        _id: cid,
        $or: [{ userId: { $exists: false } }, { userId }],
      };
Severity: Major
Found in imports/api/wires/server/publications.js and 1 other location - About 2 hrs to fix
imports/api/elements/server/publications.js on lines 15..28

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

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

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

        (function (global, factory) {
           typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
           typeof define === 'function' && define.amd ? define(['moment'], factory) :
           factory(global.moment)
        }(this, function (moment) { 'use strict';
        Severity: Major
        Found in private/moment-locales/sl.js and 1 other location - About 2 hrs to fix
        private/moment-locales/en-gb.js on lines 6..67

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

        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

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

        (function (global, factory) {
           typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
           typeof define === 'function' && define.amd ? define(['moment'], factory) :
           factory(global.moment)
        }(this, function (moment) { 'use strict';
        Severity: Major
        Found in private/moment-locales/en-gb.js and 1 other location - About 2 hrs to fix
        private/moment-locales/sl.js on lines 6..160

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

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

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

                if( Components.find().count() === 0 ){
                  const components = JSON.parse( ComponentsLib );
                  _.each( components, function(c, key){
                    Components.insert( c );
                  });
              Severity: Major
              Found in imports/startup/server/fixtures.js and 1 other location - About 1 hr to fix
              imports/startup/server/fixtures.js on lines 18..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 70.

              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( Symbols.find().count() === 0 ){
                  const symbols = JSON.parse( SymbolsLib );
                  _.each( symbols, function(s, key){
                    Symbols.insert( s );
                  });
              Severity: Major
              Found in imports/startup/server/fixtures.js and 1 other location - About 1 hr to fix
              imports/startup/server/fixtures.js on lines 25..30

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

              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

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

                'click .js-show-more': function (event, instance) {
                  const $parent = $( event.delegateTarget );
                  const $types = $parent.find('.more-types');
              //    $types.css( {'left': '-'+ $parent.position().left+'px', 'width': '400%'} );
                  instance.$('.opened').removeClass('opened');
              Severity: Major
              Found in imports/ui/components/flex-tabs/symbols-item.js and 1 other location - About 1 hr to fix
              imports/ui/components/flex-tabs/components-item.js on lines 49..55

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

              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

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

                'click .js-show-more-types'(event, instance) {
                  const $parent = $( event.delegateTarget );
                  const $types = $parent.find('.more-types');
              //    $types.css( {'left': '-'+ $parent.position().left+'px', 'width': '400%'} );
                  instance.$('.opened').removeClass('opened');
              Severity: Major
              Found in imports/ui/components/flex-tabs/components-item.js and 1 other location - About 1 hr to fix
              imports/ui/components/flex-tabs/symbols-item.js on lines 32..38

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

              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

                validate: new SimpleSchema({
                  'wid': { type: String },
                  'newEnd': { type: Object },                 // connected pins
                  'newEnd.e': { type: String },               // pin element od node
                  'newEnd.p': { type: String },               // pin id      or node id
              Severity: Major
              Found in imports/api/wires/methods.js and 1 other location - About 1 hr to fix
              imports/api/wires/methods.js on lines 192..197

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

              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

                validate: new SimpleSchema({
                  'cid': { type: String },
                  'end': { type: Object },                 // connected pins
                  'end.e': { type: String },               // pin element od node
                  'end.p': { type: String },               // pin id      or node id
              Severity: Major
              Found in imports/api/wires/methods.js and 1 other location - About 1 hr to fix
              imports/api/wires/methods.js on lines 158..163

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

              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 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
                Severity
                Category
                Status
                Source
                Language