maxpou/gatsby-starter-morning-dew

View on GitHub

Showing 12 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

              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

                      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