Showing 37 of 37 total issues
Function terminal
has 307 lines of code (exceeds 25 allowed). Consider refactoring. Open
var terminal = (function($) {
return function({ selector, lips, dynamic = false, name = 'terminal' }, undefined) {
var position;
var timer;
var help = lips.env.get('help');
Function terminal
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
var terminal = (function($) {
return function({ selector, lips, dynamic = false, name = 'terminal' }, undefined) {
var position;
var timer;
var help = lips.env.get('help');
- 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 token
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
token: function (stream, state) {
if (state.indentStack == null && stream.sol()) {
// update indentation, but only if indentStack is empty
state.indentation = stream.indentation();
}
Function Interpreter
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Interpreter(): JSX.Element {
const [activeSnippet, setActiveSnippet] = useState(0);
const [size, setSize] = useState(1);
const ref = useRef<HTMLDivElement>();
Similar blocks of code found in 2 locations. Consider refactoring. Open
<li><a href="https://stackoverflow.com">StackOverlow</a> code was used for functions:
<ul dir="auto">
<li><a href="https://stackoverflow.com/a/10372280/387194">fworker</a>,</li>
<li><a href="https://stackoverflow.com/a/27282907/387194">flatten</a>,</li>
<li><a href="https://stackoverflow.com/a/4331218/387194">allPossibleCases</a>.</li>
- 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 137.
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
<li><a href="https://rosettacode.org/">Rosetta Code</a> was used for:
<ul dir="auto">
<li><a href="https://rosettacode.org/wiki/Greatest_common_divisor#JavaScript">gdc</a>,</li>
<li><a href="https://rosettacode.org/wiki/Least_common_multiple#JavaScript">lcm</a>,</li>
<li><a href="https://rosettacode.org/wiki/Convert_decimal_number_to_rational">LFloat::toRational</a>.</li>
- 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 137.
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 init
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init() {
$('.terminal.lips').each(function() {
$(this).terminal().destroy().remove();
});
$.terminal.defaults.linksNoReferrer = true;
File terminal.js
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* This is example of usage of LIPS interprter with jQuery Terminal
*
* Features: tab completion
* parenthesis matching
File examples.ts
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
const examples = [
{
description: `With LIPS you can mix Scheme and JavaScript. You can access all JavaScript objects. You can also call any functions from Scheme.
**NOTE**: you can hover over Scheme symbols and get tooltip with documentation.`,
File codemirror.js
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Modification of Codemirror Scheme mode for LIPS Scheme
// based on version of addon from Codemirror 5.58.3
// Plus Scheme Hints for LIPS Standard library
// Copyright (c) by Jakub T. Jankiewicz
// Copyright (c) by Marijn Haverbeke and others
Function keypress
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
keypress: function(e) {
var term = this;
function is_open(token) {
return ['(', '['].indexOf(token) !== -1;
}
Function tooltips
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tooltips($node, get_name, position) {
const selector = '.token.function, .token.keyword, .token.operator, .token.builtin, .token.name';
$node.on('mouseover', selector, function() {
var self = $(this);
var lips = term.interpreter;
Function Intro
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Intro(): JSX.Element {
return (
<div className={styles.section}>
<Heading as="h2" id="summary" className={styles.header}>Summary</Heading>
<p>
Function ScreenShotBox
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ScreenShotBox(): JSX.Element {
const { siteConfig } = useDocusaurusContext();
useScripts([
'https://cdn.jsdelivr.net/combine/npm/codemirror@5.58.3/lib/codemirror.js,npm/codemirror@5.58.3/mode/javascript/javascript.js,npm/codemirror@5.58.3/addon/edit/matchbrackets.js,gh/jcubic/lips@devel/lib/js/codemirror.js',
`${siteConfig.baseUrl}js/screenshooter.js`
Similar blocks of code found in 2 locations. Consider refactoring. Open
function fullScreen(event: MouseEvent<HTMLAnchorElement>) {
event.preventDefault();
const $ = globalThis.jQuery;
$(document.body).addClass('full-screen');
}
- 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 61.
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
function exitFullScreen(event: MouseEvent<HTMLAnchorElement>) {
event.preventDefault();
const $ = globalThis.jQuery;
$(document.body).removeClass('full-screen');
}
- 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 61.
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 Bookmark
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Bookmark(): JSX.Element {
const ref = useRef<HTMLAnchorElement>();
useEffect(() => {
const url = 'https://cdn.jsdelivr.net/gh/jcubic/lips@devel/lib/js/bookmark.js';
fetch(url).then(function(res) {
Function initTerminal
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initTerminal() {
const $ = globalThis.$;
$.terminal.syntax('scheme');
const $term = $('.term');
if (!original) {
Function Acknowledgment
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Acknowledgment(): JSX.Element {
return (
<div className={styles.section}>
<Heading as="h2" id="acknowledgment" className={styles.header}>Acknowledgments</Heading>
<ul>
Function term
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var term = $(selector).terminal(function(code, term) {
// format before executing mainly for strings in function docs
//code = new lips.Formatter(code).format();
return interpreter.exec(code, dynamic).then(function(ret) {
ret.forEach(function(ret) {