instacart/Snacks

View on GitHub

Showing 70 of 70 total issues

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

renderRightArrow = () => {
const { slideButtonStyles } = componentStyles
const { showRightArrow } = this.state
const {
styles: { RightArrow = {} },
Severity: Major
Found in src/components/ScrollTrack/ScrollTrack.js and 1 other location - About 7 hrs to fix
src/components/ScrollTrack/ScrollTrack.js on lines 380..403

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

renderLeftArrow = () => {
const { slideButtonStyles } = componentStyles
const { showLeftArrow } = this.state
const {
styles: { LeftArrow = {} },
Severity: Major
Found in src/components/ScrollTrack/ScrollTrack.js and 1 other location - About 7 hrs to fix
src/components/ScrollTrack/ScrollTrack.js on lines 355..378

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

componentWillReceiveProps(nextProps) {
if (nextProps.disabled && !this.props.disabled) {
this.setState({ isFocused: false })
}
 
 
Severity: Major
Found in src/components/Forms/MaskedTextField.js and 1 other location - About 2 hrs to fix
src/components/Forms/TextField.js on lines 144..152

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

componentWillReceiveProps(nextProps) {
if (nextProps.disabled && !this.props.disabled) {
this.setState({ isFocused: false })
}
 
 
Severity: Major
Found in src/components/Forms/TextField.js and 1 other location - About 2 hrs to fix
src/components/Forms/MaskedTextField.js on lines 183..191

ScrollTrack has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

@Radium
class ScrollTrack extends Component {
static equalWidthTrack = equalWidthTrack
 
static ScrollTrackPropTypes = ScrollTrackPropTypes
Severity: Minor
Found in src/components/ScrollTrack/ScrollTrack.js - About 2 hrs to fix

    Function getSnacksStyles has 116 lines of code (exceeds 75 allowed). Consider refactoring.
    Open

    const getSnacksStyles = props => {
    const { action, actionHover, primaryBackground } = props.snacksTheme.colors
    const actionActive = darken(actionHover, 3)
     
    const disabled = {
    Severity: Major
    Found in src/components/Buttons/Button.js - About 2 hrs to fix

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

      const propTypes = {
      trackProps: PropTypes.shape({
      isSliding: PropTypes.bool,
      showLeftArrow: PropTypes.bool,
      showRightArrow: PropTypes.bool,
      Severity: Major
      Found in src/components/ScrollTrack/ScrollTrackPropTypes.js and 1 other location - About 2 hrs to fix
      src/styles/themer/utils.js on lines 80..90

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

      export interface DateFieldProps
      extends Omit<
      React.ComponentPropsWithoutRef<typeof MaskedTextField>,
      'type' | 'mask' | 'maskHint' | 'getValue'
      >,
      Severity: Major
      Found in src/components/Forms/DateField.d.ts and 1 other location - About 2 hrs to fix
      src/components/Forms/PhoneNumberField.d.ts on lines 5..12

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

      export interface PhoneNumberFieldProps
      extends Omit<
      React.ComponentPropsWithoutRef<typeof MaskedTextField>,
      'type' | 'mask' | 'maskHint' | 'getValue'
      >,
      Severity: Major
      Found in src/components/Forms/PhoneNumberField.d.ts and 1 other location - About 2 hrs to fix
      src/components/Forms/DateField.d.ts on lines 5..12

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

      export const themePropTypes = PropTypes.shape({
      colors: PropTypes.shape({
      action: PropTypes.string,
      actionHover: PropTypes.string,
      primaryBackground: PropTypes.string,
      Severity: Major
      Found in src/styles/themer/utils.js and 1 other location - About 2 hrs to fix
      src/components/ScrollTrack/ScrollTrackPropTypes.js on lines 3..13

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

      render() {
      const { in: inProp, timeout, appear } = this.props
       
      return (
      <Transition in={inProp} appear={appear} timeout={timeout}>
      Severity: Major
      Found in src/components/Transitions/Grow.js and 2 other locations - About 2 hrs to fix
      src/components/Transitions/Fade.js on lines 104..111
      src/components/Transitions/Slide.js on lines 112..119

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

      render() {
      const { in: inProp, timeout, appear } = this.props
      return (
      <Transition in={inProp} appear={appear} timeout={timeout}>
      {this.renderChild}
      Severity: Major
      Found in src/components/Transitions/Slide.js and 2 other locations - About 2 hrs to fix
      src/components/Transitions/Fade.js on lines 104..111
      src/components/Transitions/Grow.js on lines 150..158

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

      render() {
      const { in: inProp, timeout, appear } = this.props
      return (
      <Transition in={inProp} appear={appear} timeout={timeout}>
      {this.renderChild}
      Severity: Major
      Found in src/components/Transitions/Fade.js and 2 other locations - About 2 hrs to fix
      src/components/Transitions/Grow.js on lines 150..158
      src/components/Transitions/Slide.js on lines 112..119

      Function withTheme has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function withTheme(options = {}) {
      // This allows us to maintain backwards compatibility with withTheme(Component)
      // while supporting withTheme(options)(Component)
      if (isValidElementType(options)) {
      return withTheme()(options)
      Severity: Minor
      Found in src/styles/themer/withTheme.js - About 2 hrs to fix

      Function render has 101 lines of code (exceeds 75 allowed). Consider refactoring.
      Open

      render() {
      const {
      floatingLabelText,
      defaultValue,
      disabled,
      Severity: Major
      Found in src/components/Forms/TextField.js - About 2 hrs to fix

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

        open() {
        const { onOpen } = this.props
        this.setState({ open: true }, () => {
        this.menu.focus()
        onOpen && onOpen()
        Severity: Major
        Found in src/components/Menus/DropdownMenu.js and 1 other location - About 1 hr to fix
        src/components/Menus/DropdownMenu.js on lines 163..169

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

        close() {
        const { onClose } = this.props
        this.setState({ open: false }, () => {
        this.menu.blur()
        onClose && onClose()
        Severity: Major
        Found in src/components/Menus/DropdownMenu.js and 1 other location - About 1 hr to fix
        src/components/Menus/DropdownMenu.js on lines 155..161

        Function render has 93 lines of code (exceeds 75 allowed). Consider refactoring.
        Open

        render() {
        const {
        mask,
        pipe,
        maskHint,
        Severity: Major
        Found in src/components/Forms/MaskedTextField.js - About 1 hr to fix

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

          module: {
          rules: [
          { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },
          {
          test: /\.svg/,
          Severity: Major
          Found in webpack.release.config.js and 1 other location - About 1 hr to fix
          webpack.config.js on lines 9..26

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

          module: {
          rules: [
          { test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },
          {
          test: /\.svg/,
          Severity: Major
          Found in webpack.config.js and 1 other location - About 1 hr to fix
          webpack.release.config.js on lines 7..24
          Severity
          Category
          Status
          Source
          Language