AndrewWalsh/at-your-service

View on GitHub

Showing 89 of 89 total issues

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

async function postMessageToAYS(event, type, payload) {
  const thisClient = await self.clients.get(event.clientId);
  if (thisClient) {
    thisClient.postMessage({ type, payload });
    thisClient
Severity: Major
Found in demo/public/mockServiceWorker.js and 1 other location - About 1 hr to fix
docs/mockServiceWorker.js on lines 94..100

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

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

async function postMessageToAYS(event, type, payload) {
  const thisClient = await self.clients.get(event.clientId);
  if (thisClient) {
    thisClient.postMessage({ type, payload });
    thisClient
Severity: Major
Found in docs/mockServiceWorker.js and 1 other location - About 1 hr to fix
demo/public/mockServiceWorker.js on lines 94..100

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

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

async function postMessageToAYS(event, type, payload) {
  const thisClient = await self.clients.get(event.clientId);
  if (thisClient) {
    thisClient.postMessage({ type, payload });
    thisClient
Severity: Major
Found in demo/public/at-your-service-sw.js and 1 other location - About 1 hr to fix
docs/at-your-service-sw.js on lines 92..98

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

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

async function postMessageToAYS(event, type, payload) {
  const thisClient = await self.clients.get(event.clientId);
  if (thisClient) {
    thisClient.postMessage({ type, payload });
    thisClient
Severity: Major
Found in docs/at-your-service-sw.js and 1 other location - About 1 hr to fix
demo/public/at-your-service-sw.js on lines 92..98

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

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

              <Tabs.Item label="response" value="3">
                <TabViewCode
                  samples={content.storeRoute.responseBodySamples}
                  meta={content.storeRoute.meta}
                />
Severity: Major
Found in src/ui/Inspector.tsx and 1 other location - About 1 hr to fix
src/ui/Inspector.tsx on lines 41..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 68.

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

              <Tabs.Item label="request" value="2">
                <TabViewCode
                  samples={content.storeRoute.requestBodySamples}
                  meta={content.storeRoute.meta}
                />
Severity: Major
Found in src/ui/Inspector.tsx and 1 other location - About 1 hr to fix
src/ui/Inspector.tsx on lines 47..52

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

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

const createStoreStructureAndExpectedForSingleMessage = async (
  message = createMessage()
): Promise<CreateStoreStructureAndExpectedForSingleMessageReturns> => {
  const data = message.get();
  const url = new URL(data.request.url);
Severity: Minor
Found in src/data-types/store/message-store.test.ts - About 1 hr to fix

    Function LatencySlider has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function LatencySlider(props: Props) {
      const sliderValue = props.value;
      const setSliderValue = props.setValue;
      const [showTooltip, setShowTooltip] = useState(false);
      return (
    Severity: Minor
    Found in demo/src/LatencySlider.tsx - About 1 hr to fix

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

                  <Th>
                    <Input
                      variant="flushed"
                      placeholder="Key"
                      onChange={(e) => setKey(keyChars(e.target.value))}
      Severity: Major
      Found in demo/src/KeyValue.tsx and 1 other location - About 1 hr to fix
      demo/src/KeyValue.tsx on lines 124..131

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

      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

                  <Th>
                    <Input
                      variant="flushed"
                      placeholder="Value"
                      onChange={(e) => setValue(valueChars(e.target.value))}
      Severity: Major
      Found in demo/src/KeyValue.tsx and 1 other location - About 1 hr to fix
      demo/src/KeyValue.tsx on lines 116..123

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

      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 (propQueryParameters) {
                  Object.entries(propQueryParameters).forEach(([name, schema]) => {
                    parameters.push({
                      name,
                      in: "query",
      Severity: Major
      Found in src/lib/store-struct-to-openapi.ts and 1 other location - About 1 hr to fix
      src/lib/store-struct-to-openapi.ts on lines 172..181

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

      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("getJSON returns JSON", async () => {
          const { storeStructure } = createStoreStructure();
          const result = await storeStructToOpenAPI(storeStructure);
          expect(result.getJSON()).toBeTypeOf("string");
        });
      Severity: Major
      Found in src/lib/store-struct-to-openapi.test.ts and 1 other location - About 1 hr to fix
      src/lib/store-struct-to-openapi.test.ts on lines 42..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 64.

      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("getYAML returns YAML", async () => {
          const { storeStructure } = createStoreStructure();
          const result = await storeStructToOpenAPI(storeStructure);
          expect(result.getYAML()).toBeTypeOf("string");
        });
      Severity: Major
      Found in src/lib/store-struct-to-openapi.test.ts and 1 other location - About 1 hr to fix
      src/lib/store-struct-to-openapi.test.ts on lines 36..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 64.

      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 (propRequestHeaders) {
                  Object.entries(propRequestHeaders).forEach(([name, schema]) => {
                    parameters.push({
                      name,
                      in: "header",
      Severity: Major
      Found in src/lib/store-struct-to-openapi.ts and 1 other location - About 1 hr to fix
      src/lib/store-struct-to-openapi.ts on lines 186..195

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

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

        async _createPayload(event, response, beforeRequestTime, afterRequestTime, requestBody) {
          const request = event.request
          const requestHeaders = {};
          for (const [key, value] of request.headers) {
            requestHeaders[key] = value;
      Severity: Minor
      Found in demo/public/mockServiceWorker.js - About 1 hr to fix

        Function _createPayload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async _createPayload(event, response, beforeRequestTime, afterRequestTime, requestBody) {
            const request = event.request
            const requestHeaders = {};
            for (const [key, value] of request.headers) {
              requestHeaders[key] = value;
        Severity: Minor
        Found in demo/public/at-your-service-sw.js - About 1 hr to fix

          Function _createPayload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async _createPayload(event, response, beforeRequestTime, afterRequestTime, requestBody) {
              const request = event.request
              const requestHeaders = {};
              for (const [key, value] of request.headers) {
                requestHeaders[key] = value;
          Severity: Minor
          Found in docs/mockServiceWorker.js - About 1 hr to fix

            Function _createPayload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async _createPayload(event, response, beforeRequestTime, afterRequestTime, requestBody) {
                const request = event.request
                const requestHeaders = {};
                for (const [key, value] of request.headers) {
                  requestHeaders[key] = value;
            Severity: Minor
            Found in docs/at-your-service-sw.js - About 1 hr to fix

              Function SkeletonLanding has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function SkeletonLanding() {
                const [isLoaded, setIsLoaded] = useState(false);
                return (
                  <Stack padding={4} spacing={1} width="300px">
                    <Skeleton
              Severity: Minor
              Found in demo/src/SkeletonLanding.tsx - About 1 hr to fix

                Function onClickMockRequest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const onClickMockRequest = async (e: MouseEvent<HTMLButtonElement>) => {
                    e.preventDefault();
                    if (!worker) {
                      return;
                    }
                Severity: Minor
                Found in demo/src/Requester.tsx - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language