tsurupin/portfolio

View on GitHub

Showing 35 of 163 total issues

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

export default function (ComposedComponent) {
  class ProgressBar extends Component {
    constructor(props) {
      super(props);
      this.state = { loading: true };
Severity: Minor
Found in frontend/src/shared/containers/ProgressBar/index.js - About 1 hr to fix

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

      render() {
        const { editorState } = this.state;
    
        return (
          <div className={styles.root} onBlur={this.handleUpdate} >
    Severity: Minor
    Found in frontend/src/shared/components/textEditors/Editor/index.js - About 1 hr to fix

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

        render() {
          const { handleSubmit, submitting, fields: { email, password } }  = this.props;
          return(
            <form onSubmit={handleSubmit(this.handleSubmit)} className={styles.root}>
              <h2 className={styles.heading}>Sign In</h2>
      Severity: Minor
      Found in frontend/src/cms/containers/authors/SignIn/index.js - About 1 hr to fix

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

          constructor(props) {
            super(props);
        
            if (props.value) {
              const blocks = convertFromRaw(JSON.parse(props.value));
        Severity: Minor
        Found in frontend/src/shared/components/textEditors/Editor/index.js - About 1 hr to fix

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

            render() {
              if (this.props.loading) {
                return (
                  <section>
                    <Helmet title="Projects" />
          Severity: Minor
          Found in frontend/src/client/containers/projects/Index/index.js - About 1 hr to fix

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

              render() {
                const { handleSubmit, submitting, fields: { twitterId } } = this.props;
                return (
                  <div className={styles.root}>
                    <TextField
            Severity: Minor
            Found in frontend/src/cms/components/posts/forms/Item/Form/Twitter/index.js - About 1 hr to fix

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

              export const InlineStyleControls = (props) => {
                const currentStyle = props.editorState.getCurrentInlineStyle();
                return (
                  <div className={styles.root}>
                    {INLINE_STYLES.map(type =>

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

                export default function(ComposedComponent) {
                  
                  function mapStateToProps(state) {
                    return {
                      authenticated: state.auth.authenticated
                Severity: Minor
                Found in frontend/src/cms/containers/shared/Authentication/index.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

                Method save_from_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def save_from_associations(params)
                    ActiveRecord::Base.transaction do
                      delete_unnecessary_items!(params[ITEMS_ATTRIBUTES]) if id
                      delete_unnecessary_tags!(params[TAGGINGS_ATTRIBUTES]) if id
                
                
                Severity: Minor
                Found in app/models/post/form.rb - 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

                Method save_from_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def save_from_associations(params)
                    ActiveRecord::Base.transaction do
                      delete_unnecessary_tags!(params[TAGGINGS_ATTRIBUTES]) if id
                      trim_tagging_attributes!(params[TAGGINGS_ATTRIBUTES])
                      if params['image']&.start_with?('data')
                Severity: Minor
                Found in app/models/project/form.rb - 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

                Avoid too many return statements within this function.
                Open

                      return state;
                Severity: Major
                Found in frontend/src/shared/reducers/items.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return [
                            ...state.slice(0, action.payload.sortRank),
                            ...succItem,
                            ...subject,
                            ...state.slice(action.payload.sortRank + 2),
                  Severity: Major
                  Found in frontend/src/shared/reducers/items.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return [
                              ...state.slice(0, action.payload.sortRank),
                              ...state.slice(action.payload.sortRank + 1),
                              ...bottomItem,
                            ];
                    Severity: Major
                    Found in frontend/src/shared/reducers/items.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return state;
                      Severity: Major
                      Found in frontend/src/shared/reducers/items.js - About 30 mins to fix

                        Method show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def show
                            cache_name = "cached_posts/#{params[:id]}"
                            cache_name += "?#{params[:previewing]}" if params[:previewing]
                        
                            json = rails_cache(cache_name) do
                        Severity: Minor
                        Found in app/controllers/client/api/v1/posts_controller.rb - 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