Workfront/workfront-api

View on GitHub

Showing 63 of 63 total issues

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

                        if (r == '^')
                            return (
                                e.backup(),
                                e.width() > 0 && e.emit(t.QueryLexer.TERM),
                                t.QueryLexer.lexBoost
Severity: Major
Found in docs/assets/main.js and 1 other location - About 1 hr to fix
docs/assets/main.js on lines 1363..1368

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

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

    request(
        path: string,
        params,
        fields: TFields = [],
        method: string = Api.Methods.GET
Severity: Minor
Found in src/Api.ts - About 1 hr to fix

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

                    (t.QueryParser.parseBoost = function (e) {
                        var r = e.consumeLexeme()
                        if (r != null) {
                            var n = parseInt(r.str, 10)
                            if (isNaN(n)) {
    Severity: Minor
    Found in docs/assets/main.js - About 1 hr to fix

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

                      (t.QueryParser.parseEditDistance = function (e) {
                          var r = e.consumeLexeme()
                          if (r != null) {
                              var n = parseInt(r.str, 10)
                              if (isNaN(n)) {
      Severity: Minor
      Found in docs/assets/main.js - About 1 hr to fix

        Function parsePresence has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        (t.QueryParser.parsePresence = function (e) {
                            var r = e.consumeLexeme()
                            if (r != null) {
                                switch (r.str) {
                                    case '-':
        Severity: Minor
        Found in docs/assets/main.js - About 1 hr to fix

          Function Oe has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Oe(t, e, r, n) {
                  r.addEventListener(
                      'input',
                      ie(() => {
                          Re(t, e, r, n)
          Severity: Minor
          Found in docs/assets/main.js - About 1 hr to fix

            Function batch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                batch(
                    uriCollector: (batchApi: IBatchApi) => string[],
                    isAtomic?: boolean,
                    isConcurrent?: boolean
                ): Promise<any[] | void> {
            Severity: Minor
            Found in src/Api.ts - About 1 hr to fix

              Function de has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function de() {
                      let t = document.getElementById('tsd-search')
                      if (!t) return
                      let e = document.getElementById('tsd-search-script')
                      t.classList.add('loading'),
              Severity: Minor
              Found in docs/assets/main.js - About 1 hr to fix

                Function getApiKey has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getApiKey(username: string, password: string, subdomain?: string): Promise<string> {
                        const loginParams = {
                            username,
                            password,
                        }
                Severity: Minor
                Found in src/Api.ts - About 1 hr to fix

                  Function success has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      success: (response) => {
                          if (response.ok) {
                              return response.json().then((data) => {
                                  if (data.error) {
                                      throw {
                  Severity: Minor
                  Found in src/Api.ts - About 1 hr to fix

                    Function request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        request(
                            path: string,
                            params,
                            fields: TFields = [],
                            method: string = Api.Methods.GET
                    Severity: Minor
                    Found in src/Api.ts - 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

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (
                                                            (i[p].upsert(_, u.boost, function (Ee, be) {
                                                                return Ee + be
                                                            }),
                                                            !s[j])
                    Severity: Major
                    Found in docs/assets/main.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                          if (
                                                              (u.presence == t.Query.presence.REQUIRED &&
                                                                  ((m = m.union(q)),
                                                                  o[p] === void 0 && (o[p] = t.Set.complete)),
                                                              u.presence == t.Query.presence.PROHIBITED)
                      Severity: Major
                      Found in docs/assets/main.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                            for (var l = 0; l < a.length; l++) s.push(a[l])
                        Severity: Major
                        Found in docs/assets/main.js - About 45 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if ((e && typeof e == 'object') || typeof e == 'function')
                                      for (let i of Te(e))
                                          !Qe.call(t, i) &&
                                              i !== r &&
                                              re(t, i, {get: () => e[i], enumerable: !(n = we(e, i)) || n.enumerable})
                          Severity: Major
                          Found in docs/assets/main.js - About 40 mins to fix

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

                                constructor(config: IApiConfig) {
                                    this.serverAcceptsJSON = true
                                    this._uriGenerationMode = false
                                    this._httpOptions = {
                                        url: config.url,
                            Severity: Minor
                            Found in src/Api.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

                                                    ;(req2 as Promise<any>).then((generateApiKeyData) => {
                                                        this._httpOptions.headers.apiKey = generateApiKeyData.result
                                                        resolve(this._httpOptions.headers.apiKey)
                                                    }, reject)
                            Severity: Minor
                            Found in src/Api.ts and 1 other location - About 30 mins to fix
                            src/Api.ts on lines 128..131

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

                            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

                                            (e.addEventListener('error', () => {
                                                t.classList.remove('loading'), t.classList.add('failure')
                                            }),
                            Severity: Minor
                            Found in docs/assets/main.js and 1 other location - About 30 mins to fix
                            docs/assets/main.js on lines 1668..1670

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

                            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

                                            e.addEventListener('load', () => {
                                                t.classList.remove('loading'), t.classList.add('ready')
                                            }),
                            Severity: Minor
                            Found in docs/assets/main.js and 1 other location - About 30 mins to fix
                            docs/assets/main.js on lines 1665..1667

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

                            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

                                                } else {
                                                    this._httpOptions.headers.apiKey = getApiKeyData.result
                                                    resolve(this._httpOptions.headers.apiKey)
                                                }
                            Severity: Minor
                            Found in src/Api.ts and 1 other location - About 30 mins to fix
                            src/Api.ts on lines 124..127

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language