maxpou/gatsby-starter-morning-dew

View on GitHub

Showing 20 of 20 total issues

Function Footer has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Footer = () => {
  const { authorName, websiteHost, footerLinks } = useSiteMetadata()

  const FooterItem = ({ item }) => {
    if (item.url.startsWith('/')) {
Severity: Major
Found in src/components/Footer.js - About 3 hrs to fix

    Function SEO has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SEO = props => {
      const { isBlogPost, path = '', lang = 'en', datePublished } = props
      const {
        siteTitle,
        siteUrl,
    Severity: Major
    Found in src/components/SEO/index.js - About 2 hrs to fix

      Function PrevNextPost has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const PrevNextPost = props => {
        const { previous, next } = props
        const articles = [previous, next].filter(i => i).map(item => ({ node: item }))
        const { siteCover, defaultLang } = useSiteMetadata()
        const { fluid } = useSiteImages(siteCover)
      Severity: Minor
      Found in src/components/PrevNextPost.js - About 2 hrs to fix

        Function useSiteImages has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const useSiteImages = imageName => {
          const result = useStaticQuery(graphql`
            {
              allFile(filter: { sourceInstanceName: { eq: "images" } }) {
                edges {
        Severity: Minor
        Found in src/hooks/use-site-images.js - About 1 hr to fix

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

          const NotFoundPage = props => {
            const data = useStaticQuery(graphql`
              query {
                posts: allMdx(
                  sort: { fields: [frontmatter___date], order: DESC }
          Severity: Minor
          Found in src/pages/404.js - About 1 hr to fix

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

            const useSiteMetadata = () => {
              const result = useStaticQuery(graphql`
                {
                  site {
                    siteMetadata {
            Severity: Minor
            Found in src/hooks/use-site-config.js - About 1 hr to fix

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

                      <h2>
                        <PostTitleLink to={`/${slug}`}>
                          {defaultLang !== language && <Flag language={language} />}
                          {title}
                        </PostTitleLink>
              Severity: Major
              Found in src/components/PostsListItem.js and 1 other location - About 1 hr to fix
              src/components/RelatedPosts.js on lines 17..22

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

              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

                        <li key={slug}>
                          <StyledLink to={`/${slug}`}>
                            {defaultLang !== language && <Flag language={language} />}
                            {title}
                          </StyledLink>
              Severity: Major
              Found in src/components/RelatedPosts.js and 1 other location - About 1 hr to fix
              src/components/PostsListItem.js on lines 59..64

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

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

                render() {
                  const post = this.props.data.post
                  const { previous, next } = this.props.pageContext
              
                  return (
              Severity: Minor
              Found in src/templates/blog-post.js - About 1 hr to fix

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

                const BlogPostShareImage = props => {
                  const post = props.data.post
                  const { width, height } = props.pageContext
                  const heroImg = post.frontmatter.cover && post.frontmatter.cover.publicURL
                  const { siteCover, authorAvatar, headerTitle } = useSiteMetadata()
                Severity: Minor
                Found in src/templates/blog-post-share-image.js - About 1 hr to fix

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

                  const Header = () => {
                    const {
                      headerLinks,
                      siteTitle,
                      headerTitle,
                  Severity: Minor
                  Found in src/components/Header.js - About 1 hr to fix

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

                    const PostsListItem = props => {
                      const { title, excerpt, slug, language, tags, timeToRead } = props
                      const { defaultLang } = useSiteMetadata()
                    
                      return (
                    Severity: Minor
                    Found in src/components/PostsListItem.js - About 1 hr to fix

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

                              <Wrapper as="aside">
                                <Disqus slug={page.frontmatter.slug} title={page.frontmatter.title} />
                              </Wrapper>
                      Severity: Major
                      Found in src/templates/page.js and 1 other location - About 1 hr to fix
                      src/templates/blog-post.js on lines 40..42

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

                      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

                              <Wrapper as="aside">
                                <Disqus slug={post.frontmatter.slug} title={post.frontmatter.title} />
                              </Wrapper>
                      Severity: Major
                      Found in src/templates/blog-post.js and 1 other location - About 1 hr to fix
                      src/templates/page.js on lines 35..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 55.

                      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

                            <Hero
                              heroImg={page.frontmatter.cover && page.frontmatter.cover.publicURL}
                              title={page.frontmatter.title}
                            />
                      Severity: Minor
                      Found in src/templates/page.js and 1 other location - About 55 mins to fix
                      src/templates/blog-post.js on lines 31..34

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

                              <Hero
                                heroImg={post.frontmatter.cover && post.frontmatter.cover.publicURL}
                                title={post.frontmatter.title}
                              />
                      Severity: Minor
                      Found in src/templates/blog-post.js and 1 other location - About 55 mins to fix
                      src/templates/page.js on lines 23..26

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

                      const Square = styled.div`
                        width: ${props => props.width || 440}px;
                        height: ${props => props.height || 220}px;
                        position: absolute;
                        outline: 3px solid #fff !important;
                      Severity: Minor
                      Found in src/templates/blog-post-share-image.js and 1 other location - About 50 mins to fix
                      src/templates/blog-post-share-image.js on lines 20..30

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

                      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

                      const Wrapper = styled.div`
                        width: ${props => props.width || 440}px;
                        height: ${props => props.height || 220}px;
                        display: flex;
                        flex-direction: column;
                      Severity: Minor
                      Found in src/templates/blog-post-share-image.js and 1 other location - About 50 mins to fix
                      src/templates/blog-post-share-image.js on lines 32..38

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

                      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 DarkToggle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const DarkToggle = ({ isExpanded = false }) => {
                        const { colorMode, setColorMode } = React.useContext(ThemeContext)
                      
                        if (!colorMode) {
                          return null
                      Severity: Minor
                      Found in src/components/DarkToggle.js - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function SEO has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const SEO = props => {
                        const { isBlogPost, path = '', lang = 'en', datePublished } = props
                        const {
                          siteTitle,
                          siteUrl,
                      Severity: Minor
                      Found in src/components/SEO/index.js - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language