Shramkoweb/Portfolio

View on GitHub

Showing 89 of 89 total issues

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

  {
    data: {
      slug: 'first-article',
      description: 'First article description',
      featured: true,
Severity: Major
Found in __tests__/blog.test.tsx and 1 other location - About 1 hr to fix
__tests__/blog.test.tsx on lines 26..40

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

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

  {
    data: {
      slug: 'second-article',
      description: 'Second article description',
      featured: false,
Severity: Major
Found in __tests__/blog.test.tsx and 1 other location - About 1 hr to fix
__tests__/blog.test.tsx on lines 11..25

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

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

export async function getPostBySlug(slug?: string): Promise<Post> {
  if (!slug) {
    throw new Error('getPostBySlug: slug is required');
  }

Severity: Minor
Found in lib/posts/api.ts - About 1 hr to fix

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

            <div className="w-full mb-8 flex">
              <Image
                className="rounded-lg"
                alt="Serhii Shramko with the camera in his hands. Black and white photo."
                src={about}
    Severity: Major
    Found in pages/about.tsx and 1 other location - About 1 hr to fix
    pages/gear.tsx on lines 34..44

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

    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

            <div className="w-full mb-8 flex">
              <Image
                className="rounded-lg"
                alt="Serhii Shramko is sitting at a table on front of a computer and coding"
                src={gear}
    Severity: Major
    Found in pages/gear.tsx and 1 other location - About 1 hr to fix
    pages/about.tsx on lines 37..47

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

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

    export default async function handler(
      req: NextApiRequest,
      res: NextApiResponse,
    ) {
      try {
    Severity: Minor
    Found in pages/api/views/[slug].ts - About 1 hr to fix

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

      export function Header() {
        return (
          <header className="flex flex-col justify-center px-8" role="banner">
            <nav role="navigation" className="relative mx-auto flex w-full max-w-3xl items-center justify-between border-gray-200 bg-gray-50 bg-opacity-60 pt-8 pb-8 text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 sm:pb-16">
              <a href="#skip" className="skip-nav">
      Severity: Minor
      Found in components/header/header.tsx - About 1 hr to fix

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

        function NotFoundPage() {
          useEffect(() => {
            // TODO refactor to some ErrorProvider
            Sentry.captureException(new Error('404'));
          }, []);
        Severity: Minor
        Found in pages/404.tsx - About 1 hr to fix

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

          export function DashboardCard(props: DashboardCardProps) {
            const { header, link, metric } = props;
          
            return (
              <a className="flex max-w-72" target="_blank" rel="noopener" href={link} aria-label={header}>
          Severity: Minor
          Found in components/dashboard-card/dashboard-card.tsx - About 1 hr to fix

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

            function CustomLink(
              props: JSX.IntrinsicAttributes &
              ClassAttributes<HTMLAnchorElement> &
              AnchorHTMLAttributes<HTMLAnchorElement>,
            ) {
            Severity: Minor
            Found in components/mdx-components/index.tsx - About 1 hr to fix

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

              export async function getSnippetBySlug(slug?: string): Promise<Snippet> {
                if (!slug) {
                  throw new Error('getPostBySlug: slug is required');
                }
              
              
              Severity: Minor
              Found in lib/snippets/api.ts - About 1 hr to fix

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

                            <p className="text-gray-700 dark:text-gray-300">
                              Serhii Shramko /
                              <time dateTime={new Date(createDate).toISOString()}>
                                {' '}
                                {formattedDate}
                Severity: Major
                Found in pages/snippets/[slug].tsx and 1 other location - About 1 hr to fix
                pages/blog/[slug].tsx on lines 147..153

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

                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

                              <p className="ml-2 text-sm text-gray-700 dark:text-gray-300">
                                Serhii Shramko /
                                <time dateTime={new Date(createDate).toISOString()}>
                                  {' '}
                                  {formattedDate}
                Severity: Major
                Found in pages/blog/[slug].tsx and 1 other location - About 1 hr to fix
                pages/snippets/[slug].tsx on lines 93..99

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

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

                export default async function handler(
                  req: NextApiRequest,
                  res: NextApiResponse,
                ) {
                  try {
                Severity: Minor
                Found in pages/api/github.ts - About 1 hr to fix

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

                  export function FacebookShare() {
                    const handleClick = () => {
                      window.open(
                        `https://www.facebook.com/sharer/sharer.php?u=${window.location.href}&src=sdkpreparse`,
                        'facebook-share-dialog',
                  Severity: Minor
                  Found in components/share-button/facebook-share.tsx - About 1 hr to fix

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

                    export function Categories(props: CategoriesProps) {
                      const { categories } = props;
                    
                      return (
                        <ul className="flex flex-wrap gap-2 text-gray-600 dark:text-gray-400">
                    Severity: Minor
                    Found in components/categories/categories.tsx - About 1 hr to fix

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

                      export function MenuIcon(props: IconProps) {
                        const { dataHide } = props;
                        return (
                          <svg
                            className="h-5 w-5 absolute text-gray-900 dark:text-gray-100"
                      Severity: Minor
                      Found in components/mobile-menu/icons.tsx - About 1 hr to fix

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

                                  <em className="text-gray-300 text-xs">
                                    <time dateTime="2019-04">April 2019</time>
                                    &ensp;–&ensp;
                                    <time dateTime="2020-11">November 2020</time>
                                  </em>
                        Severity: Major
                        Found in pages/about.tsx and 5 other locations - About 55 mins to fix
                        pages/about.tsx on lines 176..180
                        pages/about.tsx on lines 285..289
                        pages/about.tsx on lines 334..338
                        pages/about.tsx on lines 356..360
                        pages/index.tsx on lines 81..89

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

                        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

                                    <p className="text-gray-600 dark:text-gray-400">
                                      I am an experienced software engineer with extensive knowledge of
                                      front-end development, with laser-focus on &ensp;
                                      <abbr title="A JavaScript library for building user interfaces">
                                        React
                        Severity: Major
                        Found in pages/index.tsx and 5 other locations - About 55 mins to fix
                        pages/about.tsx on lines 176..180
                        pages/about.tsx on lines 238..242
                        pages/about.tsx on lines 285..289
                        pages/about.tsx on lines 334..338
                        pages/about.tsx on lines 356..360

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

                        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

                                  <em className="text-gray-300 text-xs">
                                    <time dateTime="2018-12">December 2018</time>
                                    &ensp;–&ensp;
                                    <time dateTime="2019-03">March 2019</time>
                                  </em>
                        Severity: Major
                        Found in pages/about.tsx and 5 other locations - About 55 mins to fix
                        pages/about.tsx on lines 176..180
                        pages/about.tsx on lines 238..242
                        pages/about.tsx on lines 334..338
                        pages/about.tsx on lines 356..360
                        pages/index.tsx on lines 81..89

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

                        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