sue445/chrome-gitlab-notifier

View on GitHub

Showing 208 of 10,177 total issues

Function onload has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.onload = function() {
  chrome.notifications.onClicked.addListener((notification_id) => {
    // close notification popup
    chrome.notifications.clear(notification_id, () => {
      // open gitlab event page (Issue, MergeRequest, Milestone)
Severity: Minor
Found in src/background_init.js - About 1 hr to fix

Function handlers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handlers: function( event, handlers ) {
        var i, handleObj, sel, matchedHandlers, matchedSelectors,
            handlerQueue = [],
            delegateCount = handlers.delegateCount,
            cur = event.target;
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function setOffset has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    setOffset: function( elem, options, i ) {
        var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
            position = jQuery.css( elem, "position" ),
            curElem = jQuery( elem ),
            props = {};
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

        // Trust units reported by jQuery.css
        unit = unit || initialInUnit[ 3 ];

Severity: Critical
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function notify has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  notify(args){
    const project       = args.project;
    const project_event = args.project_event;
    const internal      = args.internal;
    const current_time  = args.current_time;
Severity: Minor
Found in src/notification.js - About 1 hr to fix

Function showHide has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function showHide( elements, show ) {
    var display, elem,
        values = [],
        index = 0,
        length = elements.length;
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function parseQueryString has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var parseQueryString = function(string) {
    if (string === "" || string == null) return {}
    if (string.charAt(0) === "?") string = string.slice(1)
    var entries = string.split("&"), counters = {}, data0 = {}
    for (var i = 0; i < entries.length; i++) {
Severity: Minor
Found in lib/mithril.js - About 1 hr to fix

Function onload has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.onload = function() {
  // remove notification count when show popup
  // because) can not use both chrome.browserAction.onClicked and popup
  // https://developer.chrome.com/extensions/browserAction.html#event-onClicked
  chrome.browserAction.setBadgeText({text: ""});
Severity: Minor
Found in src/popup_init.js - About 1 hr to fix

Function view has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

app.view = function(vnode) {
  const state = vnode.state;

  const matchSearchKey = (project) => {
    const keys = state.search_key.split(" ");
Severity: Minor
Found in src/options.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 applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

Severity: Minor
Found in lib/bootstrap.js - About 1 hr to fix

Function load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.fn.load = function( url, params, callback ) {
    var selector, type, response,
        self = this,
        off = url.indexOf( " " );

Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function projList has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const projList = () => {
    if(!state.gitlab.projects) {
      return m("li.active", [
        m(".progress", [
          m(".progress-bar.progress-bar-striped.active[aria-valuemax='100'][aria-valuemin='0'][aria-valuenow='100'][role='progressbar']", {style: {"width": "100%"}}, [
Severity: Minor
Found in src/trigger.js - About 1 hr to fix

Function loadProjectsBase has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  loadProjectsBase(page, all_projects) {
    const params = {
      page: page,
      per_page: this.per_page,
      order_by: "name",
Severity: Minor
Found in src/gitlab.js - About 1 hr to fix

Function loop has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function loop(i) {
                // 0 = init
                // 1 = scheduled
                // 2 = done
                for (; i < compiled.length; i++) {
Severity: Minor
Found in lib/mithril.js - About 1 hr to fix

Function removeClass has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    removeClass: function( value ) {
        var classes, elem, cur, curValue, clazz, j, finalValue,
            i = 0;

        if ( jQuery.isFunction( value ) ) {
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function speed has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.speed = function( speed, easing, fn ) {
    var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
        complete: fn || !fn && easing ||
            jQuery.isFunction( speed ) && speed,
        duration: speed,
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix

Function show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tab.prototype.show = function () {
    var $this    = this.element
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
    var selector = $this.data('target')

Severity: Minor
Found in lib/bootstrap.js - About 1 hr to fix

Function onreadystatechange has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            xhr.onreadystatechange = function(ev) {
                // Don't throw errors on xhr.abort().
                if (aborted) return
                if (ev.target.readyState === 4) {
                    try {
Severity: Minor
Found in lib/mithril.js - About 1 hr to fix

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

  getGitLabVersion() {
    // Metadata API
    // GET /metadata
    // https://docs.gitlab.com/ee/api/metadata.html (for GitLab 15.5+)
    return m.request({
Severity: Minor
Found in src/gitlab.js - About 1 hr to fix

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

    attr: function( elem, name, value ) {
        var ret, hooks,
            nType = elem.nodeType;

        // Don't get/set attributes on text, comment and attribute nodes
Severity: Minor
Found in lib/jquery-3.2.1.js - About 1 hr to fix
Severity
Category
Status
Source
Language