creative-connections/Bodylight.js-Components

View on GitHub

Showing 684 of 684 total issues

Function getDateAxis has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
    var formatter = opts("axisLabelFormatter");
    var ticks = [];
    var t;

Severity: Major
Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 2 hrs to fix

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

      round(value, decimals) {
        if (decimals < 0) {let posdecimals = -decimals; return Number(Math.round(value + 'e' + posdecimals) + 'e-' + posdecimals);}
        return Number(Math.round(value + 'e-' + decimals) + 'e+' + decimals);
      }
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 1 other location - About 2 hrs to fix
    src_aurelia-bodylight-plugin/src/elements/remote-value.js on lines 153..159

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

    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

        round(value, decimals) {
            if (decimals < 0) {
                let posdecimals = -decimals;
                return Number(Math.round(value + 'e' + posdecimals) + 'e-' + posdecimals);
            }
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/remote-value.js and 1 other location - About 2 hrs to fix
    src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 615..618

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

    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 initdygraph has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initdygraph() {
            console.log('sachart - initdygraph');
            if (this.pH >0) this.data = [[this.pH, this.pCO2]];
            else this.data = [];
            this.xaxis = "pH";
    Severity: Major
    Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 2 hrs to fix

      Function constructor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          constructor() {
              super();
              console.log('sachart constructor');
              this.xy = true; //set xy chart - datapoint will not contain time point
              this.handleResize = () => {
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/sachart.js - About 2 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

      Function bind has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        bind() {
          this.refindex = parseInt(this.refindex, 10);
          this.refvalues = parseInt(this.refvalues, 10);
          this.refendindex = this.refindex + this.refvalues;
      
      
      Severity: Minor
      Found in src_aurelia-bodylight-plugin/src/elements/plotly.js - About 2 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

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

                window.editorapi.insertScriptById(source, 'adobeobj')
                  .then(innerscript => {
                    //console.log('third party script node', innerscript);
                    try {
                      // eslint-disable-next-line no-eval
      src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 242..252

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

      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

                  window.editorapi.insertScriptById(source, 'adobeobj')
                    .then(innerscript => {
                      //console.log('third party script node', innerscript);
                      try {
                        // eslint-disable-next-line no-eval
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 1 other location - About 2 hrs to fix
      src_aurelia-bodylight-plugin/src/elements/animate-adobe-ss.js on lines 173..183

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

      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 configure has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function configure(config) {
        config.globalResources([
          PLATFORM.moduleName('./elements/checkbox'),
          PLATFORM.moduleName('./elements/buttonparams'),
          PLATFORM.moduleName('./elements/receptacle.html'),
      Severity: Major
      Found in src_aurelia-bodylight-plugin/src/index.js - About 2 hrs to fix

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

            regSimple = new RegExp('(?:' +
              Object.keys(state.env.abbreviations).map(function (x) {
                return x.substr(1);
              }).sort(function (a, b) {
                return b.length - a.length;
        src_aurelia-bodylight-plugin/src/elements/markdown-it-abbr-ext.js on lines 88..94

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

        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

            regText = '(^|' + UNICODE_PUNCT_RE + '|' + UNICODE_SPACE_RE +
                            '|[' + OTHER_CHARS.split('').map(escapeRE).join('') + '])'
                    + '(' + Object.keys(state.env.abbreviations).map(function (x) {
                              return x.substr(1);
                            }).sort(function (a, b) {
        src_aurelia-bodylight-plugin/src/elements/markdown-it-abbr-ext.js on lines 80..85

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

        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 bind has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          bind() {
            this.useranswer = [];
            this.showquiz=true;
            this.showresult = false;
            this.answers_array = (this.answers)? this.answers.split('|').map(s => s.trim()): [];
        Severity: Major
        Found in src_aurelia-bodylight-plugin/src/elements/quizx.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!Number.isInteger(unixTsMs) ||
                      !Number.isInteger(randA) ||
                      !Number.isInteger(randBHi) ||
                      !Number.isInteger(randBLo) ||
                      unixTsMs < 0 ||
          Severity: Critical
          Found in src_aurelia-bodylight-plugin/src/utils/uuidv7.js - About 2 hrs to fix

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

                if (Array.from(document.getElementsByTagName('script')).filter(x=> x.getAttribute('src') === source).length > 0) {
                  console.log('fmi.getScript() WARNING, script is already added into DOM:', source);
                  //do callback?
                  if (callback) setTimeout(callback, 0);
                  return;
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/fmi.js and 2 other locations - About 2 hrs to fix
            src_aurelia-bodylight-plugin/src/elements/animate-adobe-ss.js on lines 152..157
            src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 221..226

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

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

                  if (Array.from(document.getElementsByTagName('script')).filter(x=> x.getAttribute('src') === source).length > 0) {
                    console.warn('AnimateAdobe.getScript() WARNING, script is already added into DOM:', source);
                    //do callback?
                    if (callback) setTimeout(callback, 0);
                    return;
            Severity: Major
            Found in src_aurelia-bodylight-plugin/src/elements/animate-adobe.js and 2 other locations - About 2 hrs to fix
            src_aurelia-bodylight-plugin/src/elements/animate-adobe-ss.js on lines 152..157
            src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 222..227

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

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

                if (Array.from(document.getElementsByTagName('script')).filter(x=> x.getAttribute('src') === source).length > 0) {
                  console.warn('AnimateAdobe.getScript() WARNING, script is already added into DOM:', source);
                  //do callback?
                  if (callback) setTimeout(callback, 0);
                  return;
            src_aurelia-bodylight-plugin/src/elements/animate-adobe.js on lines 221..226
            src_aurelia-bodylight-plugin/src/elements/fmi.js on lines 222..227

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

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

            Dygraph.prototype.start_ = function() {
                var data = this.file_;
            
                // Functions can return references of all other types.
                if (typeof data == 'function') {
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/utils/dygraph.js - About 2 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

            Function removeAnswer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                removeAnswer(qid2,answer){
                    let qid = qid2;
                    if (qid2.includes(';')) qid = qid2.split(';')[0]; //first is id second is id of related tabs
                    if (this.quizids.includes(qid2)) {
                        let index = this.qas.findIndex(item => item.id === qid);
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/quiz-summary.js - About 2 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

            Function hslToRgb has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                hslToRgb(h, s, l) {
                  let r; let g; let b;
            
                  if (s === 0) {
                    r = g = b = l; // achromatic
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/src/elements/pdb-pdbe-molstar.js - About 2 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

            Function refresh has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            let refresh = debounce(() => {
              if (isBuilding) {
                log('Watcher: A build is already in progress, deferring change detection...');
                return;
              }
            Severity: Minor
            Found in src_aurelia-bodylight-plugin/aurelia_project/tasks/watch.js - About 2 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

            Severity
            Category
            Status
            Source
            Language