binhonglee/GlobeTrotte

View on GitHub

Showing 49 of 49 total issues

Function baseConfig has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function baseConfig(coverage = true): ViteConfig {
  const config = {
    plugins: [
      vue(),
      VitePWA({
Severity: Major
Found in src/cockpit/configs/vite_base_config.ts - About 2 hrs to fix

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

    class TripStorage extends CacheStorage<TripObj> {
      public static fromJSON(obj: Record<string, unknown>): TripStorage {
        return new TripStorage(obj);
      }
    
    
    Severity: Major
    Found in src/cockpit/cache/TripCache.ts and 1 other location - About 2 hrs to fix
    src/cockpit/cache/UserCache.ts on lines 12..20

    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

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

      public static dialogWarning(options: DialogOptions) {
        if (this.shouldRun()) {
          this.dialog.warning(options);
        } else {
          // If we aren't showing the warning dialog, we should just trigger the
    Severity: Major
    Found in src/cockpit/shared/NaiveUtils.ts and 1 other location - About 2 hrs to fix
    src/cockpit/shared/NaiveUtils.ts on lines 35..45

    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

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

      public static dialogError(options: DialogOptions) {
        if (this.shouldRun()) {
          this.dialog.error(options);
        } else {
          // If we aren't showing the error dialog, we should just trigger the
    Severity: Major
    Found in src/cockpit/shared/NaiveUtils.ts and 1 other location - About 2 hrs to fix
    src/cockpit/shared/NaiveUtils.ts on lines 47..57

    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

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

    class UserStorage extends CacheStorage<UserObj> {
      public static fromJSON(obj: Record<string, unknown>): UserStorage {
        return new UserStorage(obj);
      }
    
    
    Severity: Major
    Found in src/cockpit/cache/UserCache.ts and 1 other location - About 2 hrs to fix
    src/cockpit/cache/TripCache.ts on lines 12..20

    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

    Function parseFile has 76 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func parseFile(file io.Reader) {
        reader := bufio.NewReader(file)
    
        firstLine, err := reader.ReadString('\n')
        logger.PanicErr(logger.Database, err, "")
    Severity: Major
    Found in src/turbine/database/citiesdb.go - About 2 hrs to fix

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

          if auth, ok := session.Values["authenticated"].(bool); !ok || !auth {
              val = -1
          } else if id, ok := session.Values["userid"].(int); ok {
              refreshSession := true
              if startTime, ok := session.Values["startTime"].(int64); ok {
      Severity: Major
      Found in src/turbine/router/accesshandlers.go and 1 other location - About 1 hr to fix
      src/turbine/router/accesshandlers.go on lines 107..124

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

      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

          if auth, ok := session.Values["authenticated"].(bool); !ok || !auth {
              val = -1
          } else if id, ok := session.Values["userid"].(int); ok {
              refreshSession := true
              if startTime, ok := session.Values["startTime"].(int64); ok {
      Severity: Major
      Found in src/turbine/router/accesshandlers.go and 1 other location - About 1 hr to fix
      src/turbine/router/accesshandlers.go on lines 133..150

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

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

        protected storeObj(
          fetchedObj: FetchedObjStatic<T, FO>,
          cacheStorage: CacheStorageStatic<T, CS>,
          key: string,
          value: string,
      Severity: Minor
      Found in src/cockpit/cache/CacheStorage.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 getRoute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private getRoute(path: string, name: string, component: string): string {
          let metaTxt = "";
          for (const key of Object.keys(meta)) {
            if (
              meta[key].includes(name) ||
      Severity: Minor
      Found in src/cockpit/scripts/genRouter.ts - About 1 hr to fix

        Function updateDay has 63 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func updateDay(
            updatedDay *wings.Day, createOnNonExist bool,
        ) bool {
            existingDay := fetchDay(int64(updatedDay.ID))
            if updatedDay.ID == -1 || existingDay.ID != updatedDay.ID {
        Severity: Minor
        Found in src/turbine/database/tripdb.go - About 1 hr to fix

          Function genScreenShot has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function genScreenShot(
            config: AltimeterConfig,
            browser: Browser,
            name: string,
            path: string,
          Severity: Minor
          Found in src/altimeter/index.ts - About 1 hr to fix

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

              private getParamRoute(path: string, file: string): string {
                if (file.substring(0, 1) !== "v") {
                  return "";
                }
            
            
            Severity: Minor
            Found in src/cockpit/scripts/genRouter.ts - About 1 hr to fix

              Function updateTripBasic has 61 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func updateTripBasic(updatedTrip wings.TripBasic) bool {
                  existingTrip, _ := fetchTripBasic(updatedTrip.GetID())
                  if existingTrip.GetID() != updatedTrip.GetID() {
                      logger.Print(
                          logger.Database,
              Severity: Minor
              Found in src/turbine/database/tripbasicdb.go - About 1 hr to fix

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

                func updateTripObj(res http.ResponseWriter, req *http.Request) {
                    var id int
                    if id = getRequestID(req); id == -1 {
                        respond(res, trip.DummyTripObj())
                        return
                Severity: Major
                Found in src/turbine/router/triphandlers.go and 1 other location - About 1 hr to fix
                src/turbine/router/userhandlers.go on lines 81..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 153.

                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

                func updateUserObj(res http.ResponseWriter, req *http.Request) {
                    var id int
                    if id = getRequestID(req); id == -1 {
                        respond(res, user.DummyUserObj())
                        return
                Severity: Major
                Found in src/turbine/router/userhandlers.go and 1 other location - About 1 hr to fix
                src/turbine/router/triphandlers.go on lines 27..42

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

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

                  protected storeObj(
                    fetchedObj: FetchedObjStatic<T, FO>,
                    cacheStorage: CacheStorageStatic<T, CS>,
                    key: string,
                    value: string,
                Severity: Minor
                Found in src/cockpit/cache/CacheStorage.ts - About 1 hr to fix

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

                  func deleteTripObj(res http.ResponseWriter, req *http.Request) {
                      var id int
                      if id = getRequestID(req); id == -1 {
                          respond(res, trip.DummyTripObj())
                          return
                  Severity: Major
                  Found in src/turbine/router/triphandlers.go and 1 other location - About 1 hr to fix
                  src/turbine/router/userhandlers.go on lines 98..113

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

                  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

                  func deleteUserObj(res http.ResponseWriter, req *http.Request) {
                      var id int
                      if id = getRequestID(req); id == -1 {
                          respond(res, user.DummyUserObj())
                          return
                  Severity: Major
                  Found in src/turbine/router/userhandlers.go and 1 other location - About 1 hr to fix
                  src/turbine/router/triphandlers.go on lines 44..59

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

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

                  func getModuleInfo(name string, gmod *golistobj) gopkg {
                      var mod golistobj
                      if gmod == nil {
                          res := runNoPanic("go", "list", "--json", name)
                          if len(res) == 0 {
                  Severity: Minor
                  Found in src/turbine/scripts/genBUILD.go - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language