hummingbird-me/kitsu-web

View on GitHub

Showing 88 of 872 total issues

Function setHeadTags has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setHeadTags(model) {
    return [{
      type: 'meta',
      tagId: 'meta-description',
      attrs: {
Severity: Minor
Found in app/routes/groups/group.js - About 1 hr to fix

    Function _getSortingKey has 41 lines of code (exceeds 25 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

      Function createPost has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        createPost: task(function* (content, options) {
          const data = { content, user: get(this, 'session.account'), ...options };
          // posting on another user's profile
          if (get(this, 'user') !== undefined && get(this, 'user.id') !== get(this, 'session.account.id')) {
            set(data, 'targetUser', get(this, 'user'));
      Severity: Minor
      Found in app/components/stream-feed/list.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 _handleRealtime has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _handleRealtime(object) {
          // handle deletion
          (get(object, 'deleted') || []).forEach(activityId => {
            let activity = get(this, 'feed').findBy('id', activityId);
            if (activity) {
      Severity: Minor
      Found in app/components/stream-feed/list.js - About 1 hr to fix

        Function init has 36 lines of code (exceeds 25 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 1 hr to fix

          Function thumbSize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const thumbSize = (length, orientation, index) => {
            const max = 538;
            const margin = 4;
            if (orientation === 'square') {
              const box = (max - 4) / 2;
          Severity: Minor
          Found in app/components/stream-feed/items/post/uploads-grid.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 buildMessageTask has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildMessageTask: task(function* () {
              const targetType = get(this, 'item.target.modelType');
              const verb = get(this, 'item.verb');
              switch (targetType) {
                // ban, invite, permission
          Severity: Minor
          Found in app/components/groups/dashboard/audit-log-item.js - About 1 hr to fix

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

              initPlayer() {
                const containerId = get(this, 'elementId');
            
                // Initialize the HuluPlayer instance
                const options = {
            Severity: Minor
            Found in app/components/episodes/video-player/hulu-player.js - About 1 hr to fix

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

                _buildOptions(type) {
                  const options = {
                    page: { limit: 20 },
                    filter: {}
                  };
              Severity: Minor
              Found in app/components/explore/explore-more.js - About 1 hr to fix

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

                  _schemaData() {
                    const data = {
                      '@context': 'http://schema.org',
                      '@type': 'BreadcrumbList',
                      itemListElement: [{
                Severity: Minor
                Found in app/mixins/breadcrumbs.js - About 1 hr to fix

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

                    setHeadTags(model) {
                      const description = `${get(this, 'intl').t('head.users.description', { user: get(model, 'name') })} ${get(model, 'about')}`;
                      return [{
                        type: 'meta',
                        tagId: 'meta-description',
                  Severity: Minor
                  Found in app/routes/users.js - About 1 hr to fix

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

                      _getRequestOptions(params) {
                        const options = {
                          filter: {},
                          page: { offset: 0, limit: 20 },
                          fields: this._getFieldsets()
                    Severity: Minor
                    Found in app/routes/media/index.js - About 1 hr to fix

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

                        _handleRealtime(object) {
                          // new activities
                          if (isPresent(get(object, 'new'))) {
                            get(this, 'getNotifications').perform(get(object, 'new.length')).then(groups => {
                              // remove duplicate records
                      Severity: Minor
                      Found in app/components/application/user-notifications.js - About 1 hr to fix

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

                          _getRequestOptions({ media, status, sort, title }) {
                            const user = this.modelFor('users');
                            const options = {
                              include: `${media},user,mediaReaction`,
                              filter: {
                        Severity: Minor
                        Found in app/routes/users/library.js - About 1 hr to fix

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

                            groupByTimeAll: computed('group.activities.@each.isDeleted', function() {
                              const temp = {};
                              const activities = get(this, 'group.activities').toArray().sort((a, b) => {
                                if (get(a, 'time').isBefore(get(b, 'time'))) {
                                  return 1;
                          Severity: Minor
                          Found in app/components/stream-feed/items/library-entry.js - About 1 hr to fix

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

                              resetPassword: task(function* () {
                                // get the current user based off the token supplied as a query param
                                let user = yield get(this, 'ajax').request('/users?filter[self]=true', {
                                  headers: {
                                    Authorization: `Bearer ${get(this, 'usableToken')}`
                            Severity: Minor
                            Found in app/controllers/password-reset.js - About 1 hr to fix

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

                                activate() {
                                  this._super(...arguments);
                                  this._handleScroll = () => { this.handleScroll(); };
                              
                                  document.body.classList.add('cover-page');
                              Severity: Minor
                              Found in app/mixins/routes/cover-page.js - About 1 hr to fix

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

                                  uploadImagesTask: 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/create-post.js - About 1 hr to fix

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

                                    createAccount: task(function* () {
                                      const user = get(this, 'user');
                                      yield user.save()
                                        .then(() => {
                                          const { email: identification, password } = getProperties(user, 'email', 'password');
                                  Severity: Minor
                                  Found in app/components/application/auth-onboarding/sign-up.js - About 1 hr to fix

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

                                      beforeModel({ queryParams }) {
                                        const { token } = queryParams;
                                        return new RSVP.Promise((resolve, reject) => {
                                          get(this, 'ajax').request('/users?filter[self]=true', {
                                            headers: { Authorization: `Bearer ${token}` }
                                    Severity: Minor
                                    Found in app/routes/confirm-email.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language