JonSn0w/Hyde

View on GitHub

Showing 2,194 of 2,194 total issues

File main.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * HYDE - markdown editor
 * Copyright (c) 2017 Brett Stevenson <bstevensondev@gmail.com
 *
 * This program is free software: you can redistribute it and/or modify
Severity: Minor
Found in main.js - About 5 hrs to fix

    File settings.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const config = require('./js/config');
    var menu = $('#appMenu'),
            toolbar = $('#toolbar'),
            leftFade = $('#leftFade'),
            dragArea = $('#draggable'),
    Severity: Minor
    Found in js/settings.js - About 5 hrs to fix

      File bootstrap-notify.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
      * Project: Bootstrap Notify = v3.1.5
      * Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
      * Author: Mouse0270 aka Robert McIntosh
      * License: MIT License
      Severity: Minor
      Found in js/bootstrap/bootstrap-notify.js - About 4 hrs to fix

        File app.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        
        const electron = require('electron');
        const remote = electron.remote;
        const dialog = electron.remote.dialog;
        const shell = electron.shell;
        Severity: Minor
        Found in js/app.js - About 3 hrs to fix

          File format.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          
          function toggleFormat(type) {
            'use strict';
            let modifiers;
            if(type === 'strong')
          Severity: Minor
          Found in js/format.js - About 3 hrs to fix

            Function parseExpression has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            function parseExpression(raw, delimit, delimitEscaped, mathMode, finalPass) {
              finalPass = finalPass || false;
              var lines = raw.split('\n');
              var output = '';
            
            
            Severity: Minor
            Found in js/parseTex.js - About 3 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 getState has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function getState(cm, pos) {
              pos = pos || cm.getCursor('start');
              var stat = cm.getTokenAt(pos);
              if(!stat.type) return {};
              var types = stat.type.split(' ');
            Severity: Minor
            Found in js/format.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 _toggleHeading has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function _toggleHeading(direction) {
              var startPoint = cm.getCursor('start'),
                  endPoint = cm.getCursor('end');
              for(var i = startPoint.line; i <= endPoint.line; i++) {
                var text = cm.getLine(i);
            Severity: Minor
            Found in js/format.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 init has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    init: function () {
                        var self = this;
            
                        this.buildNotify();
                        if(this.settings.content.icon) {
            Severity: Major
            Found in js/bootstrap/bootstrap-notify.js - About 2 hrs to fix

              Function placement has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      placement: function () {
                          var self = this,
                          offsetAmt = this.settings.offset.y,
                          css = {
                              display: 'inline-block',
              Severity: Major
              Found in js/bootstrap/bootstrap-notify.js - About 2 hrs to fix

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

                    if(luminosity >= 0.6) {
                        menuButton.css('color', 'rgba(50, 50, 50, 0.1)');
                        menuButton.mouseover(function() {
                            $(this).css('color', 'rgba(50, 50, 50, 0.3)');
                        }).mouseout(function() {
                Severity: Major
                Found in js/settings.js and 1 other location - About 2 hrs to fix
                js/settings.js on lines 126..135

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

                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

                    } else {
                        menuButton.css('color', 'rgba(255, 255, 255, 0.07)');
                        menuButton.mouseover(function() {
                            $(this).css('color', 'rgba(255, 255, 255, 0.35)');
                        }).mouseout(function() {
                Severity: Major
                Found in js/settings.js and 1 other location - About 2 hrs to fix
                js/settings.js on lines 117..126

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

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

                window.onload = () => {
                    let themeColor = $('.cm-s-'+theme).css('background-color');
                    adaptTheme(themeColor, Color(themeColor).luminosity());
                    createModals();
                    fillEmojiModal();
                Severity: Minor
                Found in js/app.js - About 1 hr to fix

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

                  var formatHead = () => {
                      var textPanel = $('#textPanel'),
                              menuToggle = $('#menuToggle');
                      if(process.platfrom === 'darwin') {
                          preview.css('paddingTop', '25px');
                  Severity: Minor
                  Found in js/settings.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 update has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  update: function (command, update) {
                                      var commands = {};
                                      if(typeof command === 'string') {
                                          commands[command] = update;
                                      } else {
                  Severity: Minor
                  Found in js/bootstrap/bootstrap-notify.js - About 1 hr to fix

                    Function toggleState has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function toggleState(type, modifiers) {
                      if(modifiers.length === 0) return;
                      let startPoint = cm.getCursor('start');
                      let endPoint = cm.getCursor('end');
                      // get word at cursor if there's no selection
                    Severity: Minor
                    Found in js/format.js - About 1 hr to fix

                      Function parseExpression has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function parseExpression(raw, delimit, delimitEscaped, mathMode, finalPass) {
                        finalPass = finalPass || false;
                        var lines = raw.split('\n');
                        var output = '';
                      
                      
                      Severity: Minor
                      Found in js/parseTex.js - About 1 hr to fix

                        Function getState has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getState(cm, pos) {
                          pos = pos || cm.getCursor('start');
                          var stat = cm.getTokenAt(pos);
                          if(!stat.type) return {};
                          var types = stat.type.split(' ');
                        Severity: Minor
                        Found in js/format.js - About 1 hr to fix

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

                          var formatHead = () => {
                              var textPanel = $('#textPanel'),
                                      menuToggle = $('#menuToggle');
                              if(process.platfrom === 'darwin') {
                                  preview.css('paddingTop', '25px');
                          Severity: Minor
                          Found in js/settings.js - About 1 hr to fix

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

                            function createNotification(text, type) {
                                var head, icon;
                                if(type === 'success') {
                                    head = '<strong>Success </strong>';
                                    icon = 'fa fa-check-circle';
                            Severity: Minor
                            Found in js/notify.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language