jfilter/frag-den-staat-app

View on GitHub
src/components/screens/FoiRequestDetails/index.js

Summary

Maintainability
F
3 days
Test Coverage

File index.js has 563 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  ActivityIndicator,
  Linking,
  Platform,
  Share,
Severity: Major
Found in src/components/screens/FoiRequestDetails/index.js - About 1 day to fix

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

      render() {
        const { title, public_body: publicBody, description } = this.props.request;
        let subheading = (
          <SubHeading style={styles.subheading}>
            {I18n.t('foiRequestDetails.notYetSpecified')}
    Severity: Major
    Found in src/components/screens/FoiRequestDetails/index.js - About 2 hrs to fix

      Function navigationOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      FoiRequestDetails.navigationOptions = ({ navigation }) => {
        const { params, routeName } = navigation.state;
        let requestId = null;
      
        // sometimes we get the request via the nav prop and sometimes only the id
      Severity: Minor
      Found in src/components/screens/FoiRequestDetails/index.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

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

        function share() {
          Share.share(
            {
              ...Platform.select({
                ios: {
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 2 other locations - About 3 hrs to fix
      src/components/foiRequests/WebView/index.js on lines 14..36
      src/components/screens/PdfViewer/index.js on lines 58..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 95.

      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

              <View style={tableStyles.row}>
                <Text style={tableStyles.item1}>
                  {I18n.t('foiRequestDetails.subject')}
                </Text>
                <Text selectable style={tableStyles.item2}>
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 1 other location - About 2 hrs to fix
      src/components/screens/FoiRequestDetails/index.js on lines 185..192

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

      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

              <View style={tableStyles.row}>
                <Text style={tableStyles.item1}>
                  {I18n.t('foiRequestDetails.from')}
                </Text>
                <Text selectable style={tableStyles.item2}>
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 1 other location - About 2 hrs to fix
      src/components/screens/FoiRequestDetails/index.js on lines 202..209

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

      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 3 locations. Consider refactoring.
      Open

          tableData.push({
            label: I18n.t('foiRequestDetails.startedOn'),
            value: <Text selectable>{moment(firstMessage).format('LLL')}</Text>,
          });
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 2 other locations - About 1 hr to fix
      src/components/screens/FoiRequestDetails/index.js on lines 259..262
      src/components/screens/FoiRequestDetails/index.js on lines 265..268

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

      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 3 locations. Consider refactoring.
      Open

          tableData.push({
            label: I18n.t('foiRequestDetails.lastMessage'),
            value: <Text selectable>{moment(lastMessage).format('LLL')}</Text>,
          });
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 2 other locations - About 1 hr to fix
      src/components/screens/FoiRequestDetails/index.js on lines 254..257
      src/components/screens/FoiRequestDetails/index.js on lines 265..268

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

      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 3 locations. Consider refactoring.
      Open

            tableData.push({
              label: I18n.t('foiRequestDetails.dueDate'),
              value: <Text selectable>{moment(dueDate).format('LL')}</Text>,
            });
      Severity: Major
      Found in src/components/screens/FoiRequestDetails/index.js and 2 other locations - About 1 hr to fix
      src/components/screens/FoiRequestDetails/index.js on lines 254..257
      src/components/screens/FoiRequestDetails/index.js on lines 259..262

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

      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 (refusalReason) {
            tableData.push({
              label: I18n.t('foiRequestDetails.refusalReason'),
              value: <Text selectable>{refusalReason}</Text>,
            });
      Severity: Minor
      Found in src/components/screens/FoiRequestDetails/index.js and 1 other location - About 55 mins to fix
      src/components/screens/FoiRequestDetails/index.js on lines 279..284

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

      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

            } else if (lawName) {
              tableData.push({
                label: I18n.t('foiRequestDetails.law'),
                value: <Text selectable>{lawName}</Text>,
              });
      Severity: Minor
      Found in src/components/screens/FoiRequestDetails/index.js and 1 other location - About 55 mins to fix
      src/components/screens/FoiRequestDetails/index.js on lines 240..245

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

      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

      There are no issues that match your filters.

      Category
      Status