Showing 92 of 413 total issues
Function SwabCard
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const SwabCard = (props) => {
const {
archived,
id,
ink_id,
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,
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;
Class CollectedInk
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class CollectedInk < ApplicationRecord
include Archivable
include PgSearch::Model
KINDS = %w[bottle sample cartridge swab]
Function PenCard
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PenCard = (props) => {
const {
hiddenFields,
id,
brand,
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;
}
Function CurrentlyInkedCard
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CurrentlyInkedCard = (props) => {
const {
hiddenFields,
id,
comment,
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";
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 {
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",
- Read upRead up
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
- Read upRead up
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";
Class AdminStats
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class AdminStats
def micro_cluster_count
MicroCluster.count
end
Function LeaderboardRankingWidgetContent
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LeaderboardRankingWidgetContent = () => {
const { data } = useContext(WidgetDataContext);
const {
inks,
bottles,
Function SwabCard
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const SwabCard = (props) => {
const {
archived,
id,
ink_id,
- Read upRead up
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
Function PenAndInkSuggestionWidgetContent
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PenAndInkSuggestionWidgetContent = () => {
const { data } = useContext(WidgetDataContext);
const { by_kind } = data.attributes;
const [suggestion, setSuggestion] = useState();
const [loading, setLoading] = useState();
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 (
<>
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
Function CurrentlyInkedSummaryWidgetContent
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CurrentlyInkedSummaryWidgetContent = () => {
const { data } = useContext(WidgetDataContext);
const { active, total, usage_records } = data.attributes;
return (
<>