hummingbird-me/kitsu-web

View on GitHub

Showing 88 of 872 total issues

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

  _getSortingKey(sort) {
    const controller = this.controllerFor(get(this, 'routeName'));
    const mediaType = get(controller, 'media');
    let sortKey;

Severity: Minor
Found in app/routes/users/library.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 uploadImageTask has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  uploadImageTask: task(function* (file) {
    const { access_token: accessToken } = get(this, 'session.data.authenticated');
    const headers = {
      accept: 'application/vnd.api+json',
      authorization: `Bearer ${accessToken}`
Severity: Minor
Found in app/components/stream-feed/items/post/comment-box.js - About 1 hr to fix

    Function momentLocale has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function momentLocale(localeInput = 'en') {
      let locale = localeInput;
      // Fix for Acadian not having a unique language code
      if (locale === 'mis-ca') locale = 'fr-ca';
    
    
    Severity: Minor
    Found in app/utils/languages-moment.js - About 1 hr to fix

      Function injectBrowser has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function injectBrowser(src) {
        return new RSVP.Promise((resolve, reject) => {
          // script has been loaded in the past or is currently loading
          if (_scriptsLoaded[src]) {
            return resolve();
      Severity: Minor
      Found in app/utils/inject-script.js - About 1 hr to fix

        Function didReceiveAttrs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          didReceiveAttrs() {
            this._super(...arguments);
            scheduleOnce('afterRender', () => {
              get(this, 'headTags').collectHeadTags();
            });
        Severity: Minor
        Found in app/components/stream-feed/list.js - About 1 hr to fix

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

            postMessageTask: task(function* () {
              const content = get(this, 'replyContent');
              if (isEmpty(content)) { return; }
          
              // if the ticket is new then save that first
          Severity: Minor
          Found in app/components/groups/tickets/ticket-conversation.js - About 1 hr to fix

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

            function _defineRoutes(server) {
              server.passthrough('/write-coverage');
            
              // authentication
              server.post('/api/oauth/token', { access_token: 'it is a secret, shh' });
            Severity: Minor
            Found in mirage/config.js - About 1 hr to fix

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

              export function getTitleField(preference, titleLocales = {}, userLocale) {
                switch (preference) {
                  case 'english':
                  case 'localized':
                    if (userLocale in titleLocales) return userLocale;
              Severity: Minor
              Found in app/utils/get-title-field.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 didReceiveAttrs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                didReceiveAttrs() {
                  this._super(...arguments);
                  scheduleOnce('afterRender', () => {
                    get(this, 'headTags').collectHeadTags();
                  });
              Severity: Minor
              Found in app/components/stream-feed/list.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 title has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                title(tokens) {
                  const base = 'Kitsu';
                  // If the route hasn't defined a `titleToken` then try to grab the route
                  // name from the `titles` table in translations.
                  const hasTokens = tokens && tokens.length > 0;
              Severity: Minor
              Found in app/routes/application.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 init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                init() {
                  this._super(...arguments);
                  set(this, 'replies', []);
                  set(this, 'galleryItems', []);
                  if (get(this, 'isTopLevel') === true && get(this, 'comment.repliesCount') > 0) {
              Severity: Minor
              Found in app/components/stream-feed/items/post/comment.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 _searchEventListener has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                _searchEventListener(event) {
                  if (this.isDestroyed) return;
                  const target = get(event, 'target');
                  const id = `#${get(this, 'elementId')}`;
                  const isChild = matches(target, `${id} *, ${id}`);
              Severity: Minor
              Found in app/components/application/nav-search.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 errorMessages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function errorMessages(obj) {
                const defaultMessage = 'There was an issue with your request, please try again.';
                let reason = defaultMessage;
                if (obj === undefined) {
                  return reason;
              Severity: Minor
              Found in app/utils/error-messages.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 avgOrientation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              const avgOrientation = (uploads, length) => {
                if (length === 5) {
                  return 'landscape';
                }
                let o = 1;
              Severity: Minor
              Found in app/components/stream-feed/items/post/uploads-grid.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 _getFieldsets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _getFieldsets(type) {
                  const fields = {
                    libraryEntries: ['progress', 'status', 'rating', 'unit', 'reconsumeCount', 'private',
                      'startedAt', 'finishedAt', 'notes', 'updatedAt']
                  };
              Severity: Minor
              Found in app/components/dashboard/quick-update.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

              Avoid too many return statements within this function.
              Open

                      return '';
              Severity: Major
              Found in app/components/groups/dashboard/audit-log-item.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return hrefTo(this, 'media-reactions', id, queryParams);
                Severity: Major
                Found in app/components/application/user-notifications/item.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return '#';
                  Severity: Major
                  Found in app/components/application/user-notifications/item.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return hrefTo(this, `${type}.show.${unitType}.show`, get(actor, 'slug'), get(subject, 'number'), queryParams);
                    Severity: Major
                    Found in app/components/application/user-notifications/item.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return 'en_jp';
                      Severity: Major
                      Found in app/utils/get-title-field.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language