lacymorrow/crossover

View on GitHub

Showing 60 of 60 total issues

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

const newGithubIssueUrl = ( options = {} ) => {

    let repoUrl
    if ( options.repoUrl ) {

Severity: Major
Found in src/main/util.js and 1 other location - About 1 day to fix
src/main/util-for-12.js on lines 65..121

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

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 newGithubIssueUrl = ( options = {} ) => {

    let repoUrl
    if ( options.repoUrl ) {

Severity: Major
Found in src/main/util-for-12.js and 1 other location - About 1 day to fix
src/main/util.js on lines 65..121

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

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

File preferences.js has 591 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const { app } = require( 'electron' )
const path = require( 'path' )
const { debugInfo, is } = require( 'electron-util' )
const ElectronPreferences = require( 'electron-preferences' )
const { DEFAULT_THEME, FILE_FILTERS, SETTINGS_WINDOW_DEVTOOLS, SUPPORTED_IMAGE_FILE_TYPES, DEBOUNCE_DELAY } = require( '../config/config.js' )
Severity: Major
Found in src/main/preferences.js - About 1 day to fix

    File windows.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const path = require( 'path' )
    
    const { app, BrowserWindow, screen } = require( 'electron' )
    
    const { activeWindow, centerWindow, is } = require( './util' )
    Severity: Minor
    Found in src/main/windows.js - About 4 hrs to fix

      File crossover.js has 346 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const { globalShortcut, nativeTheme, shell, app } = require( 'electron' )
      const { SHADOW_WINDOW_OFFSET, DEFAULT_THEME, SETTINGS_WINDOW_DEVTOOLS, APP_BACKGROUND_OPACITY } = require( '../config/config' )
      const { checkboxTrue, hexToRgbA } = require( '../config/utils' )
      const dock = require( './dock' )
      const iohook = require( './iohook' )
      Severity: Minor
      Found in src/main/crossover.js - About 4 hrs to fix

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

        const appMenu = ( menuItems = [] ) => ( {
            label: productName,
            submenu: [
                {
                    role: 'about',
        Severity: Major
        Found in src/main/util-for-12.js and 1 other location - About 3 hrs to fix
        src/main/util.js on lines 226..261

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

        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 appMenu = ( menuItems = [] ) => ( {
            label: productName,
            submenu: [
                {
                    role: 'about',
        Severity: Major
        Found in src/main/util.js and 1 other location - About 3 hrs to fix
        src/main/util-for-12.js on lines 226..261

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

        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 keyboardShortcuts has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const keyboardShortcuts = () => {
        
            /* Default accelerator */
            const accelerator = 'Control+Shift+Alt'
        
        
        Severity: Major
        Found in src/main/crossover.js - About 3 hrs to fix

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

          const is = {
              macos: process.platform === 'darwin',
              linux: process.platform === 'linux',
              windows: process.platform === 'win32',
              main: process.type === 'browser',
          Severity: Major
          Found in src/main/util.js and 1 other location - About 3 hrs to fix
          src/main/util-for-12.js on lines 16..25

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

          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 is = {
              macos: process.platform === 'darwin',
              linux: process.platform === 'linux',
              windows: process.platform === 'win32',
              main: process.type === 'browser',
          Severity: Major
          Found in src/main/util-for-12.js and 1 other location - About 3 hrs to fix
          src/main/util.js on lines 16..25

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

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

          const lockWindow = ( lock, targetWindow = windows.win ) => {
          
              log.info( `Locked: ${lock}` )
          
              /* Actions */
          Severity: Minor
          Found in src/main/crossover.js - 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.
          Open

              document.addEventListener( 'drop', event => {
          
                  event.preventDefault()
                  eventCounter = 0
                  containerElement.classList.remove( 'dropping' )
          Severity: Major
          Found in src/renderer/chooser.js and 1 other location - About 2 hrs to fix
          src/renderer/renderer.js on lines 325..334

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

          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

              document.addEventListener( 'drop', event => {
          
                  event.preventDefault()
                  eventCounter = 0
                  container.classList.remove( 'dropping' )
          Severity: Major
          Found in src/renderer/renderer.js and 1 other location - About 2 hrs to fix
          src/renderer/chooser.js on lines 195..204

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

          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 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const init = () => {
          
              /* IP Communication */
              ipcMain.on( 'log', ( _event, arg ) => {
          
          
          Severity: Major
          Found in src/main/ipc.js - About 2 hrs to fix

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

            const aboutMenuItem = ( options = {} ) => {
            
                options = {
                    title: 'About',
                    ...options,
            Severity: Major
            Found in src/main/util-for-12.js and 1 other location - About 2 hrs to fix
            src/main/util.js on lines 160..180

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

            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 aboutMenuItem = ( options = {} ) => {
            
                options = {
                    title: 'About',
                    ...options,
            Severity: Major
            Found in src/main/util.js and 1 other location - About 2 hrs to fix
            src/main/util-for-12.js on lines 160..180

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

            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 syncSettings has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const syncSettings = ( options = preferences.preferences ) => {
            
                log.info( 'Sync options' )
            
                // Set app size
            Severity: Major
            Found in src/main/crossover.js - About 2 hrs to fix

              Function moveWindow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              const moveWindow = options_ => {
              
                  const options = {
                      distance: 1,
                      direction: 'none',
              Severity: Minor
              Found in src/main/windows.js - 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 moveWindow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const moveWindow = options_ => {
              
                  const options = {
                      distance: 1,
                      direction: 'none',
              Severity: Minor
              Found in src/main/windows.js - About 1 hr to fix

                Function openSettingsWindow has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const openSettingsWindow = async () => {
                
                    // Don't do anything if locked
                    if ( preferences.value( 'hidden.locked' ) ) {
                
                
                Severity: Minor
                Found in src/main/crossover.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language