Showing 47 of 264 total issues
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { posts } = this.props;
const exist = posts.length > 0;
Function restoreGroup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
restoreGroup() {
store.dispatch(action.groupSet({ loading: true }));
Promise
.all([
st.get('group.inputs'),
Function render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { loading, inputs, manages, features } = this.props;
return !loading? (
<div className="row">
- 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 timeRangeMetric
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const timeRangeMetric = (dateStart: Date, dateEnd: Date, posts: Post[], members: Member[], comments: Comment[]): TimeRangeMetric => {
// pick date
const filteredPosts = posts.filter(post => moment(post.created_time) >= dateStart && moment(post.created_time) < dateEnd);
const filteredComments = comments.filter(comm => moment(comm.created_time) >= dateStart && moment(comm.created_time) < dateEnd);
- 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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const get = (url: string): Promise<any> => new Promise((resolve, reject) => {
window.FB.api(url, fbRes => {
if (fbRes.error) {
const code = fbRes.error.code;
const type = fbRes.error.type;
- 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 timeRangeToString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const timeRangeToString = (dateStart: Date, dateEnd: Date): string => {
const end = moment(dateEnd);
const start = moment(dateStart);
let fixDateStart;
- 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 cancelablePromise
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const cancelablePromise = <T>(promise: Promise<T>): { promise: Promise<T>, cancel: Function } => {
let hasCanceled = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then((val) => (hasCanceled ? reject(new Error('cancelled')) : resolve(val)));
- 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"