radar/twist-v2

View on GitHub

Showing 143 of 143 total issues

Function Element has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Element: React.FC<ElementProps> = (props) => {
  const { noteCount: initialNoteCount, id, bookPermalink } = props;
  const [noteCount, setNoteCount] = useState<number>(initialNoteCount);
  const [showNotes, setShowNotes] = useState<boolean>(false);

Severity: Minor
Found in frontend/src/Book/Chapter/Element.tsx - About 1 hr to fix

    Function Form has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Form: FunctionComponent<FormProps> = (props) => {
      const { elementId, bookPermalink, noteSubmitted } = props;
      const [text, setText] = useState<string>("");
      const [submitNote] = useMutation(submitNoteMutation);
      const submit = (e: React.FormEvent<HTMLFormElement>) => {
    Severity: Minor
    Found in frontend/src/Book/Chapter/Notes/Form.tsx - About 1 hr to fix

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

          gridTemplateColumns: {
            none: 'none',
            '1': 'repeat(1, minmax(0, 1fr))',
            '2': 'repeat(2, minmax(0, 1fr))',
            '3': 'repeat(3, minmax(0, 1fr))',
      Severity: Major
      Found in frontend/tailwind.js and 1 other location - About 1 hr to fix
      frontend/tailwind.js on lines 442..456

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

      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

          gridColumn: {
            auto: 'auto',
            'span-1': 'span 1 / span 1',
            'span-2': 'span 2 / span 2',
            'span-3': 'span 3 / span 3',
      Severity: Major
      Found in frontend/tailwind.js and 1 other location - About 1 hr to fix
      frontend/tailwind.js on lines 427..441

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

      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

      export type NoteFragment = { readonly __typename: 'Note', readonly id: string, readonly number: number, readonly text: string, readonly createdAt: string, readonly state: string, readonly user: { readonly __typename: 'User', readonly id: string, readonly email: string, readonly name: string }, readonly comments: ReadonlyArray<{ readonly __typename: 'Comment', readonly id: string, readonly text: string, readonly createdAt: string, readonly user: { readonly __typename: 'User', readonly id: string, readonly email: string, readonly name: string } }> };
      Severity: Major
      Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
      frontend/src/graphql/types.ts on lines 555..555

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

      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

        module Web
          module GraphQL
            module Mutations
              module Invitations
                class Invite < BaseMutation
      backend/lib/twist/web/graphql/mutations/readers/remove.rb on lines 2..29

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

      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

        module Web
          module GraphQL
            module Mutations
              module Readers
                class Remove < BaseMutation
      Severity: Major
      Found in backend/lib/twist/web/graphql/mutations/readers/remove.rb and 1 other location - About 1 hr to fix
      backend/lib/twist/web/graphql/mutations/invitations/invite.rb on lines 2..27

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

      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

      export type CommentFragmentFragment = { readonly __typename: 'Comment', readonly id: string, readonly text: string, readonly createdAt: string, readonly user: { readonly __typename: 'User', readonly id: string, readonly email: string, readonly name: string } };
      Severity: Major
      Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
      frontend/src/graphql/types.ts on lines 620..620

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

      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 CurrentUserQuery = { readonly __typename: 'Query', readonly currentUser?: Maybe<{ readonly __typename: 'User', readonly id: string, readonly githubLogin?: Maybe<string>, readonly email: string }> };
      Severity: Major
      Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
      frontend/src/graphql/types.ts on lines 505..505

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

      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

            <ul className="list-disc list-inside">
              {authors.map((reader, index) => (
                <ReaderItem
                  {...reader}
                  key={reader.id}
      Severity: Major
      Found in frontend/src/Book/Invitations/Readers.tsx and 1 other location - About 1 hr to fix
      frontend/src/Book/Invitations/Readers.tsx on lines 79..88

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

      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

            <ul className="list-disc list-inside">
              {filteredReaders.map((reader, index) => (
                <ReaderItem
                  {...reader}
                  key={reader.id}
      Severity: Major
      Found in frontend/src/Book/Invitations/Readers.tsx and 1 other location - About 1 hr to fix
      frontend/src/Book/Invitations/Readers.tsx on lines 66..75

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

      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 UsersQuery = { readonly __typename: 'Query', readonly users: ReadonlyArray<{ readonly __typename: 'User', readonly id: string, readonly githubLogin?: Maybe<string>, readonly name: string }> };
      Severity: Major
      Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
      frontend/src/graphql/types.ts on lines 644..644

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

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

      const EditForm: FunctionComponent<EditFormProps> = (props) => {
        const { id, originalText, toggleForm } = props;
        const [text, setText] = useState<string>(props.originalText);
        const [updateComment] = useMutation(updateCommentMutation);
      
      
      Severity: Minor
      Found in frontend/src/Book/Note/Comments/EditForm.tsx - About 1 hr to fix

        Function EditForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const EditForm: FunctionComponent<EditFormProps> = (props) => {
          const { noteId, originalText, toggleForm } = props;
          const [text, setText] = useState<string>(props.originalText);
          const [updateNote] = useMutation(updateNoteMutation);
        
        
        Severity: Minor
        Found in frontend/src/Book/Note/EditForm.tsx - About 1 hr to fix

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

          const Branch: FunctionComponent<BranchProps> = (props) => {
            const [updateBranch] = useUpdateBranchMutation({ errorPolicy: "all" });
            const { bookPermalink, bookTitle, name, commits } = props;
          
            const [message, setMessage] = useState<string>("");
          Severity: Minor
          Found in frontend/src/Book/Branches/Branch.tsx - About 1 hr to fix

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

            export const BooksShow = () => {
              const commit: Commit = {
                __typename: "Commit",
                sha: "abc123",
                createdAt: "2020-04-15 10:10:10",
            Severity: Minor
            Found in frontend/src/stories/Books/show.stories.tsx - About 1 hr to fix

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

                module Web
                  module GraphQL
                    module Mutations
                      module Notes
                        class Update < BaseMutation
              Severity: Major
              Found in backend/lib/twist/web/graphql/mutations/notes/update.rb and 1 other location - About 1 hr to fix
              backend/lib/twist/web/graphql/mutations/comments/update.rb on lines 2..24

              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

                module Web
                  module GraphQL
                    module Mutations
                      module Comments
                        class Update < BaseMutation
              Severity: Major
              Found in backend/lib/twist/web/graphql/mutations/comments/update.rb and 1 other location - About 1 hr to fix
              backend/lib/twist/web/graphql/mutations/notes/update.rb on lines 2..21

              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 type InviteUserMutation = { readonly __typename: 'Mutations', readonly inviteUser: { readonly __typename: 'InvitePayload', readonly bookId?: Maybe<string>, readonly userId?: Maybe<string> } };
              Severity: Major
              Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
              frontend/src/graphql/types.ts on lines 528..528

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

              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 RemoveReaderMutation = { readonly __typename: 'Mutations', readonly removeReader: { readonly __typename: 'RemovePayload', readonly bookId?: Maybe<string>, readonly userId?: Maybe<string> } };
              Severity: Major
              Found in frontend/src/graphql/types.ts and 1 other location - About 1 hr to fix
              frontend/src/graphql/types.ts on lines 513..513

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

              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

              Severity
              Category
              Status
              Source
              Language