radar/twist-v2

View on GitHub

Showing 29 of 143 total issues

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(commit, path, file_name, part, position)
Severity: Minor
Found in backend/lib/twist/processors/markdown/chapter_processor.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def initialize(book, commit, path, element, position)
    Severity: Minor
    Found in backend/lib/twist/processors/asciidoc/chapter.rb - About 35 mins to fix

      Function Root has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function Header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const Header: React.FC<HeaderProps> = ({ permalink, noteNumber }) => {
        const renderSuffix = (book: Book, noteNumber?: number) => {
          const bookRoot = `/books/${book.permalink}`;
          if (noteNumber) {
            return (
      Severity: Minor
      Found in frontend/src/Book/Notes/Header.tsx - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function Element has a Cognitive Complexity of 6 (exceeds 5 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 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def call(token)
                return Failure("no token specified") if !token || token.length == 0
      
                token = token.split.last
                return Failure("no token specified") unless token
      Severity: Minor
      Found in backend/lib/twist/transactions/users/find_current_user.rb - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method process_manifest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def process_manifest
                lines = File.readlines(Pathname.new(path) + "manuscript/Book.txt")
                parts = Hash.new { |h, k| h[k] = [] }
                part = :mainmatter
                lines.each do |line|
      Severity: Minor
      Found in backend/lib/twist/processors/markdown/book.rb - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method process_div has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def process_div(element)
                return unless element["class"]
      
                classes = element["class"].split(" ")
      
      
      Severity: Minor
      Found in backend/lib/twist/processors/asciidoc/chapter_processor.rb - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function InviteForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const InviteForm: React.FC<InviteFormProps> = ({
        bookPermalink,
        bookTitle,
        bookId,
        bookReaders,
      Severity: Minor
      Found in frontend/src/Book/Invitations/InviteForm.tsx - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language