Showing 32 of 32 total issues
Function handleFormat
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
handleFormat() {
const input = this.state.inputResult;
const lines = input.split('\n');
const teams = [];
let formatted = '| 主队 | 比分 | 客队 |\n|----|----|----|\n';
- 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 contentWithColumns
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const contentWithColumns = columnArray.map((index) => {
const columns = [index * 2, (index * 2) + 1].map((contentIndex) => {
const section = this.contentList[contentIndex];
if (section !== undefined) {
const sectionHeading = {
Function handleFormat
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleFormat() {
const input = this.state.inputResult;
const lines = input.split('\n');
const teams = [];
let formatted = '| 主队 | 比分 | 客队 |\n|----|----|----|\n';
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let link = this.props.data.more_text;
if (this.props.data.more_text && this.props.data.more_link) {
if (this.props.data.use_router === 0) {
link = (
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="news">
<div className="news-wrap" id="rugby-championship">
<div className="news-item">
Function columns
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const columns = [index * 2, (index * 2) + 1].map((contentIndex) => {
const section = this.contentList[contentIndex];
if (section !== undefined) {
const sectionHeading = {
id: section.id,
Function handleSubmit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleSubmit() {
const newsForm = {
title: this.state.news.title,
content: this.state.news.content,
channel: this.state.news.channel,
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
const newsHeading = {
id: 'latest-news',
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="news" id="format-result">
<div className="news-wrap">
<div className="news-item">
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
const searchHeading = {
id: 'news',
Function searchNews
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function searchNews(title, content, channel, event, page, callback, timeout) {
Function render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
let link = this.props.data.more_text;
if (this.props.data.more_text && this.props.data.more_link) {
if (this.props.data.use_router === 0) {
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"