manaba-enhanced-for-tsukuba/manaba-enhanced

View on GitHub

Showing 51 of 51 total issues

Function main has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const main = (): void => {
  const fileInput = document.querySelector(".form-input-file") as
    | HTMLInputElement
    | undefined
  const formWrapper = document.querySelector(".form") as
Severity: Major
Found in src/methods/dragAndDrop.ts - About 2 hrs to fix

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

              switch (lang) {
                case "ja":
                  createMessage(`あと${diff.value}分`, "danger")
                  break
                case "en":
    Severity: Major
    Found in src/methods/checkAssignmentDeadline.ts and 1 other location - About 2 hrs to fix
    src/methods/checkAssignmentDeadline.ts on lines 96..108

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

    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

              switch (lang) {
                case "ja":
                  createMessage(`あと${diff.value}時間`, "danger")
                  break
                case "en":
    Severity: Major
    Found in src/methods/checkAssignmentDeadline.ts and 1 other location - About 2 hrs to fix
    src/methods/checkAssignmentDeadline.ts on lines 111..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 83.

    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

    export function getStorage<K extends keyof StorageSync>(params: {
      kind: "sync"
      keys: K
      callback: (storage: Partial<Pick<StorageSync, K>>) => void
    }): void
    Severity: Major
    Found in src/network/storage.ts and 1 other location - About 2 hrs to fix
    src/network/storage.ts on lines 18..22

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

    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

    export function getStorage<K extends keyof StorageLocal>(params: {
      kind: "local"
      keys: K
      callback: (storage: Partial<Pick<StorageLocal, K>>) => void
    }): void
    Severity: Major
    Found in src/network/storage.ts and 1 other location - About 2 hrs to fix
    src/network/storage.ts on lines 3..7

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

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

    const main = (storageSync: Partial<StorageSync>) => {
      if (document.head) {
        withDocumentHead(storageSync)
      } else {
        let headFound = false
    Severity: Minor
    Found in src/contentScript/main.ts - About 1 hr to fix

      Function withDocumentHead has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      const withDocumentHead = async (storageSync: Partial<StorageSync>) => {
        const url = window.location.href
      
        insertStyle({
          styleString: colorizeDeadlineStyles.toString(),
      Severity: Minor
      Found in src/contentScript/main.ts - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

        | {
            kind: Extract<StorageKind, "sync">
            callback: (
              changed: Partial<{
                [key in keyof StorageSync]: {
      Severity: Major
      Found in src/network/storage.ts and 1 other location - About 1 hr to fix
      src/network/storage.ts on lines 97..107

      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

        | {
            kind: Extract<StorageKind, "local">
            callback: (
              changed: Partial<{
                [key in keyof StorageSync]: {
      Severity: Major
      Found in src/network/storage.ts and 1 other location - About 1 hr to fix
      src/network/storage.ts on lines 86..96

      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 main has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      const main = (storageSync: Partial<StorageSync>) => {
        if (document.head) {
          withDocumentHead(storageSync)
        } else {
          let headFound = false
      Severity: Minor
      Found in src/contentScript/main.ts - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      const syncReportText = (): void => {
        const textarea = document.getElementsByTagName("textarea")[0]
      
        const getId = () => {
          const url = window.location.href
      Severity: Minor
      Found in src/methods/syncReportText.ts - About 1 hr to fix

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

        const applyFilter = (moduleCode: ModuleCode): void => {
          const coursesListContainer =
            document.querySelector<HTMLElement>(".courselist tbody")
          const coursesThumbnailContainer = document.querySelector<HTMLElement>(
            ".mycourses-body .section"
        Severity: Minor
        Found in src/methods/filterCourses.ts - About 1 hr to fix

          Function startLegacyHandler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const startLegacyHandler = () => {
            ;(
              Array.from(
                document.getElementsByClassName("checkbox-features")
              ) as HTMLInputElement[]
          Severity: Minor
          Found in src/optionsPage/legacyHandler.ts - About 1 hr to fix

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

            const withDocumentHead = async (storageSync: Partial<StorageSync>) => {
              const url = window.location.href
            
              insertStyle({
                styleString: colorizeDeadlineStyles.toString(),
            Severity: Minor
            Found in src/contentScript/main.ts - About 1 hr to fix

              Function createLinkToOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createLinkToOptions = (): void => {
                const myLinksContainer = document.getElementById("mylinks")
              
                const linkContainer = document.createElement("span")
              
              
              Severity: Minor
              Found in src/methods/createLinkToOptions.ts - About 1 hr to fix

                Function removeLinkBalloon has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const removeLinkBalloon = (): void => {
                  const links = document.getElementsByTagName("a")
                
                  const urlClamp = (url: string) => {
                    if (url.length > 100) {
                Severity: Minor
                Found in src/methods/removeLinkBalloon.ts - About 1 hr to fix

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

                  export function getStorage(params: {
                    kind: "local"
                    keys: null
                    callback: (storage: Partial<StorageLocal>) => void
                  }): void
                  Severity: Major
                  Found in src/network/storage.ts and 1 other location - About 1 hr to fix
                  src/network/storage.ts on lines 13..17

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

                  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

                  export function getStorage(params: {
                    kind: "sync"
                    keys: null
                    callback: (storage: Partial<StorageSync>) => void
                  }): void
                  Severity: Major
                  Found in src/network/storage.ts and 1 other location - About 1 hr to fix
                  src/network/storage.ts on lines 28..32

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

                  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 applyFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const applyFilter = (moduleCode: ModuleCode): void => {
                    const coursesListContainer =
                      document.querySelector<HTMLElement>(".courselist tbody")
                    const coursesThumbnailContainer = document.querySelector<HTMLElement>(
                      ".mycourses-body .section"
                  Severity: Minor
                  Found in src/methods/filterCourses.ts - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function createModuleSelector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const createModuleSelector = () => {
                    const selectorsContainer = document.querySelector(
                      ".my-infolist-mycourses .showmore"
                    )
                  
                  
                  Severity: Minor
                  Found in src/methods/filterCourses.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language