ali322/CNodeRN

View on GitHub

Showing 94 of 94 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      <Animated.View style={[styles.tabBarIcon, { opacity: inactiveOpacity }]}>
        {renderIcon({
          route,
          index,
          focused: false,
Severity: Major
Found in app/component/tabbar.js and 1 other location - About 1 hr to fix
app/component/tabbar.js on lines 73..80

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 69.

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

Further Reading

Function _renderButtons has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _renderButtons() {
    const { buttons } = this.state
    return (
      <View
        style={
Severity: Minor
Found in app/component/alert.js - About 1 hr to fix

    Function renderRow has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      renderRow(topic) {
        let avatarURL = topic.author.avatar_url
        if (/^\/\/.*/.test(avatarURL)) {
          avatarURL = 'http:' + avatarURL
        }
    Severity: Minor
    Found in app/module/topic/index.js - About 1 hr to fix

      Function messageReducer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function messageReducer(state = {}, action) {
        switch (action.type) {
          case constants.REQUEST_MESSAGES:
            return {
              ...state,
      Severity: Minor
      Found in app/module/message/reducer.js - About 1 hr to fix

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

            collect: {
                screen: Collect,
                navigationOptions: {
                    tabBarLabel: '收藏',
                    tabBarIcon: ({ focused, tintColor }) => <Icon size={20} color={tintColor} name="bookmark" />
        Severity: Major
        Found in app/navigator.js and 3 other locations - About 1 hr to fix
        app/module/mine/screen/index.js on lines 11..19
        app/module/topic/screen/index.js on lines 10..18
        app/navigator.js on lines 34..40

        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 67.

        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

        Further Reading

        Function renderForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderForm() {
            const { styles, styleConstants } = this.props
            const { topic } = this.state
            return (
              <View style={styles.publishForm}>
        Severity: Minor
        Found in app/module/topic/screen/publish.js - About 1 hr to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              topics: {
                screen: Topics,
                navigationOptions: {
                  tabBarLabel: '主题',
                  tabBarIcon: ({ focused, tintColor }) => (
          Severity: Major
          Found in app/module/topic/screen/index.js and 3 other locations - About 1 hr to fix
          app/module/mine/screen/index.js on lines 11..19
          app/navigator.js on lines 17..23
          app/navigator.js on lines 34..40

          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 67.

          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

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              message: {
                  screen: Message,
                  navigationOptions: {
                      tabBarLabel: '消息',
                      tabBarIcon: ({ focused, tintColor }) => <Icon size={20} color={tintColor} name="envelope" />
          Severity: Major
          Found in app/navigator.js and 3 other locations - About 1 hr to fix
          app/module/mine/screen/index.js on lines 11..19
          app/module/topic/screen/index.js on lines 10..18
          app/navigator.js on lines 17..23

          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 67.

          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

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              mine: {
                screen: Mine,
                navigationOptions: {
                  tabBarLabel: '我的',
                  tabBarIcon: ({ focused, tintColor }) => (
          Severity: Major
          Found in app/module/mine/screen/index.js and 3 other locations - About 1 hr to fix
          app/module/topic/screen/index.js on lines 10..18
          app/navigator.js on lines 17..23
          app/navigator.js on lines 34..40

          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 67.

          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

          Further Reading

          Function componentWillReceiveProps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            componentWillReceiveProps(nextProps, nextContext) {
              if (Platform.OS === 'ios') {
                if (
                  nextContext.userPrefs &&
                  !isEqual(nextContext.userPrefs, this.context.userPrefs)
          Severity: Minor
          Found in app/component/header.js - About 1 hr 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          const defaultStyles = StyleSheet.create({
            offlineWrapper: {
              flex: 1,
              justifyContent: 'center',
              alignItems: 'center',
          Severity: Major
          Found in app/module/common/screen/offline.js and 1 other location - About 1 hr to fix
          app/module/common/screen/badrequest.js on lines 6..19

          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 64.

          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

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          const defaultStyles = StyleSheet.create({
            offlineWrapper: {
              flex: 1,
              justifyContent: 'center',
              alignItems: 'center',
          Severity: Major
          Found in app/module/common/screen/badrequest.js and 1 other location - About 1 hr to fix
          app/module/common/screen/offline.js on lines 6..19

          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 64.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                if (
                  nextContext.userPrefs &&
                  !isEqual(nextContext.userPrefs, this.context.userPrefs)
                ) {
                  StatusBar.setBarStyle(
          Severity: Major
          Found in app/component/header.js and 1 other location - About 1 hr to fix
          app/component/header.js on lines 81..90

          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 63.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                if (
                  nextProps.userPrefs &&
                  !isEqual(nextProps.userPrefs, this.props.userPrefs)
                ) {
                  StatusBar.setBarStyle(
          Severity: Major
          Found in app/component/header.js and 1 other location - About 1 hr to fix
          app/component/header.js on lines 71..80

          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 63.

          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

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                    <View style={styles.topicTitle}>
                      <Text style={styles.topicTitleText} numberOfLines={2}>
                        {topic.title}
                      </Text>
                    </View>
          Severity: Major
          Found in app/module/collect/index.js and 1 other location - About 1 hr to fix
          app/module/mine/index.js on lines 107..111

          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 62.

          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

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                    <View style={styles.topicTitle}>
                      <Text style={styles.topicTitleText} numberOfLines={2}>
                        {topic.title}
                      </Text>
                    </View>
          Severity: Major
          Found in app/module/mine/index.js and 1 other location - About 1 hr to fix
          app/module/collect/index.js on lines 88..92

          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 62.

          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

          Further Reading

          Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              let {
                source,
                autoHeight,
                style,
          Severity: Minor
          Found in app/component/web-view.js - About 1 hr to fix

            Function renderContent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderContent() {
                const { styles, topic, htmlStyles } = this.props
                let avatarURL = topic.author.avatar_url
                if (/^\/\/.*/.test(avatarURL)) {
                  avatarURL = 'http:' + avatarURL
            Severity: Minor
            Found in app/module/topic/screen/topic.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  case constants.FINISH_SAVEREPLY:
                    return {
                      ...state,
                      replySaving: false,
                      replySaved: action.payload.success,
              Severity: Major
              Found in app/module/topic/reducer.js and 1 other location - About 1 hr to fix
              app/module/topic/reducer.js on lines 115..122

              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 59.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  case constants.FINISH_SAVETOPIC:
                    return {
                      ...state,
                      topicSaving: false,
                      topicSaved: action.payload.success,
              Severity: Major
              Found in app/module/topic/reducer.js and 1 other location - About 1 hr to fix
              app/module/topic/reducer.js on lines 177..184

              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 59.

              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

              Further Reading

              Severity
              Category
              Status
              Source
              Language