rwwarren/door-lock

View on GitHub
mobile/web/inc/mobile_app.js

Summary

Maintainability
D
3 days
Test Coverage

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

    TODO found
    Open

    //TODO add login to app then remove this file
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js by fixme

    TODO found
    Open

        //TODO fix this so that the user's name shows up without refresh
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js by fixme

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

        render: function(){
          var lockOrUnlock = (this.props.info.isLocked == "1") ? "Unlock" : "Lock";
          return (
          <div>
            <div className="userInfo">
    Severity: Major
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 7 hrs to fix
    mobile/web/inc/Lock.js on lines 30..45

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

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

                success:function(result){
                    console.log(result);
                    if(this.state.loggedIn == false){
                      this.setState({
                        loggedIn: true,
    Severity: Major
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 3 hrs to fix
    mobile/web/inc/Container.js on lines 55..66

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

    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

    function makeid() {
      var text = "";
      var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
      for( var i = 0; i < 103; i++ ) {
        text += possible.charAt(Math.floor(Math.random() * possible.length));
    Severity: Major
    Found in mobile/web/inc/mobile_app.js and 2 other locations - About 2 hrs to fix
    mobile/app/doorlock-app/LoginPage.js on lines 177..184
    mobile/app/doorlock-app/index.ios.js on lines 179..186

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

    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

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

            <div className="userInfo">
              Email: <input ref="email" id="email" className="infotextbox" placeholder={this.props.info.Email} />
            </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 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

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

            <div className="userInfo">
              CardID: <input ref="cardID" id="cardID" className="infotextbox" placeholder={this.props.info.CardID} />
            </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 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

    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

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

                success:function(result){
                    console.log(result);
                    //this.props.loginChange();
                    this.setState({
                      selectedTab: "UserInfo",
    Severity: Major
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 1 hr to fix
    mobile/web/inc/Container.js on lines 105..112

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

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

      login: function(result) {
        //TODO fix this so that the user's name shows up without refresh
        this.setState({
            loggedIn: true,
            Username: result.Username,
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 55 mins to fix
    mobile/web/inc/Container.js on lines 39..47

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

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

                success:function(result){
                    //this.props.loginChange();
                    console.log(result);
                    this.setState({
                      selectedTab: "LockStatus",
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 55 mins to fix
    mobile/web/inc/Container.js on lines 125..132

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

    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

          return <UserContent username={this.state.Username} name={this.state.Name} isAdmin={this.state.IsAdmin} />;
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 50 mins to fix
    web/src/inc/Container.js on lines 59..59

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

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

            <div className="userInfo">
              <button id="update" type="button" onClick={this.updateInfo}>Update Info</button>
            </div>
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 50 mins to fix
    mobile/web/inc/User.js on lines 47..49

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

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

                error:function(xhr,status,error){
                    console.log(status);
                    console.log(error);
                    return false;
                }.bind(this)
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js and 1 other location - About 35 mins to fix
    mobile/web/inc/Container.js on lines 67..71

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

    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

    Parsing error: Unexpected token <
    Open

          <div>
    Severity: Minor
    Found in mobile/web/inc/mobile_app.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status