bufferapp/ui

View on GitHub

Showing 333 of 333 total issues

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

class Select extends UISelect {
  // @ts-expect-error TS(7006) FIXME: Parameter 'option' implicitly has an 'any' type.
  handleSelectOption = (option, event) => {
    // @ts-expect-error TS(2339) FIXME: Property 'props' does not exist on type 'Select'.
    this.props.onSelectClick(option, event)
src/documentation/examples/Button/Type/TypeSplitButtonWithCustomSelect.tsx on lines 7..17

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

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

export default function ExampleCrossSell() {
  const replyMock = {
    title: 'Provide amazing customer service on social media',
    subtitle:
      'Respond to social conversations, resolve customer support requests, and create an outstanding experience.',
Severity: Minor
Found in src/documentation/examples/CrossSell/CrossSell.tsx - About 1 hr to fix

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

      getTooltipPosition(triggerRect, tooltipRect, position, verticalAlign) {
        // @ts-expect-error TS(2339) FIXME: Property 'childWidth' does not exist on type 'Read... Remove this comment to see the full error message
        const { childWidth } = this.state
        const gap = 8
        const triggerCenter = triggerRect.left + childWidth / 2
    Severity: Minor
    Found in src/components/Tooltip/Tooltip.tsx - About 1 hr to fix

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

      function optimizeSvgs(icons) {
        // https://github.com/svg/svgo/blob/master/examples/test.js
        const svgo = new SVGO({
          // Remove fills so all shapes inherit the CSS color
          plugins: [{ removeAttrs: { attrs: '(stroke|fill)' } }],
      Severity: Minor
      Found in scripts/generateIconComponents.js - About 1 hr to fix

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

        export default function ExampleSelectWithCustomItem() {
          return (
            <Select
              // @ts-expect-error TS(7006) FIXME: Parameter 'selectedItem' implicitly has an 'any' t... Remove this comment to see the full error message
              onSelectClick={(selectedItem) => selectedItem.selectedItemClick()}
        Severity: Minor
        Found in src/documentation/examples/Select/SelectWithCustomItem.tsx - About 1 hr to fix

          Function renderContent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const renderContent = (channel) => {
            const content = {}
            switch (channel) {
              case 'instagram':
                // @ts-expect-error TS(2339) FIXME: Property 'Icon' does not exist on type '{}'.
          Severity: Minor
          Found in src/components/SocialButton/SocialButton.tsx - About 1 hr to fix

            Function ExampleSimpleModal has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function ExampleSimpleModal() {
              const [modalOpen, openModal] = useState(false)
            
              useEffect(() => {
                const selfDestroy = setTimeout(() => {

              Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (proxy, allowedHost) {
                return {
                  // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
                  // websites from potentially accessing local content through DNS rebinding:
                  // https://github.com/webpack/webpack-dev-server/issues/887
              Severity: Minor
              Found in scripts/config/webpackDevServer.config.js - About 1 hr to fix

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

                  render() {
                    const {
                      // @ts-expect-error TS(2339) FIXME: Property 'item' does not exist on type 'Readonly<{... Remove this comment to see the full error message
                      item: { type, title, onItemClick, icon, selected, disabled, colors, tag },
                      // @ts-expect-error TS(2339) FIXME: Property 'ariaHaspopup' does not exist on type 'Re... Remove this comment to see the full error message
                Severity: Minor
                Found in src/components/DropdownMenu/ButtonItem/ButtonItem.tsx - About 1 hr to fix

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

                  export default function ExampleButton() {
                    return (
                      <Button
                        type="secondary"
                        icon={<Folder />}
                  Severity: Major
                  Found in src/documentation/examples/Button/Type/TypeIcon.tsx and 1 other location - About 1 hr to fix
                  src/documentation/examples/Button/Type/TypeIconEnd.tsx on lines 8..18

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

                  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

                  export default function ExampleButton() {
                    return (
                      <Button
                        type="secondary"
                        icon={<Folder />}
                  Severity: Major
                  Found in src/documentation/examples/Button/Type/TypeIconEnd.tsx and 1 other location - About 1 hr to fix
                  src/documentation/examples/Button/Type/TypeIcon.tsx on lines 8..18

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

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

                  function getExampleData(examplesPath, componentName) {
                    // Get all the folders in src/docs/examples
                    const folders = getExampleFolders(examplesPath, componentName)
                    const fileExamples = getDocumentFiles(examplesPath, componentName)
                  
                  
                  Severity: Minor
                  Found in scripts/generateComponentData.js - About 1 hr to fix

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

                    const DescriptionWrapper = styled.div<{ size: string }>`
                      p {
                        margin-top: 0px;
                        margin-bottom: 16px;
                        max-width: ${(props): string =>
                    Severity: Major
                    Found in src/components/States/States.tsx and 1 other location - About 1 hr to fix
                    src/documentation/app/layout/content/components/ColorCopy.tsx on lines 28..34

                    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

                    const ColorName = styled.div<{ width?: string }>`
                      color: #ffffff;
                      font-size: 16px;
                      font-weight: 600;
                      padding: ${(props): string =>
                    src/components/States/States.tsx on lines 39..48

                    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

                    const SidebarListItem = ({
                      // @ts-expect-error TS(7031) FIXME: Binding element 'title' implicitly has an 'any' ty... Remove this comment to see the full error message
                      title,
                      // @ts-expect-error TS(7031) FIXME: Binding element 'icon' implicitly has an 'any' typ... Remove this comment to see the full error message
                      icon,
                    Severity: Major
                    Found in src/components/SidebarListItem/SidebarListItem.tsx and 1 other location - About 1 hr to fix
                    src/components/NavBar/NavBar.tsx on lines 236..253

                    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

                        const {
                          // @ts-expect-error TS(2339) FIXME: Property 'products' does not exist on type 'Readon... Remove this comment to see the full error message
                          products,
                          // @ts-expect-error TS(2339) FIXME: Property 'activeProduct' does not exist on type 'R... Remove this comment to see the full error message
                          activeProduct,
                    Severity: Major
                    Found in src/components/NavBar/NavBar.tsx and 1 other location - About 1 hr to fix
                    src/components/SidebarListItem/SidebarListItem.tsx on lines 16..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 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

                            {
                              id: '2',
                              title: 'Green',
                              color: 'green',
                              // @ts-expect-error TS(7006) FIXME: Parameter 'item' implicitly has an 'any' type.
                    Severity: Major
                    Found in src/documentation/examples/Select/SelectWithCustomItem.tsx and 2 other locations - About 1 hr to fix
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 13..21
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 31..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 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

                            {
                              id: '1',
                              title: 'Red',
                              color: 'red',
                              // @ts-expect-error TS(7006) FIXME: Parameter 'item' implicitly has an 'any' type.
                    Severity: Major
                    Found in src/documentation/examples/Select/SelectWithCustomItem.tsx and 2 other locations - About 1 hr to fix
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 22..30
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 31..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 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

                            {
                              id: '3',
                              title: 'Blue',
                              color: 'blue',
                              // @ts-expect-error TS(7006) FIXME: Parameter 'item' implicitly has an 'any' type.
                    Severity: Major
                    Found in src/documentation/examples/Select/SelectWithCustomItem.tsx and 2 other locations - About 1 hr to fix
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 13..21
                    src/documentation/examples/Select/SelectWithCustomItem.tsx on lines 22..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 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 Option has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const Option = (props) => {
                      const {
                        selected,
                        disabled,
                        icon,
                    Severity: Minor
                    Found in src/components/SegmentedControl/Option/Option.tsx - About 1 hr 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

                    Severity
                    Category
                    Status
                    Source
                    Language