jfilter/frag-den-staat-app

View on GitHub

Showing 110 of 110 total issues

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

    Search: {
      screen: SearchNavigator,
      navigationOptions: {
        tabBarIcon: ({ tintColor }) => (
          <Icon size={24} color={tintColor} name="search" />
Severity: Major
Found in src/navigators/AppNavigator.js and 2 other locations - About 1 hr to fix
src/navigators/AppNavigator.js on lines 44..51
src/navigators/AppNavigator.js on lines 52..59

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

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

function foiRequestsFilterChange(filter) {
  return dispatch => {
    dispatch(foiRequestsFilterChangeAction(filter));
    // first delete old data
    dispatch(foiRequestsInvalidateDataAction());
Severity: Major
Found in src/actions/foiRequests.js and 1 other location - About 1 hr to fix
src/actions/foiRequests.js on lines 213..221

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

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

    Profile: {
      screen: ProfileNavigator,
      navigationOptions: {
        tabBarIcon: ({ tintColor }) => (
          <Icon size={24} color={tintColor} name="more-horiz" />
Severity: Major
Found in src/navigators/AppNavigator.js and 2 other locations - About 1 hr to fix
src/navigators/AppNavigator.js on lines 36..43
src/navigators/AppNavigator.js on lines 44..51

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

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 getFromCacheOrFetch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getFromCacheOrFetch(url, additionalHeaders = {}) {
  return new Promise((resolve, reject) => {
    cache
      .get(url)
      .then(value => {
Severity: Minor
Found in src/utils/networking.js - About 1 hr to fix

    Function mapDispatchToProps has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const mapDispatchToProps = dispatch => {
      return {
        navigateToAboutApp: () =>
          dispatch(NavigationActions.navigate({ routeName: 'ProfileAboutApp' })),
        navigateToIntroVideo: () =>
    Severity: Minor
    Found in src/containers/profile/ProfileStartScreen.js - About 1 hr to fix

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

        startExpanding() {
          Animated.timing(this.state.dropdownAnim, {
            toValue: 1,
            duration: DROPDOWN_ANIMATION_DURATION,
            easing: Easing.linear,
      Severity: Major
      Found in src/containers/foiRequests/FoiRequestsListHeader.js and 1 other location - About 1 hr to fix
      src/containers/foiRequests/FoiRequestsListHeader.js on lines 51..57

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

      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

        startCollapsing() {
          Animated.timing(this.state.dropdownAnim, {
            toValue: 0,
            duration: DROPDOWN_ANIMATION_DURATION,
            easing: Easing.linear,
      Severity: Major
      Found in src/containers/foiRequests/FoiRequestsListHeader.js and 1 other location - About 1 hr to fix
      src/containers/foiRequests/FoiRequestsListHeader.js on lines 43..49

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

      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 fetchInitialToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      const fetchInitialToken = url => {
        return new Promise(async (resolve, reject) => {
          const paramString = url.substr(OAUTH_REDIRECT_URI.length);
          const params = getParams(paramString);
      
      
      Severity: Minor
      Found in src/utils/oauth.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

      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

      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

          const {
            navigateToAboutApp,
            navigateToAboutFOIMaster,
            navigateToFAQ,
            navigateToContact,
      Severity: Minor
      Found in src/containers/profile/ProfileStartScreen.js and 1 other location - About 55 mins to fix
      src/components/screens/PublicBodyDetails/index.js on lines 31..42

      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

        const {
          name,
          url,
          classification,
          email,
      Severity: Minor
      Found in src/components/screens/PublicBodyDetails/index.js and 1 other location - About 55 mins to fix
      src/containers/profile/ProfileStartScreen.js on lines 25..36

      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

      FilterDropDownButton.propTypes = {
        filterFor: PropTypes.string.isRequired,
        selection: PropTypes.string.isRequired,
        onPress: PropTypes.func.isRequired,
      };
      Severity: Minor
      Found in src/components/library/FilterDropDownButton/index.js and 1 other location - About 50 mins to fix
      src/components/library/ListItemRadioButton/index.js on lines 26..30

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

      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

      ListItemRadioButton.propTypes = {
        title: PropTypes.string.isRequired,
        onSwitch: PropTypes.func.isRequired,
        switched: PropTypes.bool.isRequired,
      };
      Severity: Minor
      Found in src/components/library/ListItemRadioButton/index.js and 1 other location - About 50 mins to fix
      src/components/library/FilterDropDownButton/index.js on lines 59..63

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

      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 getCurrentAccessTokenOrRefresh has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const getCurrentAccessTokenOrRefresh = (dispatch, getState) => {
        return new Promise(async (resolve, reject) => {
          const {
            timeStamp,
            expiresIn,
      Severity: Minor
      Found in src/utils/oauth.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const { filterUser, currentUserId, filterFollower } = this.props;
          let secondIcon = null;
      
          if (filterUser != null) {
      Severity: Minor
      Found in src/containers/foiRequests/FoiRequestsMasterScreen.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 fetchAndDispatch has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        buildUrl,
        dispatch,
        beforeFetch,
        onSuccessFetch,
        onErrorFetch,
      Severity: Minor
      Found in src/utils/networking.js - About 45 mins to fix

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

              {
                title: 'Hey!',
                subtitle: 'Willkommen zu FragDenStaat.\n\n',
                backgroundColor: primaryColorDark,
                image: (
        Severity: Major
        Found in src/containers/foiRequests/FoiRequestsOnboardingScreen.js and 2 other locations - About 45 mins to fix
        src/containers/foiRequests/FoiRequestsOnboardingScreen.js on lines 66..72
        src/containers/foiRequests/FoiRequestsOnboardingScreen.js on lines 73..86

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

        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 search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function search(state = initialState, action) {
          switch (action.type) {
            case 'SEARCH_FOI_REQUESTS_ERROR':
              return {
                ...state,
        Severity: Minor
        Found in src/reducers/search.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

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

              {
                title: 'FragDenStaat?',
                subtitle:
                  'Jede Person hat das Recht auf staatliche Informationen. FragDenStaat hilft dir dein Recht wahrzunehmen.',
                backgroundColor: primaryColor,
        Severity: Major
        Found in src/containers/foiRequests/FoiRequestsOnboardingScreen.js and 2 other locations - About 45 mins to fix
        src/containers/foiRequests/FoiRequestsOnboardingScreen.js on lines 53..65
        src/containers/foiRequests/FoiRequestsOnboardingScreen.js on lines 73..86

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

        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