tsurupin/portfolio

View on GitHub

Showing 163 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

    Assignment Branch Condition size for save_from_associations is too high. [32.28/20]
    Open

      def save_from_associations(params)
        ActiveRecord::Base.transaction do
          delete_unnecessary_items!(params[ITEMS_ATTRIBUTES]) if id
          delete_unnecessary_tags!(params[TAGGINGS_ATTRIBUTES]) if id
    
    
    Severity: Minor
    Found in app/models/post/form.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    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

            Method has too many lines. [22/15]
            Open

              def save_from_associations(params)
                ActiveRecord::Base.transaction do
                  delete_unnecessary_items!(params[ITEMS_ATTRIBUTES]) if id
                  delete_unnecessary_tags!(params[TAGGINGS_ATTRIBUTES]) if id
            
            
            Severity: Minor
            Found in app/models/post/form.rb by rubocop

            This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

            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() {
                    if (this.state.loading) {
                      return <section />;
                    }
                
                
                Severity: Major
                Found in frontend/src/cms/containers/projects/Index/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

                    Assignment Branch Condition size for show is too high. [23/20]
                    Open

                      def show
                        cache_name = "cached_posts/#{params[:id]}"
                        cache_name += "?#{params[:previewing]}" if params[:previewing]
                    
                        json = rails_cache(cache_name) do

                    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

                    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

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

                      class ItemImageUploader < CarrierWave::Uploader::Base
                        include CarrierWave::MiniMagick
                        include CarrierWave::MimeTypes
                        process :set_content_type
                      
                      
                      Severity: Major
                      Found in app/uploaders/item_image_uploader.rb and 2 other locations - About 1 hr to fix
                      app/uploaders/author_image_uploader.rb on lines 3..33
                      app/uploaders/project_image_uploader.rb on lines 3..33

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

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

                      class ProjectImageUploader < CarrierWave::Uploader::Base
                        include CarrierWave::MiniMagick
                        include CarrierWave::MimeTypes
                        process :set_content_type
                      
                      
                      Severity: Major
                      Found in app/uploaders/project_image_uploader.rb and 2 other locations - About 1 hr to fix
                      app/uploaders/author_image_uploader.rb on lines 3..33
                      app/uploaders/item_image_uploader.rb on lines 3..33

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

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

                      class AuthorImageUploader < CarrierWave::Uploader::Base
                        include CarrierWave::MiniMagick
                        include CarrierWave::MimeTypes
                        process :set_content_type
                      
                      
                      Severity: Major
                      Found in app/uploaders/author_image_uploader.rb and 2 other locations - About 1 hr to fix
                      app/uploaders/item_image_uploader.rb on lines 3..33
                      app/uploaders/project_image_uploader.rb on lines 3..33

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

                      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

                      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

                          Method has too many lines. [16/15]
                          Open

                            def show
                              cache_name = "cached_posts/#{params[:id]}"
                              cache_name += "?#{params[:previewing]}" if params[:previewing]
                          
                              json = rails_cache(cache_name) do

                          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                          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
                            Severity
                            Category
                            Status
                            Source
                            Language