ujh/fountainpencompanion

View on GitHub

Showing 92 of 413 total issues

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

export const CurrentlyInked = () => {
  const [data, setData] = useState(null);
  useEffect(() => {
    fetch("/admins/graphs/currently-inked.json")
      .then((res) => res.json())
Severity: Minor
Found in app/javascript/src/admin/graphs/CurrentlyInked.jsx - About 1 hr to fix

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

      function run(page = 1) {
        loadMacroClusterPage(page).then((json) => {
          const pagination = json.meta.pagination;
          dispatch({
            type: SET_LOADING_PERCENTAGE,
    Severity: Minor
    Found in app/javascript/src/admin/micro-clusters/macroClusters.js - About 1 hr to fix

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

        function run(page = 1) {
          loadMacroClusterPage(page).then((json) => {
            const pagination = json.meta.pagination;
            dispatch({
              type: SET_LOADING_PERCENTAGE,
      Severity: Minor
      Found in app/javascript/src/admin/pens-micro-clusters/macroClusters.js - About 1 hr to fix

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

        export const createMacroClusterAndAssign = (
          values,
          microClusterId,
          dispatch,
          afterCreate
        Severity: Minor
        Found in app/javascript/src/admin/pens-model-micro-clusters/macroClusters.js - About 1 hr to fix

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

          export const BotSignUps = () => {
            const [data, setData] = useState(null);
            useEffect(() => {
              fetch("/admins/graphs/bot-signups.json")
                .then((res) => res.json())
          Severity: Minor
          Found in app/javascript/src/admin/graphs/BotSignUps.jsx - About 1 hr to fix

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

            export const createMacroClusterAndAssign = (
              values,
              microClusterId,
              dispatch,
              afterCreate

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

              export const CollectedPens = () => {
                const [pens, setPens] = useState();
              
                useEffect(() => {
                  async function getCollectedPens() {
              Severity: Minor
              Found in app/javascript/src/collected_pens/CollectedPens.jsx - 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

              Method perform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def perform(collected_ink_id, macro_cluster_id = nil)
                  collected_ink = CollectedInk.find(collected_ink_id)
                  cluster =
                    MicroCluster.find_or_create_by!(
                      simplified_brand_name: collected_ink.simplified_brand_name,
              Severity: Minor
              Found in app/workers/assign_micro_cluster.rb - 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 CurrentlyInked has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              export const CurrentlyInked = () => {
                const [currentlyInked, setCurrentlyInked] = useState();
              
                useEffect(() => {
                  async function getData() {
              Severity: Minor
              Found in app/javascript/src/currently_inked/CurrentlyInked.jsx - 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 run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function run(page = 1) {
                  loadMicroClusterPage(page).then((json) => {
                    const pagination = json.meta.pagination;
                    dispatch({
                      type: SET_LOADING_PERCENTAGE,
              Severity: Minor
              Found in app/javascript/src/admin/pens-model-micro-clusters/microClusters.js - About 1 hr to fix

                Function run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function run(page = 1) {
                    loadMicroClusterPage(page).then((json) => {
                      const pagination = json.meta.pagination;
                      dispatch({
                        type: SET_LOADING_PERCENTAGE,
                Severity: Minor
                Found in app/javascript/src/admin/pens-micro-clusters/microClusters.js - About 1 hr to fix

                  Function PensSummaryWidgetContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const PensSummaryWidgetContent = () => {
                    const { data } = useContext(WidgetDataContext);
                    const { count, archived } = data.attributes;
                    return (
                      <>
                  Severity: Minor
                  Found in app/javascript/src/dashboard/pens_summary_widget.jsx - About 1 hr to fix

                    Function tableData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      tableData() {
                        let ld = this.state.loggedInUserData;
                        let ud = this.state.userData;
                        let additionalData = ld.user_id && ld.user_id != ud.user_id;
                        if (additionalData) {
                    Severity: Minor
                    Found in app/javascript/src/public_inks/app.jsx - About 1 hr to fix

                      Function getMicroClusters has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const getMicroClusters = (dispatch) => {
                        const formatter = new Jsona();
                        let data = [];
                        function run(page = 1) {
                          loadMicroClusterPage(page).then((json) => {
                      Severity: Minor
                      Found in app/javascript/src/admin/micro-clusters/microClusters.js - About 1 hr to fix

                        Method pen_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def pen_data
                              CSV.generate do |csv|
                                csv << [
                                  "fountain pen name",
                                  "last usage",
                        Severity: Minor
                        Found in app/models/bots/pen_and_ink_suggestion.rb - About 1 hr to fix

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

                            inkConfig() {
                              return {
                                ...this.defaultConfig("ink_name"),
                                Cell: ({ value, original: { ink_id } }) => {
                                  return (
                          Severity: Minor
                          Found in app/javascript/src/public_inks/table.jsx - About 1 hr to fix

                            Method index has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def index
                                respond_to do |format|
                                  format.json do
                                    # FIXME: Adding an includes here breaks the serialization and does not include
                                    #        the collected pens anymore. This is due to the way the association is
                            Severity: Minor
                            Found in app/controllers/admins/pens/micro_clusters_controller.rb - About 1 hr to fix

                              Method simplify has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.simplify(name, too_short: false)
                                  without_no = name.gsub(/^no\s*\.\s*(\d+)/i, '\1')
                                  return $1 if without_no =~ /^#?(\d+)$/
                                  without_no = without_no.gsub(/^#(\d+)/, '\1') unless too_short
                                  without_initials = remove_initials(without_no)
                              Severity: Minor
                              Found in app/models/simplifier.rb - 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

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

                                def index
                                  respond_to do |format|
                                    format.json do
                                      # FIXME: Adding an includes here breaks the serialization and does not include
                                      #        the collected pens anymore. This is due to the way the association is
                              Severity: Minor
                              Found in app/controllers/admins/pens/micro_clusters_controller.rb - 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

                              Method fetch_videos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def fetch_videos
                                  Enumerator
                                    .new do |yielder|
                                      result = client.list_playlist_items("snippet", playlist_id: uploads_id)
                                      loop do
                              Severity: Minor
                              Found in app/lib/youtube.rb - 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

                              Severity
                              Category
                              Status
                              Source
                              Language