Restuta/rcn.io

View on GitHub

Showing 82 of 1,769 total issues

Function createEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createEvent = rawEvent => {
  const name = rawEvent.name.replace(/--/g, '—')
  const date = moment(rawEvent.date, 'MMMM DD YYYY')
  const datePlain = date.format('MMDDYYYY')

Severity: Minor
Found in src/client/temp/events.js - About 1 hr to fix

Function transformEvents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    .map(event => {
      if (!event['Race Name'] || !event['Race Name'].trim()) {
        return null
      }

Severity: Minor
Found in src/client/temp/fetch-ncnca-draft-events-2017.js - About 1 hr to fix

Function EventName has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventName = (props) => {
  const {
    name,
    size,
    height,
Severity: Minor
Found in src/client/calendar/events/EventName.jsx - About 1 hr to fix

Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const listStyle = { color: Colors.deepPurple200, }
    const inactiveStyle = { color: Colors.deepPurple300, }
    const activeStyle = {
      color: Colors.deepPurple600,
Severity: Minor
Found in src/client/admin/AdminRoot.js - About 1 hr to fix

Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    return (
      <div className="Home">
        <h2 className="header-regular w-300 text-5 header-rcn">RCN.IO</h2>
        <section className="section-main">
Severity: Minor
Found in src/client/Home.js - About 1 hr to fix

Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      name,
      color = '',
      size,
Severity: Minor
Found in src/client/atoms/Icon.jsx - About 1 hr to fix

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

  render() {
    const { permitNumber } = this.state
    const fileName = (permitNumber === DEFAULT_PERMIT_NAME) ? '' : `flyer-${permitNumber}.pdf`


Severity: Minor
Found in src/client/admin/events/UploadFlyer.jsx - About 1 hr to fix

Function parseRoadType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const parseRoadType = lowerCaseName => {
  const nameContains = partialRight(contains, [lowerCaseName])

  if (nameContains('road race')) {
    return EventTypes.road.roadRace
Severity: Minor
Found in src/server/events/usac/events-converter/parsers/type.js - About 1 hr 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 parseCollegiate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const parseCollegiate = lowerCaseName => {
  const nameContains = partialRight(contains, [lowerCaseName])

  if (nameContains('road race')) {
    return EventTypes.collegiate.roadRace
Severity: Minor
Found in src/server/events/usac/events-converter/parsers/type.js - About 1 hr 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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    //skip first render to get required dom property
    if (!this.state || !this.state.viewportHeight) {
      return null
    }
Severity: Minor
Found in src/client/temp/debug/BaselineGrid.jsx - About 1 hr to fix

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

const parseLocation = rawLocation => {
  const detailedLocation = rawLocation.detailed

  let streetAddress = ''
  let city = ''
Severity: Minor
Found in src/server/events/usac/events-converter/parsers/location.js - About 1 hr to fix

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

  render() {
    const { event } = this.props

    return (
      <div className="EventPreview">
Severity: Minor
Found in src/client/admin/events/EventPreview.jsx - About 1 hr to fix

Function updateRegLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const updateRegLinks = previousEvents => justConvertedEvents => {
  const previousEventsByPermit = groupBy('usacPermit', previousEvents)
  const getRegistrationUrl = (usacStatus, newRegUrl, prevRegUrl) => {
    if (usacStatus === 'Complete' && newRegUrl === '') {
      return prevRegUrl
Severity: Minor
Found in src/server/events/usac/events-converter/index.js - About 55 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 getBaseHeight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const getBaseHeight = containerWidth => {
  //for small containers there is no constant size we can compare to
  if (containerWidth < Grid.ContainerWidth.SM) {
    return 2
  }
Severity: Minor
Found in src/client/calendar/events/Event.jsx - About 45 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

Avoid deeply nested control flow statements.
Open

            if (source.hasOwnProperty(nextKey)) {
              output[nextKey] = source[nextKey];
            }
Severity: Major
Found in src/client/utils/polyfills.js - About 45 mins to fix

Function getContainerWidth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  getContainerWidth(browserWidth) {
    //should match variables from bootstrap


    if (browserWidth <= ContainerWidth.SM) {
Severity: Minor
Found in src/client/styles/grid.js - About 45 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { location = {city: '', state: ''}, size, showState = false } = this.props
    const { city, state } = location

    let addressToShow = showState ? `${city}, ${state}` : city
Severity: Minor
Found in src/client/calendar/events/Location.jsx - About 35 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 getUpcomingEvents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const getUpcomingEvents = (upcomingEvents, noOfUpcomingDays) => {
  let upcomingEventsForCurrentDay = []
  let currDate

  let upcomingEventsArr = []
Severity: Minor
Found in src/client/widgets/events/UpcomingEvents.jsx - About 35 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 @@router/LOCATION_CHANGE has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  ['@@router/LOCATION_CHANGE']: (state, action) => {
    const locationState = action.payload.state

    // splitting on sub-actions
    if (locationState && locationState.subActionName) {
Severity: Minor
Found in src/shared/reducers/reducer.js - About 35 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 formatValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const formatValue = value => {
  const dateFormat = 'MMMM DD YYYY'

  if (isString(value)) {
    const date = moment(value, dateFormat)
Severity: Minor
Found in src/client/admin/events/event-template.js - About 35 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