WRidder/react-spa

View on GitHub

Showing 32 of 52 total issues

Function render has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

  render: function() {
    // TODO: DRY this up
    var navState = this.state.get("currentState");
    var availableRoutes = this.state.get("availableRoutes");
    var documentTitle = this.state.get("documentTitle");
Severity: Minor
Found in client/src/components/core/breadcrumbs.jsx - 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 exports has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (object){

  // initialise the list of objects and size
  var objects = [object];
  var size    = 0;
Severity: Minor
Found in client/src/helper/sizeof.js - About 5 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

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

  render: function() {
    // TODO: DRY this up
    var navState = this.state.get("currentState");
    var availableRoutes = this.state.get("availableRoutes");
    var documentTitle = this.state.get("documentTitle");
Severity: Major
Found in client/src/components/core/breadcrumbs.jsx - About 2 hrs to fix

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

      render: function() {
        // Show message if available
        var msg;
        if (this.state.session.get("msg")) {
          msg = (
    Severity: Major
    Found in client/src/components/user/signup.jsx - About 2 hrs to fix

      Function get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        get(path, localOnly) {
          // Check for hydrated data
          var hydratedData = dataProvider.getDataByPath(path);
          if(Object.getOwnPropertyNames(hydratedData).length !== 0 || localOnly){
            this.response = hydratedData;
      Severity: Minor
      Found in client/src/core/dataInterface.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 exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (passport) {
        passport.serializeUser(function (user, done) {
          done(null,{
            id: user.get("id"),
            username: user.get("username")
      Severity: Minor
      Found in server/src/config/passport.js - About 1 hr to fix

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

          render: function() {
            // Show message if available
            var msg;
            if (this.state.session.get("msg")) {
              msg = (
        Severity: Minor
        Found in client/src/components/user/login.jsx - About 1 hr to fix

          Function renderApp has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderApp: function(req, res) {
              var authenticated = req.isAuthenticated();
              try {
                if (enableHtmlCache && _.has(htmlCache, req.path) && !authenticated) {
                  console.log("Cache hit!");
          Severity: Minor
          Found in server/src/controllers/isomorphic.js - About 1 hr to fix

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

              render: function() {
                return (
                  <footer className="footer">
                    <div className="row full-width">
                      <div className="small-6 medium-6 large-6 xlarge-6 columns">
            Severity: Minor
            Found in client/src/components/core/footer.jsx - About 1 hr to fix

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

              module.exports = function (listenable, key) {
                return {
                  getInitialState: function () {
                    if (!_.isFunction(listenable.getInitialState)) {
                      return {};
              Severity: Minor
              Found in client/src/libraries/tmp_connect.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 createUser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                createUser: function(username, password) {
                  var deferred = q.defer();
              
                  // Check if user already exists
                  if (this.getByUsername(username)) {
              Severity: Minor
              Found in server/src/database/models/user.js - About 1 hr to fix

                Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function (listenable, key) {
                  return {
                    getInitialState: function () {
                      if (!_.isFunction(listenable.getInitialState)) {
                        return {};
                Severity: Minor
                Found in client/src/libraries/tmp_connect.js - About 1 hr to fix

                  Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function (object){
                  
                    // initialise the list of objects and size
                    var objects = [object];
                    var size    = 0;
                  Severity: Minor
                  Found in client/src/helper/sizeof.js - About 1 hr to fix

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

                      renderApp: function(req, res) {
                        var authenticated = req.isAuthenticated();
                        try {
                          if (enableHtmlCache && _.has(htmlCache, req.path) && !authenticated) {
                            console.log("Cache hit!");
                    Severity: Minor
                    Found in server/src/controllers/isomorphic.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 render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render: function() {
                        var view = this;
                    
                        // Questions
                        var questions = <ReactSpinner/>;
                    Severity: Minor
                    Found in client/src/components/questions/questionList.jsx - About 1 hr to fix

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

                        login: function(req, res, next) {
                          passport.authenticate('local-login', function (err, user) {
                            if (user) {
                              // Create session
                              req.logIn(user, function(err) {
                      Severity: Minor
                      Found in server/src/controllers/auth.js - About 1 hr to fix

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

                          render: function() {
                            return (
                              <DocumentTitle title="New question">
                                <div className="row">
                                  <div className="large-12 columns">
                        Severity: Minor
                        Found in client/src/components/questions/questionNew.jsx - About 1 hr to fix

                          Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            render: function() {
                              var view = this;
                          
                              // Questions
                              var questions = <ReactSpinner/>;
                          Severity: Minor
                          Found in client/src/components/questions/questionList.jsx - 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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            initialize: function(data, options) {
                              if (options) {
                                if (options.parentCollection) {
                                  this._parentCollection = options.parentCollection;
                                }
                          Severity: Minor
                          Found in server/src/collections/resourceCollection.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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            render: function() {
                              var profileLink = (this.state.session.get("auth")) ? (<NavLink to="/profile" title="Profile" className="profile"/>) : "";
                              var loginoutLink = (this.state.session.get("auth")) ? (<li className="logout"><LogoutLink/></li>) : (<NavLink to="/login" title="Login" className="login"/>);
                          
                              // Dev settings toolbar
                          Severity: Minor
                          Found in client/src/components/core/navigation.jsx - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language