noomorph/github-user-rank-extension

View on GitHub

Showing 2,423 of 2,423 total issues

File language-colors.ts has 1378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Taken from: https://github.com/ozh/github-colors/blob/master/colors.json

export default {
    "1C Enterprise": {
        "color": "#814CCC", 
Severity: Major
Found in src/language-colors.ts - About 3 days to fix

    File browser.ts has 734 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Type definitions for WebExtensions
    // Project: https://developer.mozilla.org/en-US/Add-ons/WebExtensions
    // Definitions by: Yaroslav Serhieiev <https://github.com/noomorph>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    
    Severity: Major
    Found in src/external/browser.ts - About 1 day to fix

      Function init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function init(browser: Browser) {
          const queue = new Map<number, QueueItem>();
      
          browser.runtime.onMessage.addListener(function (message: messages.GUREBackgroundMessage, sender: browser.runtime.MessageSender /*, sendResponse: (response: any) => void */) {
              const item = queue.get(message.thread);
      Severity: Minor
      Found in src/content/utils/rpc.ts - About 1 hr to fix

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

            export function update(windowId: number, updateInfo: UpdateInfo, callback?: (window: browser.windows.Window) => void): void;
        Severity: Minor
        Found in src/external/browser.ts and 1 other location - About 50 mins to fix
        src/external/browser.ts on lines 2037..2037

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

        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 get(windowId: number, getInfo: GetInfo, callback: (window: browser.windows.Window) => void): void;
        Severity: Minor
        Found in src/external/browser.ts and 1 other location - About 50 mins to fix
        src/external/browser.ts on lines 2069..2069

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

        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 4 locations. Consider refactoring.
        Open

            export function highlight(highlightInfo: HighlightInfo, callback: (window: browser.windows.Window) => void): void;
        Severity: Major
        Found in src/external/browser.ts and 3 other locations - About 35 mins to fix
        src/external/browser.ts on lines 2046..2046
        src/external/browser.ts on lines 2058..2058
        src/external/browser.ts on lines 2080..2080

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

        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 4 locations. Consider refactoring.
        Open

            export function getLastFocused(getInfo: GetInfo, callback: (window: browser.windows.Window) => void): void;
        Severity: Major
        Found in src/external/browser.ts and 3 other locations - About 35 mins to fix
        src/external/browser.ts on lines 1719..1719
        src/external/browser.ts on lines 2046..2046
        src/external/browser.ts on lines 2058..2058

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

        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 4 locations. Consider refactoring.
        Open

            export function getCurrent(getInfo: GetInfo, callback: (window: browser.windows.Window) => void): void;
        Severity: Major
        Found in src/external/browser.ts and 3 other locations - About 35 mins to fix
        src/external/browser.ts on lines 1719..1719
        src/external/browser.ts on lines 2058..2058
        src/external/browser.ts on lines 2080..2080

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

        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 4 locations. Consider refactoring.
        Open

            export function create(createData: CreateData, callback?: (window?: browser.windows.Window) => void): void;
        Severity: Major
        Found in src/external/browser.ts and 3 other locations - About 35 mins to fix
        src/external/browser.ts on lines 1719..1719
        src/external/browser.ts on lines 2046..2046
        src/external/browser.ts on lines 2080..2080

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

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

        export function render(element: any): any {
            if (typeof element === 'string' || typeof element === 'number') {
                return document.createTextNode(String(element));
            }
        
        
        Severity: Minor
        Found in src/content/utils/h.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

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

                const request: messages.ReportBIRequest = {
                    thread: Math.random(),
                    type: 'ReportBIRequest',
                    data: { eventCode }
                };
        Severity: Minor
        Found in src/content/utils/rpc.ts and 1 other location - About 35 mins to fix
        src/content/utils/rpc.ts on lines 31..35

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

        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 request: messages.FetchGitlanceDataRequest = {
                    thread: Math.random(),
                    type: 'FetchGitlanceDataRequest',
                    data: { login }
                };
        Severity: Minor
        Found in src/content/utils/rpc.ts and 1 other location - About 35 mins to fix
        src/content/utils/rpc.ts on lines 43..47

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

        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 too many return statements within this function.
        Open

            return el;
        Severity: Major
        Found in src/content/utils/h.ts - About 30 mins to fix

          space indentation expected
          Open

              const tabId = sender && sender.tab && sender.tab.id;
          Severity: Minor
          Found in src/background/handler.ts by tslint

          Rule: indent

          Enforces indentation with tabs or spaces.

          Rationale

          Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

          Notes
          • Has Fix

          Config

          One of the following arguments must be provided:

          • spaces enforces consistent spaces.
          • tabs enforces consistent tabs.

          A second optional argument specifies indentation size:

          • 2 enforces 2 space indentation.
          • 4 enforces 4 space indentation.

          Indentation size is required for auto-fixing, but not for rule checking.

          NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

          Examples
          "indent": true,spaces
          "indent": true,spaces,4
          "indent": true,tabs,2
          Schema
          {
            "type": "array",
            "items": [
              {
                "type": "string",
                "enum": [
                  "tabs",
                  "spaces"
                ]
              },
              {
                "type": "number",
                "enum": [
                  2,
                  4
                ]
              }
            ],
            "minLength": 0,
            "maxLength": 5
          }

          For more information see this page.

          space indentation expected
          Open

                      handleGitlanceDataRequest(message, sendMessage);
          Severity: Minor
          Found in src/background/handler.ts by tslint

          Rule: indent

          Enforces indentation with tabs or spaces.

          Rationale

          Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

          Notes
          • Has Fix

          Config

          One of the following arguments must be provided:

          • spaces enforces consistent spaces.
          • tabs enforces consistent tabs.

          A second optional argument specifies indentation size:

          • 2 enforces 2 space indentation.
          • 4 enforces 4 space indentation.

          Indentation size is required for auto-fixing, but not for rule checking.

          NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

          Examples
          "indent": true,spaces
          "indent": true,spaces,4
          "indent": true,tabs,2
          Schema
          {
            "type": "array",
            "items": [
              {
                "type": "string",
                "enum": [
                  "tabs",
                  "spaces"
                ]
              },
              {
                "type": "number",
                "enum": [
                  2,
                  4
                ]
              }
            ],
            "minLength": 0,
            "maxLength": 5
          }

          For more information see this page.

          space indentation expected
          Open

                  return {
          Severity: Minor
          Found in src/background/utils/gitlance.ts by tslint

          Rule: indent

          Enforces indentation with tabs or spaces.

          Rationale

          Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

          Notes
          • Has Fix

          Config

          One of the following arguments must be provided:

          • spaces enforces consistent spaces.
          • tabs enforces consistent tabs.

          A second optional argument specifies indentation size:

          • 2 enforces 2 space indentation.
          • 4 enforces 4 space indentation.

          Indentation size is required for auto-fixing, but not for rule checking.

          NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

          Examples
          "indent": true,spaces
          "indent": true,spaces,4
          "indent": true,tabs,2
          Schema
          {
            "type": "array",
            "items": [
              {
                "type": "string",
                "enum": [
                  "tabs",
                  "spaces"
                ]
              },
              {
                "type": "number",
                "enum": [
                  2,
                  4
                ]
              }
            ],
            "minLength": 0,
            "maxLength": 5
          }

          For more information see this page.

          space indentation expected
          Open

              }
          Severity: Minor
          Found in src/background/utils/gitlance.ts by tslint

          Rule: indent

          Enforces indentation with tabs or spaces.

          Rationale

          Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

          Notes
          • Has Fix

          Config

          One of the following arguments must be provided:

          • spaces enforces consistent spaces.
          • tabs enforces consistent tabs.

          A second optional argument specifies indentation size:

          • 2 enforces 2 space indentation.
          • 4 enforces 4 space indentation.

          Indentation size is required for auto-fixing, but not for rule checking.

          NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

          Examples
          "indent": true,spaces
          "indent": true,spaces,4
          "indent": true,tabs,2
          Schema
          {
            "type": "array",
            "items": [
              {
                "type": "string",
                "enum": [
                  "tabs",
                  "spaces"
                ]
              },
              {
                "type": "number",
                "enum": [
                  2,
                  4
                ]
              }
            ],
            "minLength": 0,
            "maxLength": 5
          }

          For more information see this page.

          space indentation expected
          Open

              LOGIN_NOT_FOUND = 1,
          Severity: Minor
          Found in src/common/bi.schema.ts by tslint

          Rule: indent

          Enforces indentation with tabs or spaces.

          Rationale

          Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.

          Notes
          • Has Fix

          Config

          One of the following arguments must be provided:

          • spaces enforces consistent spaces.
          • tabs enforces consistent tabs.

          A second optional argument specifies indentation size:

          • 2 enforces 2 space indentation.
          • 4 enforces 4 space indentation.

          Indentation size is required for auto-fixing, but not for rule checking.

          NOTE: auto-fixing will only convert invalid indent whitespace to the desired type, it will not fix invalid whitespace sizes.

          Examples
          "indent": true,spaces
          "indent": true,spaces,4
          "indent": true,tabs,2
          Schema
          {
            "type": "array",
            "items": [
              {
                "type": "string",
                "enum": [
                  "tabs",
                  "spaces"
                ]
              },
              {
                "type": "number",
                "enum": [
                  2,
                  4
                ]
              }
            ],
            "minLength": 0,
            "maxLength": 5
          }

          For more information see this page.

          statements are not aligned
          Open

              t.true(response.ok, 'should have received OK response');

          Rule: align

          Enforces vertical alignment.

          Rationale

          Helps maintain a readable, consistent style in your codebase.

          Consistent alignment for code statements helps keep code readable and clear. Statements misaligned from the standard can be harder to read and understand.

          Notes
          • Has Fix

          Config

          Five arguments may be optionally provided:

          • "parameters" checks alignment of function parameters.
          • "arguments" checks alignment of function call arguments.
          • "statements" checks alignment of statements.
          • "members" checks alignment of members of classes, interfaces, type literal, object literals and object destructuring.
          • "elements" checks alignment of elements of array literals, array destructuring and tuple types.
          Examples
          "align": true,parameters,statements
          Schema
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "arguments",
                "elements",
                "members",
                "parameters",
                "statements"
              ]
            },
            "minLength": 1,
            "maxLength": 5
          }

          For more information see this page.

          This overload and the one on line 12 can be combined into one signature taking number | {}.
          Open

          export function render(element: {}): Node;
          Severity: Minor
          Found in src/content/utils/h.ts by tslint

          Rule: unified-signatures

          Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

          Notes
          • TypeScript Only

          Config

          Not configurable.

          Examples
          "unified-signatures": true

          For more information see this page.

          Severity
          Category
          Status
          Source
          Language