Showing 33 of 33 total issues
Function RevealMenu
has a Cognitive Complexity of 505 (exceeds 5 allowed). Consider refactoring. Open
var RevealMenu = window.RevealMenu || (function(){
var config = Reveal.getConfig();
var options = config.menu || {};
options.path = options.path || scriptPath() || 'plugin/menu/';
if (!options.path.endsWith('/')) {
- Read upRead up
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 RevealMenu
has 769 lines of code (exceeds 25 allowed). Consider refactoring. Open
var RevealMenu = window.RevealMenu || (function(){
var config = Reveal.getConfig();
var options = config.menu || {};
options.path = options.path || scriptPath() || 'plugin/menu/';
if (!options.path.endsWith('/')) {
Function loadPlugin
has 668 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadPlugin() {
// does not support IE8 or below
var initialise = !ieVersion || ieVersion >= 9;
// do not load the menu in the upcoming slide panel in the speaker notes
File menu.js
has 771 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Reveal.js menu plugin
* MIT licensed
* (c) Greg Denehy 2015
*/
Function init
has 286 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init() {
if (!initialised) {
var parent = select('.reveal').parentElement;
var top = create('div', { 'class': 'slide-menu-wrapper'});
parent.appendChild(top);
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 75: case 38:
var currItem = select('.active-menu-panel .slide-menu-items li.selected') || select('.active-menu-panel .slide-menu-items li.active');
if (currItem) {
selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
var nextItem = select('.active-menu-panel .slide-menu-items li[data-item="' + (parseInt(currItem.getAttribute('data-item')) - 1) + '"]') || currItem;
- Read upRead up
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 141.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 74: case 40:
var currItem = select('.active-menu-panel .slide-menu-items li.selected') || select('.active-menu-panel .slide-menu-items li.active');
if (currItem) {
selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
var nextItem = select('.active-menu-panel .slide-menu-items li[data-item="' + (parseInt(currItem.getAttribute('data-item')) + 1) + '"]') || currItem;
- Read upRead up
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 141.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function onDocumentKeyDown
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onDocumentKeyDown(event) {
// opening menu is handled by registering key binding with Reveal below
if (isOpen()) {
event.stopImmediatePropagation();
switch( event.keyCode ) {
Function generateItem
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateItem(type, section, i, h, v) {
var link = '/#/' + h;
if (typeof v === 'number' && !isNaN( v )) link += '/' + v;
function text(selector, parent) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 35:
selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
var item = select('.active-menu-panel .slide-menu-items:last-of-type li:last-of-type');
if (item) {
item.classList.add('selected');
- Read upRead up
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 85.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 36:
selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
var item = select('.active-menu-panel .slide-menu-items li:first-of-type');
if (item) {
item.classList.add('selected');
- Read upRead up
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 85.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function speechUtteranceChunker
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
var speechUtteranceChunker = function (utt, settings, callback) {
settings = settings || {};
var newUtt;
var txt = (settings && settings.offset !== undefined ? utt.text.substring(settings.offset) : utt.text);
if (utt.voice && utt.voice.voiceURI === 'native') { // Not part of the spec
- Read upRead up
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
Method auto_section
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def auto_section(wrap = "<div class='card'>", stops = %w[hr], levels = %w[h1 h2 h4 h5 h6])
levels = Hash[levels.zip(0...levels.length)]
stops &&= Hash[stops.product([true])]
stack = []
children.each do |node|
- Read upRead up
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
Method check_spelling
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def check_spelling(md_file, dicts)
man_set = load_man_pages
markdown = Redcarpet::Markdown.new(Redcarpet::Render::BareMinimum)
f = File.open(md_file)
content = f.read
- Read upRead up
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 speechUtteranceChunker
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
var speechUtteranceChunker = function (utt, settings, callback) {
settings = settings || {};
var newUtt;
var txt = (settings && settings.offset !== undefined ? utt.text.substring(settings.offset) : utt.text);
if (utt.voice && utt.voice.voiceURI === 'native') { // Not part of the spec
Consider simplifying this complex logical expression. Open
if (initialise) {
//
// Set option defaults
//
var side = options.side || 'left'; // 'left' or 'right'
Function speak
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const speak = function(){
if(!('speechSynthesis' in window)){
return;
}
if(speaking == true){
Method check_spelling
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_spelling(md_file, dicts)
man_set = load_man_pages
markdown = Redcarpet::Markdown.new(Redcarpet::Render::BareMinimum)
f = File.open(md_file)
content = f.read
Function createSlideMenu
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSlideMenu() {
if ( !document.querySelector('section[data-markdown]:not([data-markdown-parsed])') ) {
var panel = create('div', {
'data-panel': 'Slides',
'class': 'slide-menu-panel active-menu-panel'
Function openItem
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function openItem(item, force) {
var h = parseInt(item.getAttribute('data-slide-h'));
var v = parseInt(item.getAttribute('data-slide-v'));
var theme = item.getAttribute('data-theme');
var transition = item.getAttribute('data-transition');