ujh/fountainpencompanion

View on GitHub

Showing 92 of 413 total issues

Avoid too many return statements within this method.
Open

    return "bril" if name =~ /^bril/i
Severity: Major
Found in app/models/simplifier.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return "kwz" if name =~ /^kwz/i
    Severity: Major
    Found in app/models/simplifier.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return "pilot" if name =~ /iroshizuku/i
      Severity: Major
      Found in app/models/simplifier.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return "sbre" if name =~ /^sbre\s*(brown)?$/i
        Severity: Major
        Found in app/models/simplifier.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return "thorntons" if name =~ /^thornton/i
          Severity: Major
          Found in app/models/simplifier.rb - About 30 mins to fix

            Function PenAndInkSuggestionWidgetContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const PenAndInkSuggestionWidgetContent = () => {
              const { data } = useContext(WidgetDataContext);
              const { by_kind } = data.attributes;
              const [suggestion, setSuggestion] = useState();
              const [loading, setLoading] = useState();
            Severity: Minor
            Found in app/javascript/src/dashboard/pen_and_ink_suggestion_widget.jsx - 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

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

              def add_comment
                unless changed.any? { |c| %w[brand_name line_name ink_name].include?(c) }
                  return
                end
                return unless comment.blank?
            Severity: Minor
            Found in app/models/collected_ink.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

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

              def redirect_after_change
                if request.referrer.blank? || request.referrer =~ %r{/admins}
                  if InkReview.queued.exists?
                    redirect_to admins_reviews_path(page: params[:page])
                  else
            Severity: Minor
            Found in app/controllers/admins/reviews_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

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

              def index
                respond_to do |format|
                  format.json do
                    clusters =
                      Pens::ModelMicroCluster
            Severity: Minor
            Found in app/controllers/admins/pens/model_micro_clusters_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

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

              def index
                respond_to do |format|
                  format.json do
                    clusters =
                      MicroCluster
            Severity: Minor
            Found in app/controllers/admins/micro_clusters_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

            Function CurrentlyInkedTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const CurrentlyInkedTable = ({ currentlyInked, onLayoutChange }) => {
              const columns = useMemo(
                () => [
                  {
                    Header: "Pen",
            Severity: Minor
            Found in app/javascript/src/currently_inked/table/CurrentlyInkedTable.jsx - 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

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

              def privacy_link(collected_ink)
                return unless user_signed_in?
                return unless current_user.id == collected_ink.user_id
                if collected_ink.private?
                  link_to(
            Severity: Minor
            Found in app/helpers/collected_inks_helper.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