Showing 67 of 71 total issues

PnutRepositoryImpl has 55 functions (exceeds 20 allowed). Consider refactoring.
Open

export class PnutRepositoryImpl implements PnutRepository {
  constructor(private readonly axios: NuxtAxiosInstance) {}
  updateAvatar(file: File): Promise<PnutResponse<User>> {
    const fd = new FormData()
    fd.append('avatar', file)
Severity: Major
Found in src/plugins/infrastructure/repository/pnutRepositoryImpl.ts - About 7 hrs to fix

Function createCompose has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createCompose(composeOptions: ComposeOptions) {
  @Component
  class ComposeAbstract extends Mixins(textCount) {
    @Prop({
      type: String,
Severity: Major
Found in src/components/organisms/ComposeAbstract.ts - About 5 hrs to fix

File pnutRepositoryImpl.ts has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { NuxtAxiosInstance } from '@nuxtjs/axios'
import { PnutRepository } from '~/plugins/domain/repository/pnutRepository'
import { PnutResponse } from '~/entity/pnut-response'
import { Post } from '~/entity/post'
import {
Severity: Minor
Found in src/plugins/infrastructure/repository/pnutRepositoryImpl.ts - About 3 hrs to fix

Function createCompose has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export function createCompose(composeOptions: ComposeOptions) {
  @Component
  class ComposeAbstract extends Mixins(textCount) {
    @Prop({
      type: String,
Severity: Minor
Found in src/components/organisms/ComposeAbstract.ts - About 3 hrs 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

export const getters = getterTree(state, {
  user({ auth }): User | null {
    return auth?.user?.data?.user || null
  },
  storage({ auth }): Token.Storage {
Severity: Major
Found in src/store/index.ts and 1 other location - About 3 hrs to fix
src/store/index.ts on lines 42..54

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

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 const rawGetters: GetterTree<State, any> = {
  user({ auth }): User | null {
    return auth?.user?.data?.user || null
  },
  storage({ auth }): Token.Storage {
Severity: Major
Found in src/store/index.ts and 1 other location - About 3 hrs to fix
src/store/index.ts on lines 56..68

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

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

    getOlder: async () => {
      const { data, meta } = await createMore({
        getPnutResponse,
        meta: olderMeta,
        direction: Direction.Last,
Severity: Major
Found in src/plugins/domain/util/util.ts and 1 other location - About 3 hrs to fix
src/plugins/domain/util/util.ts on lines 56..68

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

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

    getNewer: async () => {
      const { data, meta } = await createMore({
        getPnutResponse,
        meta: newerMeta,
        direction: Direction.First,
Severity: Major
Found in src/plugins/domain/util/util.ts and 1 other location - About 3 hrs to fix
src/plugins/domain/util/util.ts on lines 69..81

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

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

export function getHtmlMeta(post?: Post) {
  if (!post || !post.user || !post.content) return
  const name = post.user.name
    ? `${post.user.name}(@${post.user.username})`
    : `@${post.user?.username}`
Severity: Major
Found in src/plugins/domain/util/postUtil.ts - About 2 hrs to fix

Function getDefaultSubscriptionIds has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async getDefaultSubscriptionIds(connection_id: string) {
    const subscribedChannelPromise = this.pnutRepository.getSubscribedChannels({
      connection_id,
      include_read: false,
    })
Severity: Major
Found in src/plugins/domain/usecases/createConnection.ts - About 2 hrs to fix

Function bind has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function bind(context: Context) {
  container
    .register(PnutRepository.token, {
      useValue: new PnutRepositoryImpl(context.$axios),
    })
Severity: Minor
Found in src/plugins/di/bind.ts - About 1 hr to fix

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

      case 'user':
        return {
          listInfo: await createListInfo((pagination) => {
            return this.pnutRepository.searchUsers({
              ...commonDefaultParams,
Severity: Major
Found in src/plugins/domain/usecases/search.ts and 1 other location - About 1 hr to fix
src/plugins/domain/usecases/search.ts on lines 58..69

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

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

      case 'post':
        return {
          listInfo: await createListInfo((pagination) => {
            return this.pnutRepository.searchPosts({
              ...commonDefaultParams,
Severity: Major
Found in src/plugins/domain/usecases/search.ts and 1 other location - About 1 hr to fix
src/plugins/domain/usecases/search.ts on lines 70..81

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

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

export function createSettingsMenu(): MenuItem[] {
  return [
    { type: 'heading', label: 'User' },
    {
      label: 'Profile',
Severity: Minor
Found in src/components/organisms/sidebar/Settings.ts - About 1 hr to fix

Function createListInfo has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function createListInfo<T>(
  getPnutResponse: GetPnutResponse<T>
): Promise<ListInfo<T>> {
  const { meta: initialMeta, data: initialData } = await getPnutResponse()
  const olderMeta = {
Severity: Minor
Found in src/plugins/domain/util/util.ts - About 1 hr to fix

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

    ok(id: string, arg: any): Promise<any> | void {
      if (!this.modals[id]) return
      return this.modals[id].ok(arg)
    },
Severity: Major
Found in src/plugins/modal/mediator.ts and 1 other location - About 1 hr to fix
src/plugins/modal/mediator.ts on lines 34..37

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

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

    cancel(id: string, arg: any): Promise<any> | void {
      if (!this.modals[id]) return
      return this.modals[id].cancel(arg)
    },
Severity: Major
Found in src/plugins/modal/mediator.ts and 1 other location - About 1 hr to fix
src/plugins/modal/mediator.ts on lines 30..33

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

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

  getUserPosts(
    userId: UserId,
    params?: GeneralPostParameters
  ): Promise<PnutResponse<Post[]>> {
    return this.get(`/users/${userId}/posts`, params)
Severity: Major
Found in src/plugins/infrastructure/repository/pnutRepositoryImpl.ts and 1 other location - About 1 hr to fix
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 349..354

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

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

  getExplore(
    slug: ExploreSlugType,
    params?: GeneralPostParameters
  ): Promise<PnutResponse<Post[]>> {
    return this.get(`/posts/streams/explore/${slug}`, params)
Severity: Major
Found in src/plugins/infrastructure/repository/pnutRepositoryImpl.ts and 1 other location - About 1 hr to fix
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 225..230

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

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

  getFollowers(
    userId: string,
    params?: GeneralUserParameters
  ): Promise<PnutResponse<User[]>> {
    return this.get(`/users/${userId}/followers`, params)
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 113..118
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 194..199
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 218..223
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 232..237
src/plugins/infrastructure/repository/pnutRepositoryImpl.ts on lines 342..347

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

Severity
Category
Status
Source
Language