JamieMason/expect-more

View on GitHub

Showing 270 of 315 total issues

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

export const toHaveNumberWithinRangeMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, floor: number, ceiling: number) {
      const pass = isWithinRange(floor, ceiling, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-number-near.ts on lines 19..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 168.

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 toHaveNumberNearMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, otherNumber: number, epsilon: number) {
      const pass = isNear(otherNumber, epsilon, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-number-near.ts and 1 other location - About 6 hrs to fix
packages/expect-more-jasmine/src/to-have-number-within-range.ts on lines 19..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 168.

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

export const toHaveSameLengthAsMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: string | any[]) {
      const pass = isSameLengthAs(other, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-same-length-as.ts and 2 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-longer-than.ts on lines 19..35
packages/expect-more-jasmine/src/to-have-shorter-than.ts on lines 19..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 151.

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

export const toHaveLongerThanMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: string | any[]) {
      const pass = isLongerThan(other, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-longer-than.ts and 2 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-same-length-as.ts on lines 19..35
packages/expect-more-jasmine/src/to-have-shorter-than.ts on lines 19..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 151.

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

export const toHaveShorterThanMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: string | any[]) {
      const pass = isShorterThan(other, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-shorter-than.ts and 2 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-longer-than.ts on lines 19..35
packages/expect-more-jasmine/src/to-have-same-length-as.ts on lines 19..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 151.

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

export const toHaveArrayIncludingAnyOfMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, allowedValues: unknown[]) {
      const pass = isArrayIncludingAnyOf(allowedValues, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-including-all-of.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-array-including-only.ts on lines 19..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 148.

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

export const toHaveArrayIncludingAllOfMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, requiredValues: unknown[]) {
      const pass = isArrayIncludingAllOf(requiredValues, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-including-any-of.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-array-including-only.ts on lines 19..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 148.

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

export const toHaveArrayIncludingOnlyMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, allowedValues: unknown[]) {
      const pass = isArrayIncludingOnly(allowedValues, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-including-all-of.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-array-including-any-of.ts on lines 19..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 148.

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 toHaveDateAfterMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, otherDate: Date) {
      const pass = isAfter(otherDate, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-date-after.ts and 1 other location - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-date-before.ts on lines 19..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 148.

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 toHaveDateBeforeMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: Date) {
      const pass = isBefore(other, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-date-before.ts and 1 other location - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-date-after.ts on lines 19..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 148.

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

export const toHaveGreaterThanOrEqualToMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: number) {
      const pass = isGreaterThanOrEqualTo(other, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveDivisibleByMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: number) {
      const pass = isDivisibleBy(other, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-divisible-by.ts and 7 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveDateInMonthMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, index: number) {
      const pass = isDateInMonth(index, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-date-in-month.ts and 7 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveArrayOfSizeMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, size: number) {
      const pass = isArrayOfSize(size, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-array-of-size.ts and 7 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveLessThanOrEqualToMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: number) {
      const pass = isLessThanOrEqualTo(other, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveDateInYearMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, year: number) {
      const pass = isDateInYear(year, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-date-in-year.ts and 7 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-on-day-of-week.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveDateOnDayOfWeekMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, index: number) {
      const pass = isDateOnDayOfWeek(index, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-array-of-size.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-in-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-date-in-year.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-day-of-month.ts on lines 19..37
packages/expect-more-jasmine/src/to-have-divisible-by.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-greater-than-or-equal-to.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-less-than-or-equal-to.ts on lines 19..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 146.

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

export const toHaveDateOnOrBeforeMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: unknown) {
      const pass = isDateOnOrBefore(other, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-date-on-or-after.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-ending-with.ts on lines 19..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 146.

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

export const toHaveEndingWithMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, otherString: unknown) {
      const pass = endsWith(otherString, getIn(propPath.split('.'), value));
      const message = pass
Severity: Major
Found in packages/expect-more-jasmine/src/to-have-ending-with.ts and 2 other locations - About 5 hrs to fix
packages/expect-more-jasmine/src/to-have-date-on-or-after.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-date-on-or-before.ts on lines 19..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 146.

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

export const toHaveDateOnOrAfterMatcher: jasmine.CustomMatcherFactory = () => {
  return {
    compare(value: unknown, propPath: string, other: unknown) {
      const pass = isDateOnOrAfter(other, getIn(propPath.split('.'), value));
      const message = pass
packages/expect-more-jasmine/src/to-have-date-on-or-before.ts on lines 19..33
packages/expect-more-jasmine/src/to-have-ending-with.ts on lines 19..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 146.

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