DDCreationStudios/votingApp

View on GitHub

Showing 19 of 55 total issues

Function default has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (passport) {
  passport.serializeUser((user, done) => {
    console.log(`___SERIALIZE{user}+++${user}`);
    done(null, user.id);
  });
Severity: Major
Found in src/serverSideES6/config/passport.js - About 4 hrs to fix

    Function SinglePoll has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SinglePoll = (props) => {
      const renderDeleteBtn = () => {
        if (props.user.loggedIn) {
          return (
            <Link
    Severity: Major
    Found in src/components/singlePollPage/SinglePoll.js - About 3 hrs to fix

      Function NewAnswer has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const NewAnswer = (props) => {
        const answerList = props.state.answers.map((aw, ind) =>
          (<div className="input-field col s10" key={ind}>
            <i className="material-icons prefix">queue</i>
            <input
      Severity: Major
      Found in src/components/singlePollPage/NewAnswer.js - About 2 hrs to fix

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

          render() {
            return (
              <div>
                <div className="parallax-container" style={{ height: '250px' }}>
                  <div className="parallax">
        Severity: Major
        Found in src/components/homePage/Home.js - About 2 hrs to fix

          Function NewPoll has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const NewPoll = (props) => {
            const answerList = props.state.answers.map((aw, ind) =>
              (<div className="input-field col s10" key={ind}>
                <i className="material-icons prefix">queue</i>
                <input
          Severity: Major
          Found in src/components/pollsPage/NewPoll.js - About 2 hrs to fix

            Function Polls has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function Polls(state = [], action) {
              switch (action.type) {
                case FETCHED_POLLS:
                  return action.polls;
                case ADD_POLL: {
            Severity: Major
            Found in src/ducks/polls.js - About 2 hrs to fix

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

                render() {
                  const { user, login, logoutUser } = this.props;
              
                  const renderComponent = () => {
                    if (user.loggedIn) {
              Severity: Minor
              Found in src/components/sidebar/Sidebar.js - About 1 hr to fix

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

                  const condRender = () => {
                    if (props.state.fetched) {
                      return (
                        <div>
                          <div className="row">
                Severity: Minor
                Found in src/components/singlePollPage/SinglePoll.js - About 1 hr to fix

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

                    render() {
                      const renderComponent = (props) => {
                        if (props.user.loggedIn) {
                          return (
                            <a
                  Severity: Minor
                  Found in src/components/common/Header.js - About 1 hr to fix

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

                    const Poll = (props) => {
                      const locateVote = (a, b) => {
                        answerId = a;
                        vote = b;
                      };
                    Severity: Minor
                    Found in src/components/singlePollPage/Poll.js - About 1 hr to fix

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

                        render() {
                          return (
                            <div className="container-fluid grey darken-2">
                              <h1 className="teal-text container">404! Now dat site does not exist my friend!</h1>
                              <h4 className="teal-text container">
                      Severity: Minor
                      Found in src/components/Lost.js - About 1 hr to fix

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

                          render() {
                            const { polls, user, postPoll } = this.props;
                            const pollComp = polls.map((poll, index) =>
                              (<div key={shortid.generate()}>
                                <div className="col s12 m6 card-panel hoverable teal">
                        Severity: Minor
                        Found in src/components/pollsPage/Polls.js - About 1 hr to fix

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

                          export default function Polls(state = [], action) {
                            switch (action.type) {
                              case FETCHED_POLLS:
                                return action.polls;
                              case ADD_POLL: {
                          Severity: Minor
                          Found in src/ducks/polls.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 renderComponent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              const renderComponent = () => {
                                if (user.loggedIn) {
                                  return (
                                    <div>
                                      <li>
                          Severity: Minor
                          Found in src/components/sidebar/Sidebar.js - About 1 hr to fix

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

                            const Signup = (props) => {
                              const passToProps = (e) => {
                                if (e) e.preventDefault();
                                props.login(true);
                              };
                            Severity: Minor
                            Found in src/components/sidebar/Signup.js - About 1 hr to fix

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

                              const Login = (props) => {
                                const passToProps = (e) => {
                                  if (e) e.preventDefault();
                                  props.login({ name: 'daniel' });
                                };
                              Severity: Minor
                              Found in src/components/sidebar/Login.js - About 1 hr to fix

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

                                export default function Users(state = {}, action) {
                                  switch (action.type) {
                                    case FETCH_USER:
                                      const temp = () => {
                                        if (action.users === undefined) {
                                Severity: Minor
                                Found in src/ducks/user.js - About 1 hr to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return done(null, user);
                                  Severity: Major
                                  Found in src/serverSideES6/config/passport.js - About 30 mins to fix

                                    Function SinglePoll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const SinglePoll = (props) => {
                                      const renderDeleteBtn = () => {
                                        if (props.user.loggedIn) {
                                          return (
                                            <Link
                                    Severity: Minor
                                    Found in src/components/singlePollPage/SinglePoll.js - About 25 mins 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language