Showing 90 of 251 total issues

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

  render() {
    const { edit, isCreateNew } = this.props;

    return (
      <HeaderWrapper>
Severity: Minor
Found in src/components/layout/headers/MainHeader.js - About 1 hr to fix

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

      render() {
        const { snippet, theme } = this.props;
    
        return (
          <Router>
    Severity: Minor
    Found in src/components/layout/sidebar/Snippet.js - About 1 hr to fix

      Function responseHandler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export const responseHandler = (error, result, dispatch, action) => {
        if (error) {
          if (error.response && error.response.headers['x-github-otp']) {
            setNotification({
              title: 'Two factor authentication',
      Severity: Minor
      Found in src/middlewares/responseHandler.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 7 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          if (isElectron) {
            const { ipcRenderer } = require('electron');
      
            ipcRenderer.on('token', (event, token) => {
      Severity: Minor
      Found in src/components/LogIn.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 BaseSettings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export const BaseSettings = ({ changeSettings }) => {
        const updateSettings = (key, value, isTheme, isBoolean = false) => {
          changeSettings(key, value, isTheme, isBoolean);
          if (isBoolean) {
            setBooleanSetting(key);
      Severity: Minor
      Found in src/components/layout/content/settings/Base.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 SnippetsSettings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export const SnippetsSettings = ({ changeSettings }) => {
        const updateSettings = (key, value, isBoolean = false) => {
          changeSettings(key, value, false, isBoolean);
          if (isBoolean) {
            setBooleanSetting(key);
      Severity: Minor
      Found in src/components/layout/content/settings/Snippets.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const { file, username, snippetId, edit, toggleCollapse, theme } = this.props;
          const openOnWebUrl = `${getSnippetUrl('/gist')}/${username}/${snippetId}#file-${file.filename}`;
      
          return (
      Severity: Minor
      Found in src/components/layout/content/snippet/SnippetHeader.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 'untagged';
      Severity: Major
      Found in src/components/layout/sidebar/Sidebar.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return flow([
                set(['filter', 'text'], ''),
                set(['filter', 'tags'], tag),
                set(['filter', 'language'], ''),
                set(['filter', 'status'], ''),
        Severity: Major
        Found in src/reducers/snippets.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return flow([
                  set('edit', {}),
                  set(['snippets', action.payload.id], snippetStructure(action.payload, state.starred))
                ])(state);
          Severity: Major
          Found in src/reducers/snippets.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return state;
            Severity: Major
            Found in src/reducers/ui.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return filter({ truncated: true }, sortedSnippets);
              Severity: Major
              Found in src/utils/snippets.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return flow([
                        set(['edit', 'description'], description),
                        set(['edit', 'files'], keyBy('uuid', preparedFiles))
                      ])(state);
                Severity: Major
                Found in src/reducers/snippets.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return set(['edit', 'files', action.payload.uuid, 'delete'], true, state);
                  Severity: Major
                  Found in src/reducers/snippets.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return snippets;
                    Severity: Major
                    Found in src/utils/snippets.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return set(['filter', 'tags'], without([action.payload.tag], state.filter.tags), state);
                      Severity: Major
                      Found in src/reducers/snippets.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return set(
                                ['snippets', action.payload.id],
                                snippetStructure(action.payload, state.starred),
                                state
                              );
                        Severity: Major
                        Found in src/reducers/snippets.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return flow([
                                  set(['filter', 'text'], ''),
                                  set(['filter', 'tags'], []),
                                  set(['filter', 'language'], ''),
                                  set(['filter', 'status'], action.payload.status),
                          Severity: Major
                          Found in src/reducers/snippets.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return flow([
                                    set(['starred'], concat([action.meta.id], state.starred)),
                                    set(['snippets', action.meta.id, 'star'], true)
                                  ])(state);
                            Severity: Major
                            Found in src/reducers/snippets.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return set('snippets.edit', false, state);
                              Severity: Major
                              Found in src/reducers/ui.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language