rwwarren/door-lock

View on GitHub

Showing 33 of 383 total issues

File DoorlockApiAppResource.java has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.wrixton.doorlock.resources;

import com.codahale.metrics.annotation.Timed;
import com.wrixton.doorlock.DAO.BasicDoorlockUser;
import com.wrixton.doorlock.DAO.DoorlockUser;

    File userFunctions.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    ini_set("session.hash_function", "sha512");
    session_name('sid');
    session_start();
    Severity: Minor
    Found in mobile/web/src/root/userFunctions.php - About 2 hrs to fix

      Function render has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render: function() {
          return (
            <div className="adminPage">
              <table className="userList">
                <tr>
      Severity: Major
      Found in web/src/inc/Admin.js - About 2 hrs to fix

        File mobile_app.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        //TODO add login to app then remove this file
        
        
        /**
         * PiDuinoLock mobile web app
        Severity: Minor
        Found in mobile/web/inc/mobile_app.js - About 2 hrs to fix

          File GetLoggedInUser.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var React = require('react-native');
          
          var {
          Severity: Minor
          Found in mobile/app/doorlock-app/GetLoggedInUser.js - About 2 hrs to fix

            Function render has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render: function() {
                if(!this.state.loaded){
                  return (<Text>Loading....</Text>);
                }
                return (
            Severity: Minor
            Found in mobile/app/doorlock-app/GetLoggedInUser.js - About 1 hr to fix

              Function render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render: function() {
                  return (
                    <div className="">
                      <div>
                        User Info Page
              Severity: Minor
              Found in web/src/inc/User.js - About 1 hr to fix

                Function renderUserInfo has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  renderUserInfo: function(){
                    return (
                      <View style={styles.container}>
                        <Text style={styles.pageTitle}>User modification</Text>
                        <Text>Username:</Text>
                Severity: Minor
                Found in mobile/app/doorlock-app/GetLoggedInUser.js - About 1 hr to fix

                  Function login has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    login: function() {
                      console.log("login attempt");
                      var username = this.refs.username.getDOMNode().value.trim();
                      var password = this.refs.password.getDOMNode().value.trim();
                      var token = this.refs.token.getDOMNode().value.trim();
                  Severity: Minor
                  Found in web/src/inc/LoginPage.js - About 1 hr to fix

                    Function registerUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      registerUser: function(){
                        //TODO check username is unique
                        //email password reset?
                        //fix 0 to null authyId
                        //check on frontend
                    Severity: Minor
                    Found in web/src/inc/Admin.js - About 1 hr to fix

                      Method equals has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          public boolean equals(Object o) {
                              if (this == o) return true;
                              if (o == null || getClass() != o.getClass()) return false;
                              RegisterUserRequest that = (RegisterUserRequest) o;
                      Severity: Minor
                      Found in api/src/main/java/com/wrixton/doorlock/RegisterUserRequest.java - 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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render: function() {
                          var adminNav = '';
                          var test;
                          //TODO fix this
                          var isAdmin = true;
                      Severity: Minor
                      Found in web/src/inc/Nav.js - About 1 hr to fix

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

                          getBundleStream: function() {
                            if(!jsBundler) {
                              JSGulp._createBundler(false);
                            }
                            console.log('Bundling JS');
                        Severity: Minor
                        Found in web/gulp/JSGulp.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                            if (isset($_SESSION['username']) && isset($_POST['oldPwd']) && isset($_POST['newPwd']) && isset($_POST['authy']) &&
                                isset($_POST['card']) && isset($_POST['email']) && isset($_POST['name']) && isset($_POST['confNewPass']) ){
                              $username = $_SESSION['username'];
                              $oldPassword = mysql_real_escape_string($_POST['oldPwd']);
                              $newPassword = mysql_real_escape_string($_POST['newPwd']);
                          Severity: Critical
                          Found in mobile/web/src/root/userFunctions.php - About 1 hr to fix

                            Method equals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                @Override
                                public boolean equals(Object o) {
                                    if (this == o) return true;
                                    if (o == null || getClass() != o.getClass()) return false;
                                    DoorlockUser that = (DoorlockUser) o;
                            Severity: Minor
                            Found in api/src/main/java/com/wrixton/doorlock/DAO/DoorlockUser.java - 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 cookie has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var config = $.cookie = function (key, value, options) {
                            
                                    // Write
                            
                                    if (arguments.length > 1 && !$.isFunction(value)) {
                            Severity: Minor
                            Found in mobile/web/src/root/js/jquery.cookie.js - About 1 hr to fix

                              Method run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @Override
                                  public void run(DoorlockApiAppConfiguration doorlockApiAppConfiguration, Environment environment) throws Exception {
                                      environment.jersey().register(new ApiListingResource());
                              
                                      final DBIFactory factory = new DBIFactory();
                              Severity: Minor
                              Found in api/src/main/java/com/wrixton/doorlock/DoorlockApiApp.java - About 1 hr to fix

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

                                    connectWith: "ul", items: "li:not(.currentUser)", update: function(event, ui) {
                                      if(ui.sender) {
                                        //TODO make sure username is correct and not tampored with
                                        console.log("selected");
                                        //TODO validate this.... not the best way to do this
                                Severity: Minor
                                Found in web/src/root/js/jqueryDoorlock.js - About 1 hr to fix

                                  Method changeUserInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function changeUserInfo(){
                                    if (isset($_SESSION['username']) && isset($_POST['oldPwd']) && isset($_POST['newPwd']) && isset($_POST['authy']) &&
                                        isset($_POST['card']) && isset($_POST['email']) && isset($_POST['name']) && isset($_POST['confNewPass']) ){
                                      $username = $_SESSION['username'];
                                      $oldPassword = mysql_real_escape_string($_POST['oldPwd']);
                                  Severity: Minor
                                  Found in mobile/web/src/root/userFunctions.php - About 1 hr to fix

                                    Function renderLoginPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      renderLoginPage: function() {
                                        if(this.state.loaded && this.state.responseData.success === "1"){
                                          AsyncStorage.setItem(STORAGE_KEY, this.state.sid).done();
                                          return this.userPage();
                                        }
                                    Severity: Minor
                                    Found in mobile/app/doorlock-app/index.ios.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language