Showing 19 of 41 total issues
Function NavigationBar
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function NavigationBar(props) {
const { commentsCount, pathname } = props;
const [isOpen, setIsOpen] = useState(false);
File CommentForm.jsx
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable react/no-find-dom-node, react/no-string-refs */
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
Function commentsReducer
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function commentsReducer($$state = $$initialState, action = null) {
const { type, comment, comments, error, locale } = action;
switch (type) {
case actionTypes.FETCH_COMMENTS_SUCCESS: {
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let inputForm;
switch (this.state.formMode) {
case 0:
inputForm = this.formHorizontal();
Function formHorizontal
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formHorizontal() {
const { formatMessage } = this.props.intl;
return (
<div>
<hr />
Function formStacked
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formStacked() {
const { formatMessage } = this.props.intl;
return (
<div>
<hr />
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { actions, data, intl } = this.props;
const { formatMessage } = intl;
const cssTransitionGroupClassNames = {
enter: css.elementEnter,
Function formInline
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formInline() {
const { formatMessage } = this.props.intl;
return (
<div>
<hr />
Method create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
@comment = Comment.new(comment_params)
respond_to do |format|
if @comment.save
- 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 render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { handleSetLocale, locale, intl } = this.props;
const { formatMessage } = intl;
const cssTransitionGroupClassNames = {
enter: css.elementEnter,
Function errorWarning
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
errorWarning() {
const { error, cssTransitionGroupClassNames } = this.props;
// If there is no error, there is nothing to add to the DOM
if (!error.error) return null;
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { $$comments, cssTransitionGroupClassNames } = this.props;
const commentNodes = $$comments.map(($$comment, index) => {
const nodeRef = React.createRef(null);
return (
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (api) {
const defaultConfigFunc = require('shakapacker/package/babel/preset.js');
const resultConfig = defaultConfigFunc(api);
const isProductionEnv = api.env('production');
Function resetText
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
resetText() {
const inputAuthor = this.commentAuthorTarget;
const inputText = this.commentTextTarget;
const alertDiv = this.alertDivTarget;
const errorList = this.errorListTarget;
- 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
Avoid too many return
statements within this function. Open
Open
return $$state;
Avoid too many return
statements within this function. Open
Open
return $$state.merge({
isFetching: true,
});
Avoid too many return
statements within this function. Open
Open
return $$state.merge({
isSaving: true,
});
Avoid too many return
statements within this function. Open
Open
return $$state.merge({
locale,
});
Avoid too many return
statements within this function. Open
Open
return $$state.merge({
submitCommentError: error,
isSaving: false,
});