hellowin/kanca

View on GitHub

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;

Severity: Minor
Found in src/app/Welcome.js - About 1 hr to fix

    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'),
    Severity: Minor
    Found in src/infra/repo/group.js - About 1 hr to fix

      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">
      Severity: Minor
      Found in src/domain/group/container/Selection.js - About 55 mins to fix

      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);
        
      Severity: Minor
      Found in src/domain/metric/service/timeRangeMetric.js - About 45 mins to fix

      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;
      
      
      Severity: Minor
      Found in src/infra/service/util.js - About 35 mins to fix

      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;
      Severity: Minor
      Found in src/infra/service/graph.js - About 35 mins to fix

      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)));
      Severity: Minor
      Found in src/infra/service/util.js - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language