jfilter/frag-den-staat-app

View on GitHub

Showing 41 of 110 total issues

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

function fetchRequests(beforeFetchDispatchedAction, onSuccessFetch) {
  return async (dispatch, getState) => {
    const {
      foiRequests: { filter },
      authentication: { userId },
Severity: Minor
Found in src/actions/foiRequests.js - About 1 hr to fix

    Function _onPress has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _onPress(x) {
        if (this.state.collapsed === x) {
          this.setState(
            {
              prevCollapsed: x,
    Severity: Minor
    Found in src/containers/foiRequests/FoiRequestsListHeader.js - About 1 hr to fix

      Function navigationOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      FoiRequestsWebView.navigationOptions = props => {
        const url = props.navigation.state.params.uri;
      
        function share() {
          Share.share(
      Severity: Minor
      Found in src/components/foiRequests/WebView/index.js - About 1 hr to fix

        Function navigationOptions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        PdfViewer.navigationOptions = props => {
          const { url } = props.navigation.state.params;
        
          function share() {
            Share.share(
        Severity: Minor
        Found in src/components/screens/PdfViewer/index.js - About 1 hr to fix

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

            render() {
              const size = Platform.OS === 'ios' ? 35 : 26; // for icon
              const { search } = this.state;
              return (
                <View style={styles.background} keyboardShouldPersistTaps="handled">
          Severity: Minor
          Found in src/containers/search/SearchStartScreen.js - About 1 hr to fix

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

              render() {
                const {
                  isPending,
                  error,
                  publicBody,
            Severity: Minor
            Found in src/containers/foiRequests/FoiRequestsPublicBodyScreen.js - About 1 hr to fix

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

                render() {
                  const {
                    navigateToPdfViewer,
                    navigateToPublicBody,
                    isPending,
              Severity: Minor
              Found in src/containers/foiRequests/FoiRequestsSingleScreen.js - About 1 hr to fix

                Function getCurrentAccessTokenOrRefresh has 31 lines of code (exceeds 25 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 1 hr to fix

                  Function render has 30 lines of code (exceeds 25 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 1 hr to fix

                    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

                        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

                        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

                          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

                          Function fetchMultipleAndDispatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

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

                            Function toggleFollow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async toggleFollow() {
                                try {
                                  const {
                                    id,
                                    getAccessToken,
                            Severity: Minor
                            Found in src/containers/foiRequests/FollowingIcon.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

                            Avoid too many return statements within this function.
                            Open

                                  return { ...state, alerts };
                            Severity: Major
                            Found in src/reducers/search.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return { ...state, pastAlertMatches };
                              Severity: Major
                              Found in src/reducers/search.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language