trileg/WebTeX

View on GitHub

Showing 28 of 47 total issues

File app.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import configparser
import json
Severity: Minor
Found in WebTeX/app.py - About 4 hrs to fix

    Function compile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function compile() {
      if (cwd !== "") {
        // エディタのテキストを読み出し,JSONに
        // これをpythonに投げて,コンパイルリザルト,ログを受け取る
        // コンパイルに成功すれば,PDFファイルをindex.htmlに追加する
    Severity: Minor
    Found in WebTeX/static/js/main.js - About 2 hrs 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

    File main.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var editor;
    var cwd = "";
    
    $(window).load(init());
    
    
    Severity: Minor
    Found in WebTeX/static/js/main.js - About 2 hrs to fix

      Function compile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function compile() {
        if (cwd !== "") {
          // エディタのテキストを読み出し,JSONに
          // これをpythonに投げて,コンパイルリザルト,ログを受け取る
          // コンパイルに成功すれば,PDFファイルをindex.htmlに追加する
      Severity: Minor
      Found in WebTeX/static/js/main.js - About 1 hr to fix

        Function readFilelist has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function readFilelist(directoryItem) {
          var json = JSON.stringify({
            "_csrf_token": $("#_csrf_token").val()
          });
        
        
        Severity: Minor
        Found in WebTeX/static/js/main.js - About 1 hr to fix

          Function init has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function init() {
            editor = ace.edit("editor");
            readDirectory($("#username").text());
          
            $("#createDirectory").click(function () {
          Severity: Minor
          Found in WebTeX/static/js/main.js - About 1 hr 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 readDirectory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function readDirectory() {
            var json = JSON.stringify({
              "_csrf_token": $("#_csrf_token").val()
            });
          
          
          Severity: Minor
          Found in WebTeX/static/js/main.js - About 1 hr to fix

            Function check_csrf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_csrf(request_, type_):
                config = configparser.ConfigParser()
                config.read(conf)
                if config['dev']['check_csrf'] == 'true':
                    token = session['_csrf_token']
            Severity: Minor
            Found in WebTeX/app.py - About 1 hr 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 configureLdap has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function configureLdap() {
              if ((!$("#ldap-address").val() || !$("#ldap-port").val()) || !$("#ldap-basedn").val()) {
                $("#result-change-ldap").empty();
                $("#result-change-ldap").append(
                    '<p class="result bg-danger">Please input LDAP Address, Port, BaseDN correctly</p>'
            Severity: Minor
            Found in WebTeX/static/js/preference.js - About 1 hr to fix

              Function changePath has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function changePath() {
                if (!$("#redpen-path").val() || !$("#java-home").val()) {
                  $("#result-change-path").empty();
                  $("#result-change-path").append(
                      '<p class="result bg-danger">Please input RedPen Path and/or JAVA_HOME</p>'
              Severity: Minor
              Found in WebTeX/static/js/preference.js - About 1 hr to fix

                Function register has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function register() {
                  if (!$("#username").val() || !$("#password").val()) {
                    $("#result-user-registration").empty();
                    $("#result-user-registration").append(
                        '<p class="result bg-danger">Please input username and/or password</p>'
                Severity: Minor
                Found in WebTeX/static/js/preference.js - About 1 hr to fix

                  Function readFilelist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function readFilelist(directoryItem) {
                    var json = JSON.stringify({
                      "_csrf_token": $("#_csrf_token").val()
                    });
                  
                  
                  Severity: Minor
                  Found in WebTeX/static/js/main.js - About 1 hr 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 read_filelist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def read_filelist():
                      if not check_csrf(request, 'json'):
                          abort(403)
                  
                      dictionary = {}
                  Severity: Minor
                  Found in WebTeX/app.py - About 1 hr 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 success has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      success: function (data) {
                        $("#filelist").empty();
                        var result = JSON.parse(data.ResultSet).result;
                        if (result !== "Failure") {
                          $("#cwd").text(cwd);
                  Severity: Minor
                  Found in WebTeX/static/js/main.js - About 1 hr to fix

                    Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function init() {
                      editor = ace.edit("editor");
                      readDirectory($("#username").text());
                    
                      $("#createDirectory").click(function () {
                    Severity: Minor
                    Found in WebTeX/static/js/main.js - About 1 hr to fix

                      Function save_config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def save_config():
                          if not check_csrf(request, 'json'):
                              abort(403)
                      
                          dictionary = {}
                      Severity: Minor
                      Found in WebTeX/app.py - About 1 hr to fix

                        Function success has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            success: function (data) {
                              $("#directorylist").empty();
                              $("#directorylist").append(
                                  "<li><a data-toggle='modal' href='#createDirectoryModal'>Create directory</a></li>"
                              );
                        Severity: Minor
                        Found in WebTeX/static/js/main.js - About 1 hr to fix

                          Function readConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function readConfig() {
                            var json = JSON.stringify({
                              "_csrf_token": $("#_csrf_token").val()
                            });
                          
                          
                          Severity: Minor
                          Found in WebTeX/static/js/preference.js - About 1 hr to fix

                            Function setDirectory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function setDirectory(directoryItem) {
                              var json = JSON.stringify({
                                "name": directoryItem,
                                "_csrf_token": $("#_csrf_token").val()
                              });
                            Severity: Minor
                            Found in WebTeX/static/js/main.js - About 1 hr to fix

                              Avoid too many return statements within this function.
                              Open

                                  return
                              Severity: Major
                              Found in WebTeX/app.py - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language