AndrewWalsh/at-your-service

View on GitHub

Showing 89 of 89 total issues

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

function sendToClient(client, message) {
  return new Promise((resolve, reject) => {
    const channel = new MessageChannel()

    channel.port1.onmessage = (event) => {
Severity: Major
Found in demo/public/mockServiceWorker.js and 1 other location - About 4 hrs to fix
docs/mockServiceWorker.js on lines 392..406

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

Function HowItWorks has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function HowItWorks() {
  const { width } = useWindowSize();

  const isLargeScreen = width && width > 600;
  const flexFlow = isLargeScreen ? "row nowrap" : "column nowrap";
Severity: Major
Found in demo/src/HowItWorks.tsx - About 3 hrs to fix

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

            <Box
              position="absolute"
              height="100%"
              width="10vw"
              top="0"
    Severity: Major
    Found in demo/src/App.tsx and 1 other location - About 3 hrs to fix
    demo/src/App.tsx on lines 120..138

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

    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

            <Box
              position="absolute"
              height="100%"
              width="10vw"
              top="0"
    Severity: Major
    Found in demo/src/App.tsx and 1 other location - About 3 hrs to fix
    demo/src/App.tsx on lines 140..158

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

    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

    test("the order of elements in the first argument does not affect the output", async () => {
      const s1 = new Sample(JSON.stringify(createDummyData()));
      const s2 = new Sample(JSON.stringify(createDummyData()));
      expect(await samplesToQuicktype([s1, s2])).toEqual(
        await samplesToQuicktype([s2, s1])
    Severity: Major
    Found in src/lib/samples-to-quicktype.test.ts and 1 other location - About 2 hrs to fix
    src/lib/samples-to-quicktype.test.ts on lines 18..24

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

    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

    test("equivalent data types have the same structure", async () => {
      const s1 = new Sample(JSON.stringify(createDummyData()));
      const s2 = new Sample(JSON.stringify(createAllBlank()));
      expect(await samplesToQuicktype([s1, s2])).toEqual(
        await samplesToQuicktype([s1, s1])
    Severity: Major
    Found in src/lib/samples-to-quicktype.test.ts and 1 other location - About 2 hrs to fix
    src/lib/samples-to-quicktype.test.ts on lines 7..13

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

    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

    const keyChars = (s: string) => {
      const validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-";
      const validCharsSet = new Set(validChars.split(""));
      let out = "";
      for (const c of s) {
    Severity: Major
    Found in demo/src/KeyValue.tsx and 1 other location - About 2 hrs to fix
    demo/src/KeyValue.tsx on lines 32..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 88.

    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

    const valueChars = (s: string) => {
      const validChars =
        "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ";
      const validCharsSet = new Set(validChars.split(""));
      let out = "";
    Severity: Major
    Found in demo/src/KeyValue.tsx and 1 other location - About 2 hrs to fix
    demo/src/KeyValue.tsx on lines 20..30

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

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

    async function getResponse(event, client, requestId) {
      const beforeRequestTime = Date.now()
      const { request } = event
      const clonedRequest = request.clone()
    
    
    Severity: Major
    Found in demo/public/mockServiceWorker.js - About 2 hrs to fix

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

      function Title() {
        return (
          <Heading as="h1" margin="32px 0" maxWidth="850px">
            <br />
            <Link
      Severity: Major
      Found in demo/src/Title.tsx - About 2 hrs to fix

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

        async function getResponse(event, client, requestId) {
          const beforeRequestTime = Date.now()
          const { request } = event
          const clonedRequest = request.clone()
        
        
        Severity: Major
        Found in docs/mockServiceWorker.js - About 2 hrs to fix

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

                  <ListItem display="flex" flexFlow={flexFlow} alignItems="center">
                    <ListIcon
                      as={GiJumpingDog}
                      color={COLOR_WHITE}
                      height="128px"
          Severity: Major
          Found in demo/src/HowItWorks.tsx and 3 other locations - About 2 hrs to fix
          demo/src/HowItWorks.tsx on lines 78..89
          demo/src/HowItWorks.tsx on lines 91..102
          demo/src/HowItWorks.tsx on lines 104..115

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

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

                  <ListItem display="flex" flexFlow={flexFlow} alignItems="center">
                    <ListIcon
                      as={FcAcceptDatabase}
                      color={COLOR_WHITE}
                      height="128px"
          Severity: Major
          Found in demo/src/HowItWorks.tsx and 3 other locations - About 2 hrs to fix
          demo/src/HowItWorks.tsx on lines 66..76
          demo/src/HowItWorks.tsx on lines 91..102
          demo/src/HowItWorks.tsx on lines 104..115

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

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

                  <ListItem display="flex" flexFlow={flexFlow} alignItems="center">
                    <ListIcon
                      as={GiCrystalBall}
                      color={COLOR_WHITE}
                      height="128px"
          Severity: Major
          Found in demo/src/HowItWorks.tsx and 3 other locations - About 2 hrs to fix
          demo/src/HowItWorks.tsx on lines 66..76
          demo/src/HowItWorks.tsx on lines 78..89
          demo/src/HowItWorks.tsx on lines 104..115

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

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

                  <ListItem display="flex" flexFlow={flexFlow} alignItems="center">
                    <ListIcon
                      as={FcIdea}
                      color={COLOR_TERTIARY}
                      height="128px"
          Severity: Major
          Found in demo/src/HowItWorks.tsx and 3 other locations - About 2 hrs to fix
          demo/src/HowItWorks.tsx on lines 66..76
          demo/src/HowItWorks.tsx on lines 78..89
          demo/src/HowItWorks.tsx on lines 91..102

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

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

            async update(message: Message): Promise<void> {
              const data = message.get();
              const status = `s${data.response.status}`;
              const url = new URL(data.request.url);
              const { pathToStoreRoute, pathname } = Store.getPathToStoreRoute({
          Severity: Major
          Found in src/data-types/store/message-store.ts - About 2 hrs to fix

            Function RenderBox has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const RenderBox = (props: Item) => {
              const height = `${Math.max(props.height, MIN_DIMENSION)}px`;
              const width = `${Math.max(props.width, MIN_DIMENSION)}px`;
              const bgs: Array<string> = [
                COLOR_WHITE,
            Severity: Major
            Found in demo/src/AnimationEffect.tsx - About 2 hrs to fix

              Function AnimationEffect has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function AnimationEffect(props: {
                bg: typeof COLOR_PRIMARY | typeof COLOR_SECONDARY;
              }) {
                const [itemsFirst, setItemsFirst] = useState<Array<Item>>([]);
              
              
              Severity: Major
              Found in demo/src/AnimationEffect.tsx - About 2 hrs to fix

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

                  test("updates state for a single message where the response body is undefined", async () => {
                    const message = createMessage();
                    // @ts-expect-error
                    message.data.response.body = null;
                    const [storeStructure, expected] =
                Severity: Major
                Found in src/data-types/store/message-store.test.ts and 1 other location - About 2 hrs to fix
                src/data-types/store/message-store.test.ts on lines 152..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 77.

                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

                  test("updates state for a single message where the request body is undefined", async () => {
                    const message = createMessage();
                    // @ts-expect-error
                    message.data.request.body = null;
                    const [storeStructure, expected] =
                Severity: Major
                Found in src/data-types/store/message-store.test.ts and 1 other location - About 2 hrs to fix
                src/data-types/store/message-store.test.ts on lines 161..168

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

                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