chaskiq/chaskiq

View on GitHub

Showing 1,174 of 1,174 total issues

Function QuickRepliesPanel has 213 lines of code (exceeds 50 allowed). Consider refactoring.
Open

function QuickRepliesPanel(props) {
  const [open, setOpen] = React.useState(props.open);
  const [quickReply, setQuickReply] = React.useState(null);
  const [quickReplies, setQuickReplies] = React.useState([]);
  //const [values, setValues] = React.useState({})
Severity: Major
Found in app/javascript/src/pages/conversations/quickRepliesPanel.tsx - About 7 hrs to fix

    Function Conversation has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    function Conversation({
      dispatch,
      conversation,
      match,
      app,
    Severity: Minor
    Found in app/javascript/src/pages/conversations/Conversation.tsx - About 7 hrs 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 OauthApp has 205 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    function OauthApp(props) {
      const params = useParams();
      const formRef = React.useRef(null);
      const history = useHistory();
    
    
    Severity: Major
    Found in app/javascript/src/pages/Api.tsx - About 7 hrs to fix

      Function render has 202 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

        render() {
          const { isOpen, editCollection, itemToDelete } = this.state;
          const { app } = this.props;
          return (
            <React.Fragment>
      Severity: Major
      Found in app/javascript/src/pages/articles/collections/index.tsx - About 7 hrs to fix

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

          uploadHandler = (file, kind) => {
            getFileMetadata(file).then((input) => {
              graphql(CREATE_DIRECT_UPLOAD, input, {
                success: (data) => {
                  const {
        Severity: Major
        Found in app/javascript/src/pages/AppSettings.tsx and 1 other location - About 7 hrs to fix
        app/javascript/src/pages/MessengerSettings.tsx on lines 92..115

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

        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

          uploadHandler = (file, kind) => {
            getFileMetadata(file).then((input) => {
              graphql(CREATE_DIRECT_UPLOAD, input, {
                success: (data) => {
                  const {
        Severity: Major
        Found in app/javascript/src/pages/MessengerSettings.tsx and 1 other location - About 7 hrs to fix
        app/javascript/src/pages/AppSettings.tsx on lines 93..116

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

        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

        Method content_hook has 201 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

            def self.content_hook(kind:, ctx:)
              conversation = Conversation.find_by(key: ctx[:conversation_key])
              user = conversation.main_participant
        
              if ctx.dig(:values, :block_type) == "user-blocks"
        Severity: Major
        Found in app/services/message_apis/inbox_sections/presenter.rb - About 7 hrs to fix

          Function render has 198 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

            render() {
              return (
                <div className="m-4">
                  <Switch>
                    <Route
          Severity: Major
          Found in app/javascript/src/pages/Campaigns.tsx - About 6 hrs to fix

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

                                    <Draggable
                                      key={`path-list-2-${o.id}-${i}`}
                                      draggableId={o.id}
                                      index={i}
                                      isDragDisabled={sortDisabled}
            Severity: Major
            Found in app/javascript/src/pages/conversations/SidebarAgents.tsx and 1 other location - About 6 hrs to fix
            app/javascript/src/pages/conversations/SidebarAgents.tsx on lines 290..320

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

            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

                                  <Draggable
                                    key={`path-list-${o.id}-${i}`}
                                    draggableId={`list-1-${o.id}`}
                                    index={i}
                                    isDragDisabled={sortDisabled}
            Severity: Major
            Found in app/javascript/src/pages/conversations/SidebarAgents.tsx and 1 other location - About 6 hrs to fix
            app/javascript/src/pages/conversations/SidebarAgents.tsx on lines 348..378

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

            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 TeamAgentEdit has 195 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            function TeamAgentEdit(props) {
              const [searchTerm, setSearchTerm] = React.useState('');
              const [elements, setElements] = React.useState([]);
              const [isLoading, setLoading] = React.useState(false);
              const [searchValue, setSearchValue] = React.useState(null);
            Severity: Major
            Found in app/javascript/src/pages/Team.tsx - About 6 hrs to fix

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

              const convertCase = (oldObject, converterFunction) => {
                let newObject;
              
                if (
                  !oldObject ||
              app/javascript/packages/messenger/src/client_messenger/shared/caseConverter.ts on lines 15..39

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

              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 convertCase = (oldObject, converterFunction) => {
                let newObject;
              
                if (
                  !oldObject ||
              app/javascript/packages/components/src/utils/caseConverter.ts on lines 9..33

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

              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 renderers has 189 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              function renderers(props) {
                return {
                  /**
                   * Those callbacks will be called recursively to render a nested structure
                   */

                Function blockToHTML has 188 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                      blockToHTML: (block, _oo) => {
                        if (block.type === 'unstyled') {
                          return <p className="graf graf--p" />;
                        }
                        if (block.type === 'header-one') {

                  Function blockToHTML has 186 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                        blockToHTML: (block, _oo) => {
                          if (block.type === 'unstyled') {
                            return <p className="graf graf--p" />;
                          }
                          if (block.type === 'header-one') {

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

                            if (block.type === 'recorded-video') {
                              return (
                                <figure className="graf--figure graf--iframe graf--first">
                                  <div className="iframeContainer">
                                    <video
                    app/javascript/packages/components/src/components/textEditor/index.tsx on lines 713..731

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

                    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 (block.type === 'recorded-video') {
                              return (
                                <figure className="graf--figure graf--iframe graf--first">
                                  <div className="iframeContainer">
                                    <video
                    app/javascript/packages/messenger/src/client_messenger/textEditor/index.tsx on lines 480..498

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

                    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 AudioRecorderBlock has 174 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    const AudioRecorderBlock = (props) => {
                      const { blockProps, block } = props;
                    
                      const [stored, setStored] = useState(block.data.get('stored'));
                      const [recording, setRecording] = useState(false);

                      Function render has 172 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                        render() {
                          return (
                            <div className="overflow-y-auto">
                              <main className="flex-1 relative z-0 overflow-y-auto focus:outline-none xl:order-last">
                                <nav
                      Severity: Major
                      Found in app/javascript/src/pages/AgentProfile.tsx - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language