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');
Severity: Major
Found in lib/js/terminal.js - About 1 day to fix

    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');
    Severity: Minor
    Found in lib/js/terminal.js - About 1 day 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 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();
                }
    Severity: Major
    Found in lib/js/codemirror.js - About 6 hrs to fix

      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>();
      
      
      Severity: Major
      Found in docs/src/components/Interpreter/index.tsx - About 5 hrs to fix

        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>
        Severity: Major
        Found in docs/src/components/Acknowledgment/index.tsx and 1 other location - About 5 hrs to fix
        docs/src/components/Acknowledgment/index.tsx on lines 15..21

        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

        Further Reading

        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>
        Severity: Major
        Found in docs/src/components/Acknowledgment/index.tsx and 1 other location - About 5 hrs to fix
        docs/src/components/Acknowledgment/index.tsx on lines 22..28

        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

        Further Reading

        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;
        Severity: Major
        Found in lib/js/bookmark.js - About 3 hrs to fix

          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
          Severity: Minor
          Found in lib/js/terminal.js - About 3 hrs to fix

            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.`,
            Severity: Minor
            Found in docs/src/components/Interpreter/examples.ts - About 2 hrs to fix

              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
              Severity: Minor
              Found in lib/js/codemirror.js - About 2 hrs to fix

                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;
                                }
                Severity: Minor
                Found in lib/js/terminal.js - About 1 hr to fix

                  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;
                  Severity: Minor
                  Found in lib/js/terminal.js - About 1 hr to fix

                    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>
                    Severity: Minor
                    Found in docs/src/components/Intro/index.tsx - About 1 hr to fix

                      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`
                      Severity: Minor
                      Found in docs/src/components/ScreenShotBox/index.tsx - About 1 hr to fix

                        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');
                          }
                        Severity: Major
                        Found in docs/src/components/Interpreter/index.tsx and 1 other location - About 1 hr to fix
                        docs/src/components/Interpreter/index.tsx on lines 85..89

                        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

                        Further Reading

                        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');
                          }
                        Severity: Major
                        Found in docs/src/components/Interpreter/index.tsx and 1 other location - About 1 hr to fix
                        docs/src/components/Interpreter/index.tsx on lines 79..83

                        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

                        Further Reading

                        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) {
                        Severity: Minor
                        Found in docs/src/components/Tools/Bookmark.tsx - About 1 hr to fix

                          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) {
                          Severity: Minor
                          Found in docs/src/components/Interpreter/terminal.ts - About 1 hr to fix

                            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>
                            Severity: Minor
                            Found in docs/src/components/Acknowledgment/index.tsx - About 1 hr to fix

                              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) {
                              Severity: Minor
                              Found in lib/js/terminal.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language