rwwarren/door-lock

View on GitHub

Showing 383 of 383 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

var serialize = function (data) {
  return Object.keys(data).map(function (keyName) {
    return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
  }).join('&');
};
Severity: Major
Found in mobile/app/doorlock-app/index.ios.js and 2 other locations - About 1 hr to fix
mobile/app/doorlock-app/GetLoggedInUser.js on lines 25..29
mobile/app/doorlock-app/LoginPage.js on lines 28..32

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 69.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

var serialize = function (data) {
  return Object.keys(data).map(function (keyName) {
    return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
  }).join('&');
};
Severity: Major
Found in mobile/app/doorlock-app/GetLoggedInUser.js and 2 other locations - About 1 hr to fix
mobile/app/doorlock-app/LoginPage.js on lines 28..32
mobile/app/doorlock-app/index.ios.js on lines 29..33

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 69.

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

Error: Missing parentheses in call to 'print'. Did you mean print(t "turning the automated door lock")? (<unknown>, line 3)</unknown>
Open

  print "turning the automated door lock"
Severity: Minor
Found in servo/wholeLock.py by radon

We encountered an error attempting to analyze this line.

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        del([outputPath + '/' + reactFile], function(err, paths) {
          if(err) {
            console.error('Error cleaning JS: ' + err.toString());
            return;
          }
    Severity: Major
    Found in web/gulp/JSGulp.js and 1 other location - About 1 hr to fix
    web/gulp/JSGulp.js on lines 97..103

    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 66.

    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

        del([outputPath + '/' + buildFile], function(err, paths) {
          if(err) {
            console.error('Error cleaning JS: ' + err.toString());
            return;
          }
    Severity: Major
    Found in web/gulp/JSGulp.js and 1 other location - About 1 hr to fix
    web/gulp/JSGulp.js on lines 104..110

    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 66.

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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            renderLogin: function(){
              if(this.state.username.length > 0 && this.state.password.length > 0){
                this.attemptLogin();
              }
            },
          Severity: Major
          Found in mobile/app/doorlock-app/LoginPage.js and 1 other location - About 1 hr to fix
          mobile/app/doorlock-app/index.ios.js on lines 122..126

          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 63.

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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              renderLogin: function(){
                if(this.state.username.length > 0 && this.state.password.length > 0){
                  this.attemptLogin();
                }
              },
            Severity: Major
            Found in mobile/app/doorlock-app/index.ios.js and 1 other location - About 1 hr to fix
            mobile/app/doorlock-app/LoginPage.js on lines 123..127

            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 63.

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

                    Similar blocks of code found in 8 locations. Consider refactoring.
                    Open

                            <div className="userInfo">
                              AuthyID: <input ref="authyID" id="authyID" className="infotextbox" placeholder={this.props.info.AuthyID} />
                            </div>
                    Severity: Major
                    Found in mobile/web/inc/mobile_app.js and 7 other locations - About 1 hr to fix
                    mobile/web/inc/User.js on lines 35..37
                    mobile/web/inc/User.js on lines 38..40
                    mobile/web/inc/User.js on lines 41..43
                    mobile/web/inc/User.js on lines 44..46
                    mobile/web/inc/mobile_app.js on lines 27..29
                    mobile/web/inc/mobile_app.js on lines 30..32
                    mobile/web/inc/mobile_app.js on lines 33..35

                    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 59.

                    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 8 locations. Consider refactoring.
                    Open

                            <div className="userInfo">
                              Name: <input ref="name" id="name" className="infotextbox" placeholder={this.props.info.Name} />
                            </div>
                    Severity: Major
                    Found in mobile/web/inc/mobile_app.js and 7 other locations - About 1 hr to fix
                    mobile/web/inc/User.js on lines 35..37
                    mobile/web/inc/User.js on lines 38..40
                    mobile/web/inc/User.js on lines 41..43
                    mobile/web/inc/User.js on lines 44..46
                    mobile/web/inc/mobile_app.js on lines 30..32
                    mobile/web/inc/mobile_app.js on lines 33..35
                    mobile/web/inc/mobile_app.js on lines 36..38

                    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 59.

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language