ActivityWatch/aw-webui

View on GitHub

Showing 37 of 37 total issues

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

export function split_by_hour_into_data(events) {
  if (events === undefined || events === null || events.length == 0) return [];
  const d = moment(events[0].timestamp).startOf('day');
  const hoursOffset = get_hour_offset();
  return _.range(0, 24).map(h => {
Severity: Minor
Found in src/util/transforms.js - About 1 hr to fix

    Function beforeCreate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      beforeCreate: function () {
        const that = this;
        const methods = this.$options.methods || {};
        for (const key in methods) {
          const original = methods[key];
    Severity: Minor
    Found in src/mixins/asyncErrorCaptured.js - About 55 mins 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 fullDesktopQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      browserbuckets: string[],
      windowbucket: string,
      afkbucket: string,
      filterAFK = true,
      classes,
    Severity: Major
    Found in src/queries.ts - About 50 mins to fix

      Function getTitleAttr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getTitleAttr(bucket: Bucket, e: IEvent) {
        if (bucket.type == 'currentwindow') {
          return e.data.app;
        } else if (bucket.type == 'web.tab.current') {
          try {
      Severity: Minor
      Found in src/util/color.ts - About 45 mins 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 updateSummedEvents has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function updateSummedEvents(container, summedEvents, titleKeyFunc, hoverKeyFunc, colorKeyFunc) {
      Severity: Minor
      Found in src/visualizations/summary.js - About 35 mins to fix

        Function update has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function update(container, events, showAFK, chunkfunc, eventfunc) {
        Severity: Minor
        Found in src/visualizations/timeline.js - About 35 mins to fix

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

              const periods = timeperiodStrsAroundTimeperiod(timeperiod).filter(tp_str => {
                return !_.includes(state.active.history, tp_str);
              });
          Severity: Minor
          Found in src/store/modules/activity.ts and 1 other location - About 35 mins to fix
          src/store/modules/activity.ts on lines 314..316

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

          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

              const periods = timeperiodStrsAroundTimeperiod(timeperiod).filter(tp_str => {
                return !_.includes(state.active.history, tp_str);
              });
          Severity: Minor
          Found in src/store/modules/activity.ts and 1 other location - About 35 mins to fix
          src/store/modules/activity.ts on lines 263..265

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

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

          export function getColorFromCategory(c: Category, allCats: Category[]): string {
            // Returns the color for a certain category, falling back to parents if none set
            if (c && c.data && c.data.color) {
              return c.data.color;
            } else if (c && c.name.slice(0, -1).length > 0) {
          Severity: Minor
          Found in src/util/color.ts - About 35 mins 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 handleError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleError(error, vm, info) {
            let cur = vm;
            while ((cur = cur.$parent)) {
              const hooks = cur.$options.errorCaptured || [];
              for (const hook of hooks) if (hook.call(cur, error, vm, info) === false) break;
          Severity: Minor
          Found in src/mixins/asyncErrorCaptured.js - About 35 mins 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

              const data = await this._vm.$aw.query(
                periods,
                queries.dailyActivityQueryAndroid(state.buckets.android[0])
              );
          Severity: Minor
          Found in src/store/modules/activity.ts and 1 other location - About 35 mins to fix
          src/store/modules/activity.ts on lines 266..269

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

          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

              const data = await this._vm.$aw.query(
                periods,
                queries.dailyActivityQuery(state.buckets.afk[0])
              );
          Severity: Minor
          Found in src/store/modules/activity.ts and 1 other location - About 35 mins to fix
          src/store/modules/activity.ts on lines 317..320

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

          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 too many return statements within this function.
          Open

              return 'day';
          Severity: Major
          Found in src/util/timeperiod.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return e.data.label;
            Severity: Major
            Found in src/util/color.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return e.data.title;
              Severity: Major
              Found in src/util/color.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return _.last(e.data.file.split('/'));
                Severity: Major
                Found in src/util/color.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return 'YYYY-MM-DD';
                  Severity: Major
                  Found in src/util/timeperiod.ts - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language