timhaley94/holdem

View on GitHub

Showing 80 of 80 total issues

File index.test.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const { Types: { ObjectId } } = require('mongoose');
const {
  hasEqualIds,
  expectThrows,
  expectEqualIds,
Severity: Minor
Found in server/src/domain/room/index.test.js - About 5 hrs to fix

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

    const retrieve = Handler.wrap({
      validators,
      required: ['id'],
      fn: async ({ id }, projection) => {
        const args = [Types.ObjectId(id)];
    Severity: Major
    Found in server/src/domain/room/index.js and 2 other locations - About 5 hrs to fix
    server/src/domain/game/index.js on lines 76..94
    server/src/domain/user/index.js on lines 69..87

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

    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

    const retrieve = Handler.wrap({
      validators,
      required: ['id'],
      fn: async ({ id }, projection) => {
        const args = [Types.ObjectId(id)];
    Severity: Major
    Found in server/src/domain/game/index.js and 2 other locations - About 5 hrs to fix
    server/src/domain/room/index.js on lines 154..172
    server/src/domain/user/index.js on lines 69..87

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

    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

    const retrieve = Handler.wrap({
      validators,
      required: ['id'],
      fn: async ({ id }, projection) => {
        const args = [Types.ObjectId(id)];
    Severity: Major
    Found in server/src/domain/user/index.js and 2 other locations - About 5 hrs to fix
    server/src/domain/game/index.js on lines 76..94
    server/src/domain/room/index.js on lines 154..172

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

    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

    File index.test.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const { Errors } = require('../../modules');
    const Hand = require('../hand');
    const Solver = require('./index');
    
    describe('Domain.Solver', () => {
    Severity: Minor
    Found in server/src/domain/solver/index.test.js - About 4 hrs to fix

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

          it('type ALL_IN calls Round.allIn', async () => {
            const { _id: id } = await Game.create({ userIds });
            const spy = jest.spyOn(Round, 'allIn');
      
            await Game.makeMove({
      Severity: Major
      Found in server/src/domain/game/index.test.js and 1 other location - About 4 hrs to fix
      server/src/domain/game/index.test.js on lines 150..163

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

      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('type FOLD calls Round.fold', async () => {
            const { _id: id } = await Game.create({ userIds });
            const spy = jest.spyOn(Round, 'fold');
      
            await Game.makeMove({
      Severity: Major
      Found in server/src/domain/game/index.test.js and 1 other location - About 4 hrs to fix
      server/src/domain/game/index.test.js on lines 135..148

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

      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

      File index.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const { Schema } = require('mongoose');
      const { Errors } = require('../../modules');
      const Utils = require('../../utils');
      const Card = require('../card');
      const Deck = require('../deck');
      Severity: Minor
      Found in server/src/domain/round/index.js - About 4 hrs to fix

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

              Object.entries(tests).forEach(
                ([type, hands]) => {
                  it(`Can handle kickers with hand type, ${type}`, () => {
                    expectSolution(
                      {
        Severity: Major
        Found in server/src/domain/solver/index.test.js and 1 other location - About 4 hrs to fix
        server/src/domain/solver/index.test.js on lines 149..166

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

        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

              Object.entries(tests).forEach(([type, hands]) => {
                it(`can compare hands with type, ${type}`, () => {
                  expectSolution(
                    {
                      charlie: Hand.create(hands[0]),
        Severity: Major
        Found in server/src/domain/solver/index.test.js and 1 other location - About 4 hrs to fix
        server/src/domain/solver/index.test.js on lines 250..269

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

        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

        async function subscribe(socket, id) {
          const game = await Game.retrieve({ id });
        
          socket.emit(
            events.game.updated,
        Severity: Major
        Found in server/src/api/socket/game/index.js and 1 other location - About 3 hrs to fix
        server/src/api/socket/user/index.js on lines 30..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 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

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

          const create = async () => {
            const { _id } = await Domain.User.create({ secret });
            const id = _id.toString();
            const { token } = await Domain.User.auth({ id, secret });
            return { id, token };
        Severity: Major
        Found in server/src/api/rest/users/index.test.js and 1 other location - About 3 hrs to fix
        server/src/api/rest/index.test.js on lines 22..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 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

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

            const create = async () => {
              const { _id } = await Domain.User.create({ secret });
              const id = _id.toString();
              const { token } = await Domain.User.auth({ id, secret });
              return { id, token };
        Severity: Major
        Found in server/src/api/rest/index.test.js and 1 other location - About 3 hrs to fix
        server/src/api/rest/users/index.test.js on lines 14..19

        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

        async function subscribe(socket, id) {
          const user = await User.retrieve({ id });
        
          socket.emit(
            events.user.updated,
        Severity: Major
        Found in server/src/api/socket/user/index.js and 1 other location - About 3 hrs to fix
        server/src/api/socket/game/index.js on lines 20..36

        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

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

        function Sidebar() {
          const requireData = useRouteMatch('/room');
          const [data, setData] = useUser();
          const [isOpen, setIsOpen] = useState(false);
        
        
        Severity: Major
        Found in client/src/components/Sidebar/index.js - About 3 hrs to fix

          Function Lobby has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Lobby() {
            const [isCopied, setIsCopied] = useState(false);
            const copyRef = useRef(null);
          
            const [{ id: userId }] = useUser();
          Severity: Major
          Found in client/src/components/Lobby/index.js - About 3 hrs to fix

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

                it('throws if user does not exist', async () => {
                  expect.assertions(1);
            
                  try {
                    await User.exists({
            Severity: Major
            Found in server/src/domain/user/index.test.js and 1 other location - About 2 hrs to fix
            server/src/domain/user/index.test.js on lines 39..49

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

            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('throws on no result', async () => {
                  expect.assertions(1);
            
                  try {
                    await User.retrieve({
            Severity: Major
            Found in server/src/domain/user/index.test.js and 1 other location - About 2 hrs to fix
            server/src/domain/user/index.test.js on lines 25..35

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

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

            function Chat() {
              const { messages, sendMessage } = useRoom();
              const [value, setValue] = useState('');
              const [isShiftDown, setIsShiftDown] = useState(false);
              const bottomRef = useRef(null);
            Severity: Major
            Found in client/src/components/Chat/index.js - About 2 hrs to fix

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

                useEffect(() => {
                  if (socket) {
                    const set = (user) => dispatch({
                      type: SET_USER,
                      value: user,
              Severity: Major
              Found in client/src/state/players.js and 1 other location - About 2 hrs to fix
              client/src/state/game.js on lines 97..110

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

              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