os-js/osjs-client

View on GitHub

Showing 45 of 77 total issues

Function droppable has 53 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export const droppable = (el, options = {}) => {
  const {strict, type, effect, dataTransferProperty, ondragenter, ondragover, ondragleave, ondrop} = {
    type: 'application/json',
    effect: 'move',
    dataTransferProperty: 'files',
Severity: Major
Found in src/utils/dnd.js - About 1 hr to fix

    Function createWindow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      createWindow(options = {}) {
        const found = this.windows.find(w => w.id === options.id);
        if (found) {
          const msg = this.core.make('osjs/locale')
            .translate('ERR_WINDOW_ID_EXISTS', options.id);
    Severity: Minor
    Found in src/application.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 _launch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      _launch(name, metadata, args, options) {
        const _ = this.core.make('osjs/locale').translate;
        const canLaunch = createPackageAvailabilityCheck(this.core);
    
        const dialog = e => {
    Severity: Minor
    Found in src/packages.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 loadOptionsFromConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const loadOptionsFromConfig = (config, appName, windowId) => {
      const matchStringOrRegex = (str, matcher) => matcher instanceof RegExp
        ? !!str.match(matcher)
        : str === matcher;
    
    
    Severity: Minor
    Found in src/utils/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 renderCallback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const renderCallback = (win, callback) => {
      if (typeof callback === 'function') {
        if (win.attributes.shadowDOM) {
          try {
            const mode = typeof win.attributes.shadowDOM === 'string'
    Severity: Minor
    Found in src/utils/windows.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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const onclick = () => this.destroy();
    
        const renderCustom = () => {
          const view = state => h('div', {
    Severity: Minor
    Found in src/notification.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    const create = (core, $element) => {
      const _ = core.make('osjs/locale').translate;
      const fs = core.make('osjs/fs');
      const {icon} = core.make('osjs/theme');
      const view = createView(core, fs, icon, _);
    Severity: Minor
    Found in src/adapters/ui/search.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 browserLocale has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const browserLocale = (nav = {}) => {
      const browserLanguage = nav.userLanguage || nav.language || '';
      const get = l => prefixMap[l] ? prefixMap[l] : (l.match(/_/)
        ? l
        : (l ? `${l}_${l.toUpperCase()}` : ''));
    Severity: Minor
    Found in src/utils/locale.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 createSoundsContract has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      createSoundsContract() {
        const {soundResource, soundsEnabled} = resourceResolver(this.core);
    
        return {
          resource: soundResource,
    Severity: Minor
    Found in src/providers/core.js - 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 createGlobalApi has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      createGlobalApi() {
        const globalBlacklist = this.core.config('providers.globalBlacklist', []);
        const globalWhitelist = this.core.config('providers.globalWhitelist', []);
    
        const make = (name, ...args) => {
    Severity: Minor
    Found in src/providers/core.js - 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 createFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const createFields = (props, fields, disabled) => {
      const children = f => {
        if (f.tagName === 'select' && f.choices) {
          return f.choices.map(c => h('option', {
            current: c.current ? 'current' : undefined,
    Severity: Minor
    Found in src/adapters/ui/login.js - 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 applyBackgroundStyles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const applyBackgroundStyles = (core, background) => {
      const {$root} = core;
    
      const styles = {
        backgroundRepeat: 'no-repeat',
    Severity: Minor
    Found in src/utils/desktop.js - 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

    Avoid deeply nested control flow statements.
    Open

                if (tagName === 'TEXTAREA') {
                  handleTabOnTextarea(e);
                }
    Severity: Major
    Found in src/desktop.js - About 45 mins to fix

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

        resizeFit(container) {
          container = container || this.$content.firstChild;
      
          if (container) {
            const rect = this.core.has('osjs/desktop')
      Severity: Minor
      Found in src/window.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

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

        applySettings(settings) {
          const lockSettings = this.core.config('desktop.lock');
          const defaultSettings = this.core.config('desktop.settings');
          let newSettings;
      
      
      Severity: Minor
      Found in src/desktop.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

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

        open(file, options = {}) {
          if (file.mime === 'osjs/application') {
            return this.run(file.path.split('/').pop());
          }
      
      
      Severity: Minor
      Found in src/core.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

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

        getDialogOptions(type, options = {}) {
          const {
            file,
            ...rest
          } = options;
      Severity: Minor
      Found in src/basic-application.js - 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 dblclick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        dblclick(ev, win) {
          if (this.lastAction) {
            return;
          }
      
      
      Severity: Minor
      Found in src/window-behavior.js - 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 resizer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const resizer = (win, handle) => {
        const clamp = clamper(win);
        const {position, dimension} = win.state;
        const directions = handle.getAttribute('data-direction').split('');
        const going = dir => directions.indexOf(dir) !== -1;
      Severity: Minor
      Found in src/utils/windows.js - 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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        destroy() {
          if (this.destroyed) {
            return;
          }
      
      
      Severity: Minor
      Found in src/window.js - 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