prefixaut/splitterino

View on GitHub

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

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

        public showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<string> {
            return new Promise((resolve, reject) => {
                try {
                    Logger.debug('Opening "save-file" dialog ...');
                    const dialogToUse = this.isRenderProcess() ? remote.dialog : dialog;
    Severity: Major
    Found in src/services/electron.service.ts and 1 other location - About 5 hrs to fix
    src/services/electron.service.ts on lines 117..137

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

    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 showMessageDialog(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<number> {
            return new Promise((resolve, reject) => {
                try {
                    Logger.debug('Opening "message" dialog');
                    const dialogToUse = this.isRenderProcess() ? remote.dialog : dialog;
    Severity: Major
    Found in src/services/electron.service.ts and 1 other location - About 5 hrs to fix
    src/services/electron.service.ts on lines 95..115

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

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

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

                    context.state.segments.forEach(segment => {
                        if (segment.passed) {
                            totalRTATime += getFinalTime(segment.personalBest.rta);
                            totalIGTTime += getFinalTime(segment.personalBest.igt);
                        }
    Severity: Major
    Found in src/store/modules/splits.module.ts and 1 other location - About 1 hr to fix
    src/store/modules/splits.module.ts on lines 577..582

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

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

                    context.state.segments.forEach(segment => {
                        if (segment.passed) {
                            totalRTATime += getFinalTime(segment.currentTime.rta);
                            totalIGTTime += getFinalTime(segment.currentTime.igt);
                        }
    Severity: Major
    Found in src/store/modules/splits.module.ts and 1 other location - About 1 hr to fix
    src/store/modules/splits.module.ts on lines 303..308

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

    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

    export function openSplitsBrowser(electron: ElectronInterface) {
        electron.newWindow(
            {
                title: 'Open Splits File',
                parent: electron.getCurrentWindow(),
    Severity: Major
    Found in src/utils/windows.ts and 1 other location - About 1 hr to fix
    src/utils/windows.ts on lines 68..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 73.

    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

    export function openTemplateBrowser(electron: ElectronInterface) {
        electron.newWindow(
            {
                title: 'Open Template File',
                parent: electron.getCurrentWindow(),
    Severity: Major
    Found in src/utils/windows.ts and 1 other location - About 1 hr to fix
    src/utils/windows.ts on lines 45..58

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

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

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

            return this.electron
                .showOpenDialog(this.electron.getCurrentWindow(), {
                    title: 'Load Template',
                    filters: [IOService.TEMPLATE_FILE_FILTER],
                    properties: ['openFile'],
    Severity: Minor
    Found in src/services/io.service.ts and 1 other location - About 55 mins to fix
    src/services/io.service.ts on lines 301..321

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

    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

            return this.electron
                .showOpenDialog(this.electron.getCurrentWindow(), {
                    title: 'Load Splits',
                    filters: [IOService.SPLITS_FILE_FILTER],
                    properties: ['openFile'],
    Severity: Minor
    Found in src/services/io.service.ts and 1 other location - About 55 mins to fix
    src/services/io.service.ts on lines 458..480

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

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

            default:
            if (keycode.names[keyCode] != null) {
                return keycode.names[keyCode].toUpperCase();
            } else {
                return keyCode.toUpperCase();
    Severity: Minor
    Found in src/utils/keys.ts and 1 other location - About 55 mins to fix
    src/utils/keys.ts on lines 15..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 53.

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

            default:
                if (keycode.names[keyCode] != null) {
                    return keycode.names[keyCode].toUpperCase();
                } else {
                    return keyCode.toUpperCase();
    Severity: Minor
    Found in src/utils/keys.ts and 1 other location - About 55 mins to fix
    src/utils/keys.ts on lines 33..38

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

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