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,
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
- Read upRead up
- Exclude checks
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,
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<AppBar
showMenuIconButton={false}
title={config.authorName}
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (this.state.loading) {
return <section />;
}
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;
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
- Read upRead up
- Exclude checks
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;
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 {
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (this.state.loading) {
return <section />;
}
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className={styles.root}>
<IconMenu
className={styles.list}
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
- Read upRead up
- Exclude checks
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 };
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 (
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)}>
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
- Read upRead up
- Exclude checks
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>