ujh/fountainpencompanion

View on GitHub

Showing 377 of 377 total issues

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

  it("updates hidden fields when clicked", async () => {
    const { getByTitle, getByLabelText, queryByText, user } = setup(
      <CurrentlyInkedCards
        currentlyInked={currentlyInked}
        onLayoutChange={() => {
app/javascript/src/collected_pens/table/CollectedPensTable.spec.jsx on lines 143..159
app/javascript/src/currently_inked/table/CurrentlyInkedTable.spec.jsx on lines 67..83

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

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 3 locations. Consider refactoring.
Open

  it("updates hidden fields when clicked", async () => {
    const { getByTitle, getByLabelText, queryByText, user } = setup(
      <CurrentlyInkedTable
        currentlyInked={currentlyInked}
        onLayoutChange={() => {
app/javascript/src/collected_pens/table/CollectedPensTable.spec.jsx on lines 143..159
app/javascript/src/currently_inked/cards/CurrentlyInkedCards.spec.jsx on lines 54..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 145.

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

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

                <div className="fpc-pen-card__actions">
                  <a
                    className="btn btn-secondary me-2"
                    title="edit"
                    href={`/collected_pens/${id}/edit`}
      Severity: Major
      Found in app/javascript/src/collected_pens/cards/PenCard.jsx and 1 other location - About 4 hrs to fix
      app/javascript/src/collected_pens/table/ActionsCell.jsx on lines 5..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 126.

      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

          <div className="actions">
            <a
              className="btn btn-secondary"
              title="edit"
              href={`/collected_pens/${id}/edit`}
      Severity: Major
      Found in app/javascript/src/collected_pens/table/ActionsCell.jsx and 1 other location - About 4 hrs to fix
      app/javascript/src/collected_pens/cards/PenCard.jsx on lines 111..127

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

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

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

          it("calls onChange when clicked", async () => {
            let checked = false;
        
            const { user, getByRole } = setup(
              <Switch checked={false} onChange={(e) => (checked = e.target.checked)}>
        Severity: Major
        Found in app/javascript/src/components/Switch.spec.jsx and 1 other location - About 4 hrs to fix
        app/javascript/src/components/Switch.spec.jsx on lines 30..43

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

        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

          it("returns expected value when starting checked", async () => {
            let checked = true;
        
            const { user, getByRole } = setup(
              <Switch checked={true} onChange={(e) => (checked = e.target.checked)}>
        Severity: Major
        Found in app/javascript/src/components/Switch.spec.jsx and 1 other location - About 4 hrs to fix
        app/javascript/src/components/Switch.spec.jsx on lines 15..28

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

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

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

            it("calls onChange with the expected value when the active layout is table", async () => {
              const onChange = jest.fn((e) => e.target.value);
          
              const { user, getAllByRole } = setup(
                <LayoutToggle activeLayout="table" onChange={onChange} />
          Severity: Major
          Found in app/javascript/src/components/LayoutToggle.spec.jsx and 1 other location - About 4 hrs to fix
          app/javascript/src/components/LayoutToggle.spec.jsx on lines 29..41

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

          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

            it("calls onChange with the expected value when the active layout is card", async () => {
              const onChange = jest.fn((e) => e.target.value);
          
              const { user, getAllByRole } = setup(
                <LayoutToggle activeLayout="card" onChange={onChange} />
          Severity: Major
          Found in app/javascript/src/components/LayoutToggle.spec.jsx and 1 other location - About 4 hrs to fix
          app/javascript/src/components/LayoutToggle.spec.jsx on lines 15..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 121.

          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

              it("removes the cluster from microClusters", () => {
                const state = {
                  ...initalState,
                  microClusters: [
                    { id: 1, type: "micro_cluster" },
          app/javascript/src/admin/components/clustering/reducer.spec.js on lines 161..176

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

          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

              it("removes the cluster from selectedMicroClusters", () => {
                const state = {
                  ...initalState,
                  selectedMicroClusters: [
                    { id: 1, type: "micro_cluster" },
          app/javascript/src/admin/components/clustering/reducer.spec.js on lines 144..159

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

          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

            const pens = [
              {
                brand: "Faber-Castell",
                model: "Loom",
                nib: "B",
          app/javascript/src/collected_pens/table/CollectedPensTable.spec.jsx on lines 18..46

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

          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

            const pens = [
              {
                brand: "Faber-Castell",
                model: "Loom",
                nib: "B",
          app/javascript/src/collected_pens/cards/CollectedPensCards.spec.jsx on lines 18..46

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

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

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

              if (layout ? layout === "card" : screen.isSmall) {
                if (currentlyInked) {
                  return (
                    <CurrentlyInkedCards
                      currentlyInked={currentlyInked}
            Severity: Major
            Found in app/javascript/src/currently_inked/CurrentlyInked.jsx and 1 other location - About 3 hrs to fix
            app/javascript/src/collected_pens/CollectedPens.jsx on lines 28..40

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

            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

              if (layout ? layout === "card" : screen.isSmall) {
                if (pens) {
                  return <CollectedPensCards pens={pens} onLayoutChange={onLayoutChange} />;
                } else {
                  return <CardsPlaceholder />;
            Severity: Major
            Found in app/javascript/src/collected_pens/CollectedPens.jsx and 1 other location - About 3 hrs to fix
            app/javascript/src/currently_inked/CurrentlyInked.jsx on lines 32..54

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

            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 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
              Severity
              Category
              Status
              Source
              Language