tsurupin/portfolio

View on GitHub

Showing 35 of 163 total issues

File posts_test.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { expect, sinon } from '../../helpers/utility';
import {
  fetchPosts,
  fetchEditPost,
  fetchNewPost,
Severity: Minor
Found in frontend/test/cms/actions/posts_test.js - About 3 hrs to fix

    File projects_test.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { expect, sinon } from '../../helpers/utility';
    import {
      fetchProjects,
      fetchProject,
      fetchNewProject,
    Severity: Minor
    Found in frontend/test/cms/actions/projects_test.js - About 3 hrs to fix

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

        render() {
          return (
            <AppBar
              showMenuIconButton={false}
              title={config.authorName}
      Severity: Major
      Found in frontend/src/cms/components/NavigationBar/index.js - About 2 hrs to fix

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

          render() {
            if (this.state.loading) {
              return <section />;
            }
        
        
        Severity: Major
        Found in frontend/src/cms/containers/posts/Index/index.js - About 2 hrs to fix

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

          export default function (state = [], action) {
            switch (action.type) {
              case FETCH_ITEMS:
                return action.payload.items;
          
          
          Severity: Major
          Found in frontend/src/shared/reducers/items.js - About 2 hrs to fix

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

              render() {
                const headerLabel = this.props.params.id ? 'Update Project' : 'Create New Project';
                const submitLabel = this.props.params.id ? 'Update' : 'Create';
                const { handleSubmit, submitting, fields: { title, caption, sourceUrl, image, description } } = this.props;
                
            Severity: Major
            Found in frontend/src/cms/containers/projects/Form/index.js - About 2 hrs to fix

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

                render() {
                  let publishActionIcon;
                  if (this.props.accepted) {
                    publishActionIcon = <ActionVisibilityOff name="in-visible-icon" />;
                  } else {
              Severity: Major
              Found in frontend/src/cms/components/posts/indexes/Item/index.js - About 2 hrs to fix

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

                  render() {
                    return (
                      <div className={styles.root}>
                        <IconMenu
                          className={styles.list}
                Severity: Major
                Found in frontend/src/cms/components/posts/forms/Item/Preview/Tooltip/index.js - About 2 hrs to fix

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

                    render() {
                      if (this.state.loading) {
                        return <section />;
                      }
                  
                  
                  Severity: Major
                  Found in frontend/src/cms/containers/projects/Index/index.js - About 2 hrs to fix

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

                    export default function (state = INITIAL_STATE, action) {
                      switch (action.type) {
                        case FETCH_POSTS_INFINITELY.REQUEST:
                          return { ...state, loading: true };
                    
                    
                    Severity: Minor
                    Found in frontend/src/shared/reducers/posts.js - About 2 hrs to fix

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

                        render() {
                          const submitLabel = this.props.params.id ? 'Update' : 'Create';
                          const { handleSubmit, submitting, fields: { title, publishedAt, leadSentence } } = this.props;
                          
                          return (
                      Severity: Minor
                      Found in frontend/src/cms/containers/posts/Form/index.js - About 1 hr to fix

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

                          render() {
                            const { handleSubmit, submitting, fields: { name, image, description, introduction } } = this.props;
                            
                            return (
                              <form className={styles.root} onSubmit={handleSubmit(this.handleSubmit)}>
                        Severity: Minor
                        Found in frontend/src/cms/containers/authors/Form/index.js - About 1 hr to fix

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

                            render() {
                              const { handleSubmit, submitting, fields: { name, password, passwordConfirmation, email } }  = this.props;
                              return(
                                <form onSubmit={handleSubmit(this.handleSubmit)} className={styles.root}>
                                  <h2 className={styles.heading}>Sign Up</h2>
                          Severity: Minor
                          Found in frontend/src/cms/containers/authors/SignUp/index.js - About 1 hr to fix

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

                            export default function (ComposedComponent) {
                              function mapStateToProps(state) {
                                return {
                                  hasAlert: state.error.hasAlert,
                                  message: state.error.message,
                            Severity: Minor
                            Found in frontend/src/shared/containers/Alert/index.js - About 1 hr to fix

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

                                renderComponent() {
                                  switch (this.props.item.targetType) {
                                    case TARGET_TYPES.IMAGE:
                                      return (
                                        <Image
                              Severity: Minor
                              Found in frontend/src/cms/components/posts/forms/Item/Form/index.js - About 1 hr to fix

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

                                  render() {
                                    return (
                                      <AppBar
                                        showMenuIconButton={false}
                                        title={config.authorName}
                                Severity: Minor
                                Found in frontend/src/client/components/NavigationBar/index.js - About 1 hr to fix

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

                                    render() {
                                      let publishActionIcon;
                                      let statusIcon;
                                      if (this.props.accepted) {
                                        publishActionIcon = <ActionVisibilityOff name="in-visible-icon" />;
                                  Severity: Minor
                                  Found in frontend/src/cms/components/projects/indexes/Item/index.js - About 1 hr to fix

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

                                    export default function(ComposedComponent) {
                                      
                                      function mapStateToProps(state) {
                                        return {
                                          authenticated: state.auth.authenticated
                                    Severity: Minor
                                    Found in frontend/src/cms/containers/shared/Authentication/index.js - About 1 hr to fix

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

                                        render() {
                                          const { handleSubmit, submitting, fields: { image, caption } } = this.props;
                                      
                                          return (
                                            <div className={styles.root}>
                                      Severity: Minor
                                      Found in frontend/src/cms/components/posts/forms/Item/Form/Image/index.js - About 1 hr to fix

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

                                        export default function (state = [], action) {
                                          switch (action.type) {
                                            case FETCH_ITEMS:
                                              return action.payload.items;
                                        
                                        
                                        Severity: Minor
                                        Found in frontend/src/shared/reducers/items.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language