binhonglee/GlobeTrotte

View on GitHub

Showing 25 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

    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

      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

                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

                  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

                    Function init has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func init() {
                        configs := config.GetConfigStringMap("email")
                    
                        if !hasConfig {
                            return
                    Severity: Minor
                    Found in src/turbine/email/email.go - About 1 hr to fix

                      Function processDirectDeps has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func processDirectDeps(directDeps []string) {
                          pkgs := make(map[string]gopkg)
                          processed = make(map[string]string)
                          var wg sync.WaitGroup
                          for _, name := range directDeps {
                      Severity: Minor
                      Found in src/turbine/scripts/genBUILD.go - About 1 hr to fix

                        Function genRun has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function genRun(config: AltimeterConfig): Promise<void> {
                          let browser: Browser;
                          switch (config.browser) {
                            case BrowserTypes.Chromium:
                              browser = await chromium.launch();
                        Severity: Minor
                        Found in src/altimeter/index.ts - About 1 hr to fix

                          Function toDay has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public toDay(): Day {
                              const ret = new Day();
                              ret.ID = this.ID;
                              ret.tripID = this.tripID;
                              ret.dayOf = this.dayOf;
                          Severity: Minor
                          Found in src/cockpit/shared/DataProps.ts - About 1 hr to fix

                            Function constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public constructor(day: Day) {
                                this.ID = day.ID.valueOf();
                                this.tripID = day.tripID.valueOf();
                                this.dayOf = day.dayOf.valueOf();
                                this.propPlaces = day.places.map((place, index) => {
                            Severity: Minor
                            Found in src/cockpit/shared/DataProps.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 processDirectDeps has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func processDirectDeps(directDeps []string) {
                                pkgs := make(map[string]gopkg)
                                processed = make(map[string]string)
                                var wg sync.WaitGroup
                                for _, name := range directDeps {
                            Severity: Minor
                            Found in src/turbine/scripts/genBUILD.go - 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 genObjImpl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              protected async genObjImpl(
                                fetchedObj: FetchedObjStatic<T, FO>,
                                cacheStorage: CacheStorageStatic<T, CS>,
                                key: string,
                              ): Promise<FO> {
                            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

                            Avoid deeply nested control flow statements.
                            Open

                                  if (General.authSession()) {
                                    next(R.getNext(to));
                                  } else {
                                    next();
                                  }
                            Severity: Major
                            Found in src/cockpit/main.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                      if (General.confirmed()) {
                                        next(R.getNext(to));
                                      } else {
                                        next();
                                      }
                              Severity: Major
                              Found in src/cockpit/main.ts - About 45 mins to fix

                                Function updateDay has 6 return statements (exceeds 4 allowed).
                                Open

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