radar/twist-v2

View on GitHub

Showing 143 of 143 total issues

File types.ts has 1101 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
export type Maybe<T> = T | null;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
Severity: Major
Found in frontend/src/graphql/types.ts - About 2 days to fix

    File tailwind.js has 692 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module.exports = {
      prefix: '',
      important: false,
      separator: ':',
      theme: {
    Severity: Major
    Found in frontend/tailwind.js - About 1 day to fix

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

        return (
          <div>
            <form onSubmit={submit}>
              <p>
                <label
      Severity: Major
      Found in frontend/src/Book/Note/Comments/EditForm.tsx and 1 other location - About 6 hrs to fix
      frontend/src/Book/Note/EditForm.tsx on lines 31..56

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

      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

        return (
          <div>
            <form onSubmit={submit}>
              <p>
                <label
      Severity: Major
      Found in frontend/src/Book/Note/EditForm.tsx and 1 other location - About 6 hrs to fix
      frontend/src/Book/Note/Comments/EditForm.tsx on lines 33..58

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

      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 CloseButton: FunctionComponent<ButtonProps> = (props) => {
        const [closeNote] = useMutation(closeNoteMutation);
        const close = () => {
          closeNote({ variables: { id: props.id } }).then((result) => {
            if (result) {
      Severity: Major
      Found in frontend/src/Book/Note/CloseButton.tsx and 1 other location - About 6 hrs to fix
      frontend/src/Book/Note/OpenButton.tsx on lines 6..26

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

      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 CloseButton: FunctionComponent<ButtonProps> = (props) => {
        const [openNote] = useMutation(openNoteMutation);
        const open = () => {
          openNote({ variables: { id: props.id } }).then((result) => {
            if (result) {
      Severity: Major
      Found in frontend/src/Book/Note/OpenButton.tsx and 1 other location - About 6 hrs to fix
      frontend/src/Book/Note/CloseButton.tsx on lines 6..26

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

      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

          {
            id: "1",
            content: "This is some content that has a note attached to it.",
            tag: "p",
            bookPermalink: "markdown-book-test",
      Severity: Major
      Found in frontend/src/stories/index.js and 1 other location - About 3 hrs to fix
      frontend/src/stories/index.js on lines 43..70

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

      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

          {
            id: "2",
            content: "This is a second element which also has content",
            tag: "p",
            bookPermalink: "markdown-book-test",
      Severity: Major
      Found in frontend/src/stories/index.js and 1 other location - About 3 hrs to fix
      frontend/src/stories/index.js on lines 15..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 104.

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

      export const ChapterShow = () => {
        const commit: ChapterAtCommitProps = {
          __typename: "Commit",
          bookPermalink: "markdown-book-test",
          bookTitle: "Markdown Book Test",
      Severity: Major
      Found in frontend/src/stories/Chapters/show.stories.tsx - About 3 hrs to fix

        Class ElementProcessor has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class ElementProcessor
                def initialize(chapter, book_path)
                  @chapter = chapter
                  @book_path = book_path
                end
        Severity: Minor
        Found in backend/lib/twist/processors/markdown/element_processor.rb - About 3 hrs to fix

          Function ElementNote has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const ElementNote: FunctionComponent<ElementNoteProps> = (props) => {
            const { user, createdAt, bookPermalink, number, id, text, comments } = props;
            const [state, setState] = useState<string>(props.state);
            const [showForm, setShowForm] = useState<boolean>(false);
          
          
          Severity: Major
          Found in frontend/src/Book/Note/Note.tsx - About 2 hrs to fix

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

            export type RemovePayload = {
              readonly __typename: 'RemovePayload';
              readonly bookId?: Maybe<Scalars['ID']>;
              readonly error?: Maybe<Scalars['String']>;
              readonly userId?: Maybe<Scalars['ID']>;
            Severity: Major
            Found in frontend/src/graphql/types.ts and 1 other location - About 2 hrs to fix
            frontend/src/graphql/types.ts on lines 202..207

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

            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 type InvitePayload = {
              readonly __typename: 'InvitePayload';
              readonly bookId?: Maybe<Scalars['ID']>;
              readonly error?: Maybe<Scalars['String']>;
              readonly userId?: Maybe<Scalars['ID']>;
            Severity: Major
            Found in frontend/src/graphql/types.ts and 1 other location - About 2 hrs to fix
            frontend/src/graphql/types.ts on lines 372..377

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

            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

            Class ChapterProcessor has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

                  class ChapterProcessor
                    include Sidekiq::Worker
            
                    sidekiq_options retry: 0
            
            
            Severity: Minor
            Found in backend/lib/twist/processors/asciidoc/chapter_processor.rb - About 2 hrs to fix

              Function Root has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Root: React.FC = () => {
                const renderUserInfo = () => {
                  return (
                    <CurrentUserContext.Consumer>
                      {(user: CurrentUserType) =>
              Severity: Major
              Found in frontend/src/App.tsx - About 2 hrs to fix

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

                    return (
                      <CurrentUserContext.Consumer>
                        {(currentUser) => {
                          if (user.id !== currentUser!.id) {
                            return;
                Severity: Major
                Found in frontend/src/Book/Note/Note.tsx and 1 other location - About 2 hrs to fix
                frontend/src/Book/Note/Comments/EditButton.tsx on lines 21..35

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

                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

                  return (
                    <CurrentUserContext.Consumer>
                      {(currentUser) => {
                        if (user.id !== currentUser!.id) {
                          return;
                Severity: Major
                Found in frontend/src/Book/Note/Comments/EditButton.tsx and 1 other location - About 2 hrs to fix
                frontend/src/Book/Note/Note.tsx on lines 33..47

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

                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

                    gridColumnEnd: {
                      auto: 'auto',
                      '1': '1',
                      '2': '2',
                      '3': '3',
                Severity: Major
                Found in frontend/tailwind.js and 1 other location - About 2 hrs to fix
                frontend/tailwind.js on lines 457..472

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

                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

                    gridColumnStart: {
                      auto: 'auto',
                      '1': '1',
                      '2': '2',
                      '3': '3',
                Severity: Major
                Found in frontend/tailwind.js and 1 other location - About 2 hrs to fix
                frontend/tailwind.js on lines 473..488

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

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

                const Comment: FunctionComponent<CommentType> = (props) => {
                  const { id, user, createdAt } = props;
                  const [text, setText] = useState<string>(props.text);
                  const [showForm, setShowForm] = useState<boolean>(false);
                  const [hidden, setHidden] = useState<boolean>(false);
                Severity: Minor
                Found in frontend/src/Book/Note/Comments/Comment.tsx - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language