SUSE/hackweek

View on GitHub

Showing 103 of 103 total issues

File holder.js has 3089 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!

Holder - client side image placeholders
Version 2.9.9+jl7z
© 2021 Ivan Malopinsky - https://imsky.co
Severity: Major
Found in app/assets/javascripts/holder.js - About 1 wk to fix

    Function buildSceneGraph has 141 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function buildSceneGraph(scene) {
            var fontSize = App.defaults.size;
            var fixedSize = scene.flags.fixedSize != null ? scene.flags.fixedSize : scene.theme.fixedSize;
            if (parseFloat(scene.theme.size)) {
                fontSize = scene.theme.size;
    Severity: Major
    Found in app/assets/javascripts/holder.js - About 5 hrs to fix

      Function shaven has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function shaven(arrayOrObject) {
            var isArray = Array.isArray(arrayOrObject);
            var objType = typeof arrayOrObject === 'undefined' ? 'undefined' : _typeof(arrayOrObject);
      
            if (!isArray && objType !== 'object') {
      Severity: Major
      Found in app/assets/javascripts/holder.js - About 5 hrs to fix

        Function prepareDOMElement has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function prepareDOMElement(prepSettings) {
                var mode = prepSettings.mode;
                var el = prepSettings.el;
                var flags = prepSettings.flags;
                var _engineSettings = prepSettings.engineSettings;
        Severity: Major
        Found in app/assets/javascripts/holder.js - About 4 hrs to fix

          Function run has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  run: function(userOptions) {
                      //todo: split processing into separate queues
                      userOptions = userOptions || {};
                      var engineSettings = {};
                      var options = extend(App.settings, userOptions);
          Severity: Major
          Found in app/assets/javascripts/holder.js - About 4 hrs to fix

            Function _onDomReady has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _onDomReady(win) {
                    //Lazy loading fix for Firefox < 3.6
                    //http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
                    if (document.readyState == null && document.addEventListener) {
                        document.addEventListener("DOMContentLoaded", function DOMContentLoaded() {
            Severity: Major
            Found in app/assets/javascripts/holder.js - About 3 hrs to fix

              Function SceneGraph has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var SceneGraph = function(sceneProperties) {
                      var nodeCount = 1;
              
                      //todo: move merge to helpers section
                      function merge(parent, child) {
              Severity: Major
              Found in app/assets/javascripts/holder.js - About 3 hrs to fix

                Function buildDom has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function buildDom(elemArray) {
                        if (Array.isArray(elemArray) && elemArray.length === 0) {
                          // Ignore empty arrays
                          return {};
                        }
                Severity: Major
                Found in app/assets/javascripts/holder.js - About 3 hrs to fix

                  Class ProjectsController has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ProjectsController < ApplicationController
                    before_action :find_project_by_id
                    before_action :redirect_to_slug, only: [:show]
                    load_and_authorize_resource find_by: :url
                    skip_before_action :authenticate_user!, only: %i[index show archived finished newest popular biggest random]
                  Severity: Minor
                  Found in app/controllers/projects_controller.rb - About 3 hrs to fix

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

                        function formatValue(ctx, value, recurseTimes) {
                          // Provide a hook for user-specified inspect functions.
                          // Check that value is an object with an inspect function on it
                          if (ctx.customInspect &&
                              value &&
                    Severity: Major
                    Found in app/assets/javascripts/holder.js - About 3 hrs to fix

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

                          function render(renderSettings) {
                              var image = null;
                              var mode = renderSettings.mode;
                              var el = renderSettings.el;
                              var holderSettings = renderSettings.holderSettings;
                      Severity: Major
                      Found in app/assets/javascripts/holder.js - About 3 hrs to fix

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

                            module.exports = function (sceneGraph, renderSettings) {
                              var engineSettings = renderSettings.engineSettings;
                              var stylesheets = engineSettings.stylesheets;
                              var stylesheetXml = stylesheets.map(function (stylesheet) {
                                return '<?xml-stylesheet rel="stylesheet" href="' + stylesheet + '"?>';
                        Severity: Major
                        Found in app/assets/javascripts/holder.js - About 3 hrs to fix

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

                              var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
                          Severity: Major
                          Found in app/assets/javascripts/holder.js and 2 other locations - About 3 hrs to fix
                          app/assets/javascripts/holder.js on lines 2732..2732
                          app/assets/javascripts/holder.js on lines 3089..3089

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

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

                              var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
                          Severity: Major
                          Found in app/assets/javascripts/holder.js and 2 other locations - About 3 hrs to fix
                          app/assets/javascripts/holder.js on lines 2732..2732
                          app/assets/javascripts/holder.js on lines 3024..3024

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

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

                              var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
                          Severity: Major
                          Found in app/assets/javascripts/holder.js and 2 other locations - About 3 hrs to fix
                          app/assets/javascripts/holder.js on lines 3024..3024
                          app/assets/javascripts/holder.js on lines 3089..3089

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

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

                              var stagingRenderer = (function() {
                                  var svg = null,
                                      stagingText = null,
                                      stagingTextNode = null;
                                  return function(graph) {
                          Severity: Major
                          Found in app/assets/javascripts/holder.js - About 3 hrs to fix

                            Function parseURL has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function parseURL(url, instanceOptions) {
                                    var holder = {
                                        theme: extend(App.settings.themes.gray, null),
                                        stylesheets: instanceOptions.stylesheets,
                                        instanceOptions: instanceOptions
                            Severity: Major
                            Found in app/assets/javascripts/holder.js - About 2 hrs to fix

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

                                          if (dimensions.height.slice(-1) == '%') {
                                              el.style.height = dimensions.height;
                                          } else if (flags.auto == null || !flags.auto) {
                                              el.style.height = dimensions.height + 'px';
                                          }
                              Severity: Major
                              Found in app/assets/javascripts/holder.js and 1 other location - About 2 hrs to fix
                              app/assets/javascripts/holder.js on lines 844..848

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

                              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 (dimensions.width.slice(-1) == '%') {
                                              el.style.width = dimensions.width;
                                          } else if (flags.auto == null || !flags.auto) {
                                              el.style.width = dimensions.width + 'px';
                                          }
                              Severity: Major
                              Found in app/assets/javascripts/holder.js and 1 other location - About 2 hrs to fix
                              app/assets/javascripts/holder.js on lines 839..843

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

                              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

                              Class Project has 22 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Project < ApplicationRecord
                                include AASM
                                include Rails.application.routes.url_helpers
                              
                                validates :title, :description, :originator, presence: true
                              Severity: Minor
                              Found in app/models/project.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language