binhonglee/GlobeTrotte

View on GitHub

Showing 49 of 49 total issues

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

export class AltimeterDestination {
  public name: string;
  public url: string;

  constructor(name: string, url: string) {
Severity: Major
Found in src/altimeter/index.ts and 1 other location - About 1 hr to fix
src/cockpit/scripts/genRouter.ts on lines 8..16

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

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 Path {
  public name: string;
  public path: string;

  public constructor(name: string, path: string) {
Severity: Major
Found in src/cockpit/scripts/genRouter.ts and 1 other location - About 1 hr to fix
src/altimeter/index.ts on lines 18..26

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

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

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

          func TestGetUser(t *testing.T) {
              var returned *user.UserObj
              getTest(
                  "/v2/user/"+strconv.Itoa(addedUser.GetID()),
                  t,
          Severity: Minor
          Found in src/turbine/router/structrouter_test.go and 1 other location - About 55 mins to fix
          src/turbine/router/structrouter_test.go on lines 119..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 124.

          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 TestGetTrip(t *testing.T) {
              var returned *trip.TripObj
              getTest("/v2/trip/"+strconv.Itoa(
                  addedTrip.GetID()), t, &returned, http.StatusOK,
              )
          Severity: Minor
          Found in src/turbine/router/structrouter_test.go and 1 other location - About 55 mins to fix
          src/turbine/router/structrouter_test.go on lines 51..66

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

          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 (General.authSession()) {
                  if (General.confirmed()) {
                    next();
                  } else {
                    next(R.addParamNext(routes.unconfirmed_Email, to.path));
          Severity: Minor
          Found in src/cockpit/main.ts and 1 other location - About 50 mins to fix
          src/cockpit/main.ts on lines 20..54

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

          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 (to.matched.some((record) => record.meta.loggedIn)) {
                if (General.authSession()) {
                  next();
                } else {
                  next(R.addParamNext(routes.Login, to.path));
          Severity: Minor
          Found in src/cockpit/main.ts and 1 other location - About 50 mins to fix
          src/cockpit/main.ts on lines 27..35

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

          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

            public static messageError(message: string): MessageReactive | undefined {
              if (this.shouldRun()) {
                return this.message.error(message);
              }
            }
          Severity: Major
          Found in src/cockpit/shared/NaiveUtils.ts and 3 other locations - About 50 mins to fix
          src/cockpit/shared/NaiveUtils.ts on lines 65..69
          src/cockpit/shared/NaiveUtils.ts on lines 71..75
          src/cockpit/shared/NaiveUtils.ts on lines 77..81

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

          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 err := row.Scan(
                  &place.ID,
                  &place.Label,
                  &place.URL,
                  &place.Description,
          Severity: Minor
          Found in src/turbine/database/placedb.go and 1 other location - About 50 mins to fix
          src/turbine/database/traveltimedb.go on lines 92..106

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

          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

            public static messageLoading(message: string): MessageReactive | undefined {
              if (this.shouldRun()) {
                return this.message.loading(message);
              }
            }
          Severity: Major
          Found in src/cockpit/shared/NaiveUtils.ts and 3 other locations - About 50 mins to fix
          src/cockpit/shared/NaiveUtils.ts on lines 59..63
          src/cockpit/shared/NaiveUtils.ts on lines 65..69
          src/cockpit/shared/NaiveUtils.ts on lines 77..81

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

          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

            public static messageSuccess(message: string): MessageReactive | undefined {
              if (this.shouldRun()) {
                return this.message.success(message);
              }
            }
          Severity: Major
          Found in src/cockpit/shared/NaiveUtils.ts and 3 other locations - About 50 mins to fix
          src/cockpit/shared/NaiveUtils.ts on lines 59..63
          src/cockpit/shared/NaiveUtils.ts on lines 65..69
          src/cockpit/shared/NaiveUtils.ts on lines 71..75

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

          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 err := row.Scan(
                  &travelTime.ID,
                  &travelTime.FromPlaceID,
                  &travelTime.ToPlaceID,
                  &travelTime.TimeInMinutes,
          Severity: Minor
          Found in src/turbine/database/traveltimedb.go and 1 other location - About 50 mins to fix
          src/turbine/database/placedb.go on lines 94..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 118.

          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

            public static messageInfo(message: string): MessageReactive | undefined {
              if (this.shouldRun()) {
                return this.message.info(message);
              }
            }
          Severity: Major
          Found in src/cockpit/shared/NaiveUtils.ts and 3 other locations - About 50 mins to fix
          src/cockpit/shared/NaiveUtils.ts on lines 59..63
          src/cockpit/shared/NaiveUtils.ts on lines 71..75
          src/cockpit/shared/NaiveUtils.ts on lines 77..81

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

          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

          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
            Severity
            Category
            Status
            Source
            Language