prefixaut/splitterino

View on GitHub

Showing 18 of 54 total issues

Function getSplitsStoreModule has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
Open

export function getSplitsStoreModule(injector: Injector): Module<SplitsState, RootState> {
    const electron = injector.get(ELECTRON_INTERFACE_TOKEN);
    const validator = injector.get(VALIDATOR_SERVICE_TOKEN);

    return {
Severity: Minor
Found in src/store/modules/splits.module.ts - About 2 days 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 getSplitsStoreModule has 472 lines of code (exceeds 300 allowed). Consider refactoring.
Open

export function getSplitsStoreModule(injector: Injector): Module<SplitsState, RootState> {
    const electron = injector.get(ELECTRON_INTERFACE_TOKEN);
    const validator = injector.get(VALIDATOR_SERVICE_TOKEN);

    return {
Severity: Major
Found in src/store/modules/splits.module.ts - About 7 hrs to fix

    Function getSettingsStoreModule has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getSettingsStoreModule(): Module<SettingsState, RootState> {
        return {
            namespaced: true,
            state: {
                values: {
    Severity: Minor
    Found in src/store/modules/settings.module.ts - About 4 hrs 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 getTimerStoreModule has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getTimerStoreModule(): Module<TimerState, RootState> {
        return {
            namespaced: true,
            state: {
                status: TimerStatus.STOPPED,
    Severity: Minor
    Found in src/store/modules/timer.module.ts - About 3 hrs 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 getGameInfoStoreModule has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getGameInfoStoreModule(): Module<GameInfoState, RootState> {
        return {
            namespaced: true,
            state: {
                name: null,
    Severity: Minor
    Found in src/store/modules/game-info.module.ts - About 2 hrs 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 loadSettingsFromFileToStore has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public async loadSettingsFromFileToStore(store: Store<RootState>) {
            const loadedSettings = this.loadJSONFromFile(this.settingsFileName);
            const parsedSettings: Settings = {
                splitterino: {
                    core: {},
    Severity: Minor
    Found in src/services/io.service.ts - About 2 hrs 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 loadApplicationSettingsFromFile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public async loadApplicationSettingsFromFile(
            store: Store<RootState>,
            splitsFile?: string
        ): Promise<ApplicationSettings> {
            const appSettings = this.loadJSONFromFile(this.appSettingsFileName);
    Severity: Minor
    Found in src/services/io.service.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 getClientStore has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getClientStore(vueRef, injector: Injector) {
        vueRef.use(Vuex);
    
        const store = new Vuex.Store<RootState>({
            plugins: [
    Severity: Minor
    Found in src/store/index.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 saveSettingsToFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public saveSettingsToFile(store: Store<RootState>) {
            const flattenedSettings = {};
            const settings = store.state.splitterino.settings.values;
    
            for (const [moduleKey, modulE] of Object.entries(settings)) {
    Severity: Minor
    Found in src/services/io.service.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 (loadedSettings != null && loadedSettings[path] !== undefined) {
                                value = loadedSettings[path];
                            } else {
                                usedDefaultValue = true;
                            }
    Severity: Major
    Found in src/services/io.service.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      if (!isEqual(setting, oldValue)) {
                                          eventHub.$emit(`setting-changed:${path}`, setting);
                                      }
      Severity: Major
      Found in src/store/modules/settings.module.ts - About 45 mins to fix

        Function convertToBoolean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export function convertToBoolean(
            value: any,
            defaultValue: boolean = false
        ): boolean {
            if (value == null) {
        Severity: Minor
        Found in src/utils/converters.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

        Avoid too many return statements within this function.
        Open

            return defaultValue;
        Severity: Major
        Found in src/utils/converters.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return defaultValue;
          Severity: Major
          Found in src/utils/converters.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return group.settings;
            Severity: Major
            Found in src/store/modules/settings.module.ts - About 30 mins to fix

              Function keyToDisplayString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function keyToDisplayString(keyCode: string) {
                  switch (keyCode.toLowerCase()) {
                      case 'super':
                          switch (type()) {
                              case 'Darwin':
              Severity: Minor
              Found in src/utils/keys.ts - About 25 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 convertToNumber has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function convertToNumber(
                  value: any,
                  allowDecimals: boolean = true,
                  defaultValue: number = null,
              ): number {
              Severity: Minor
              Found in src/utils/converters.ts - About 25 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 keyToAcceleratorString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function keyToAcceleratorString(keyCode: string) {
                  switch (keyCode.toLowerCase()) {
                      case 'super':
                          switch (type()) {
                              case 'Darwin':
              Severity: Minor
              Found in src/utils/keys.ts - About 25 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

              Severity
              Category
              Status
              Source
              Language