Showing 12 of 20 total issues
Function Footer
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Footer = () => {
const { authorName, websiteHost, footerLinks } = useSiteMetadata()
const FooterItem = ({ item }) => {
if (item.url.startsWith('/')) {
Function SEO
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SEO = props => {
const { isBlogPost, path = '', lang = 'en', datePublished } = props
const {
siteTitle,
siteUrl,
Function PrevNextPost
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function useSiteImages
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useSiteImages = imageName => {
const result = useStaticQuery(graphql`
{
allFile(filter: { sourceInstanceName: { eq: "images" } }) {
edges {
Function NotFoundPage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const NotFoundPage = props => {
const data = useStaticQuery(graphql`
query {
posts: allMdx(
sort: { fields: [frontmatter___date], order: DESC }
Function useSiteMetadata
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const useSiteMetadata = () => {
const result = useStaticQuery(graphql`
{
site {
siteMetadata {
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const post = this.props.data.post
const { previous, next } = this.props.pageContext
return (
Function BlogPostShareImage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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()
Function Header
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Header = () => {
const {
headerLinks,
siteTitle,
headerTitle,
Function PostsListItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PostsListItem = props => {
const { title, excerpt, slug, language, tags, timeToRead } = props
const { defaultLang } = useSiteMetadata()
return (
Function DarkToggle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
const DarkToggle = ({ isExpanded = false }) => {
const { colorMode, setColorMode } = React.useContext(ThemeContext)
if (!colorMode) {
return null
- Read upRead up
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
Open
const SEO = props => {
const { isBlogPost, path = '', lang = 'en', datePublished } = props
const {
siteTitle,
siteUrl,
- Read upRead up
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"