Showing 25 of 36 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

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

                    const Reference = () => {
                      const [term, setTerm] = useState('');
                      const [index, setIndex] = useState<FuseIndex<{ name: string; doc: string; }>>();
                    
                      const default_list = useMemo(() => {
                    Severity: Minor
                    Found in docs/src/pages/reference.tsx - 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" 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

                        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/pages/screenshooter.tsx - About 1 hr to fix

                          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" 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

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if(typeof state.sExprComment == "number") state.sExprComment++;
                                  Severity: Major
                                  Found in lib/js/codemirror.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
                                                                keyWord += letter;
                                                            }
                                    Severity: Major
                                    Found in lib/js/codemirror.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          } else if (ch == ")" || ch == "]") {
                                                              returnType = BRACKET;
                                                              if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
                                                                  popStack(state);
                                      
                                      
                                      Severity: Major
                                      Found in lib/js/codemirror.js - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language