Showing 19 of 55 total issues
Function default
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (passport) {
passport.serializeUser((user, done) => {
console.log(`___SERIALIZE{user}+++${user}`);
done(null, user.id);
});
Function SinglePoll
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SinglePoll = (props) => {
const renderDeleteBtn = () => {
if (props.user.loggedIn) {
return (
<Link
Function NewAnswer
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div>
<div className="parallax-container" style={{ height: '250px' }}>
<div className="parallax">
Function NewPoll
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function Polls
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Polls(state = [], action) {
switch (action.type) {
case FETCHED_POLLS:
return action.polls;
case ADD_POLL: {
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { user, login, logoutUser } = this.props;
const renderComponent = () => {
if (user.loggedIn) {
Function condRender
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const condRender = () => {
if (props.state.fetched) {
return (
<div>
<div className="row">
Function render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const renderComponent = (props) => {
if (props.user.loggedIn) {
return (
<a
Function Poll
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Poll = (props) => {
const locateVote = (a, b) => {
answerId = a;
vote = b;
};
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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">
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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">
Function Polls
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function Polls(state = [], action) {
switch (action.type) {
case FETCHED_POLLS:
return action.polls;
case ADD_POLL: {
- Read upRead up
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
Open
const renderComponent = () => {
if (user.loggedIn) {
return (
<div>
<li>
Function Signup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Signup = (props) => {
const passToProps = (e) => {
if (e) e.preventDefault();
props.login(true);
};
Function Login
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Login = (props) => {
const passToProps = (e) => {
if (e) e.preventDefault();
props.login({ name: 'daniel' });
};
Function Users
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Users(state = {}, action) {
switch (action.type) {
case FETCH_USER:
const temp = () => {
if (action.users === undefined) {
Avoid too many return
statements within this function. Open
Open
return done(null, user);
Function SinglePoll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
const SinglePoll = (props) => {
const renderDeleteBtn = () => {
if (props.user.loggedIn) {
return (
<Link
- Read upRead up
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"