ujh/fountainpencompanion

View on GitHub

Showing 83 of 371 total issues

Function SwabCard has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const SwabCard = (props) => {
  const {
    archived,
    id,
    ink_id,
Severity: Major
Found in app/javascript/src/collected_inks/cards/SwabCard.jsx - About 5 hrs to fix

    File reducer.spec.js has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { reducer, initalState } from "./reducer";
    import {
      ADD_MACRO_CLUSTER,
      ASSIGN_TO_MACRO_CLUSTER,
      NEXT,
    Severity: Minor
    Found in app/javascript/src/admin/components/clustering/reducer.spec.js - About 4 hrs to fix

      Function init has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function init(converter) {
          function api(key, value, attributes) {
            var result;
            if (typeof document === "undefined") {
              return;
      Severity: Major
      Found in app/assets/javascripts/js.cookie.js - About 4 hrs to fix

        Class User has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class User < ApplicationRecord
          # Include default devise modules. Others available are:
          # :confirmable, :lockable, :timeoutable and :omniauthable
          devise :database_authenticatable,
                 :registerable,
        Severity: Minor
        Found in app/models/user.rb - About 4 hrs to fix

          Function PenCard has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const PenCard = (props) => {
            const {
              hiddenFields,
              id,
              brand,
          Severity: Major
          Found in app/javascript/src/collected_pens/cards/PenCard.jsx - About 4 hrs to fix

            Class CollectedInk has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class CollectedInk < ApplicationRecord
              include Archivable
              include PgSearch::Model
            
              KINDS = %w[bottle sample cartridge swab]
            Severity: Minor
            Found in app/models/collected_ink.rb - About 3 hrs to fix

              Function CurrentlyInkedCard has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const CurrentlyInkedCard = (props) => {
                const {
                  hiddenFields,
                  id,
                  comment,
              Severity: Major
              Found in app/javascript/src/currently_inked/cards/CurrentlyInkedCard.jsx - About 3 hrs to fix

                Function api has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function api(key, value, attributes) {
                      var result;
                      if (typeof document === "undefined") {
                        return;
                      }
                Severity: Major
                Found in app/assets/javascripts/js.cookie.js - About 3 hrs to fix

                  File SwabCard.spec.jsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // @ts-check
                  import React from "react";
                  import { render } from "@testing-library/react";
                  import userEvent from "@testing-library/user-event";
                  import { SwabCard } from "./SwabCard";
                  Severity: Minor
                  Found in app/javascript/src/collected_inks/cards/SwabCard.spec.jsx - About 3 hrs to fix

                    File table.jsx has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import * as React from "react";
                    import ReactTable from "react-table-6";
                    import _ from "lodash";
                    
                    export default class Table extends React.Component {
                    Severity: Minor
                    Found in app/javascript/src/public_inks/table.jsx - About 3 hrs to fix

                      Function CollectedInksTable has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const CollectedInksTable = ({ data, archive, onLayoutChange }) => {
                        const columns = useMemo(
                          () => [
                            {
                              accessor: "private",
                      Severity: Minor
                      Found in app/javascript/src/collected_inks/table/CollectedInksTable.jsx - About 3 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

                      Method brand_name has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.brand_name(name)
                          return "24solar" if name =~ /^24\s+solar/i
                          if name =~ /^(ancient\s*(charm|song))|(small\s*endowment)/i
                            return "ancientsong"
                          end
                      Severity: Minor
                      Found in app/models/simplifier.rb - About 2 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

                      File CollectedInksTable.jsx has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { useEffect, useMemo } from "react";
                      import { useTable, useSortBy, useGlobalFilter } from "react-table";
                      import _ from "lodash";
                      import { RelativeDate } from "../../components/RelativeDate";
                      import { useHiddenFields } from "../../useHiddenFields";
                      Severity: Minor
                      Found in app/javascript/src/collected_inks/table/CollectedInksTable.jsx - About 2 hrs to fix

                        Class LeaderBoard has 24 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class LeaderBoard
                          TYPES = %w[
                            inks
                            bottles
                            samples
                        Severity: Minor
                        Found in app/models/leader_board.rb - About 2 hrs to fix

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

                          const LeaderboardRankingWidgetContent = () => {
                            const { data } = useContext(WidgetDataContext);
                            const {
                              inks,
                              bottles,
                          Severity: Major
                          Found in app/javascript/src/dashboard/leaderboard_ranking_widget.jsx - About 2 hrs to fix

                            Class AdminStats has 21 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class AdminStats
                              def micro_cluster_count
                                MicroCluster.count
                              end
                            
                            
                            Severity: Minor
                            Found in app/models/admin_stats.rb - About 2 hrs to fix

                              Function SwabCard has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const SwabCard = (props) => {
                                const {
                                  archived,
                                  id,
                                  ink_id,
                              Severity: Minor
                              Found in app/javascript/src/collected_inks/cards/SwabCard.jsx - About 2 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 useScreen has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useScreen = () => {
                                const [state, dispatch] = useReducer(reducer, {
                                  isSmall: false,
                                  isMedium: false,
                                  isLarge: false
                              Severity: Minor
                              Found in app/javascript/src/useScreen.js - About 1 hr to fix

                                Function InksSummaryWidgetContent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const InksSummaryWidgetContent = () => {
                                  const { data } = useContext(WidgetDataContext);
                                  const { count, used, swabbed, archived } = data.attributes;
                                  return (
                                    <>
                                Severity: Minor
                                Found in app/javascript/src/dashboard/inks_summary_widget.jsx - About 1 hr to fix

                                  Method index has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def index
                                      if current_user.collected_inks.empty?
                                        flash.now[
                                          :notice
                                        ] = "Your ink collection is empty. Check out the <a href='/pages/guide'>documentation</a> on how to add some.".html_safe
                                  Severity: Minor
                                  Found in app/controllers/collected_inks_controller.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language