ujh/fountainpencompanion

View on GitHub

Showing 82 of 377 total issues

Function CurrentlyInkedSummaryWidgetContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CurrentlyInkedSummaryWidgetContent = () => {
  const { data } = useContext(WidgetDataContext);
  const { active, total, usage_records } = data.attributes;
  return (
    <>
Severity: Minor
Found in app/javascript/src/dashboard/currently_inked_summary_widget.jsx - About 1 hr to fix

    Function CollectedInks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const CollectedInks = ({ archive }) => {
      const [inks, setInks] = useState();
    
      useEffect(() => {
        async function getCollectedInks() {
    Severity: Minor
    Found in app/javascript/src/collected_inks/CollectedInks.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 dist has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const dist = (macroClusterInks, microClusterInks) => {
      const calc1 = (c1, c2) =>
        minLev(c1.brand_name, c2.brand_name) +
        0.5 * minLev(c1.line_name, c2.line_name) +
        minLev(c1.ink_name, c2.ink_name);
    Severity: Minor
    Found in app/javascript/src/admin/micro-clusters/withDistance.js - About 1 hr to fix

      Function getMacroClusters has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function InksVisualizationWidgetContent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const InksVisualizationWidgetContent = () => {
          const { data } = useContext(WidgetDataContext);
          const [includeArchived, setIncludeArchived] = useState(false);
          const width = useContext(WidgetWidthContext);
          return (
        Severity: Minor
        Found in app/javascript/src/dashboard/inks_visualization_widget.jsx - About 1 hr to fix

          Method to_csv has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.to_csv
              CSV.generate(col_sep: ";") do |csv|
                csv << [
                  "Used On",
                  "Pen Brand",
          Severity: Minor
          Found in app/models/usage_record.rb - About 1 hr to fix

            Method to_csv has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.to_csv
                CSV.generate(col_sep: ";") do |csv|
                  csv << [
                    "Brand",
                    "Line",
            Severity: Minor
            Found in app/models/collected_ink.rb - About 1 hr to fix

              Function getMacroClusters has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function CurrentlyInked has 33 lines of code (exceeds 25 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

                  Function PenSuggestionWidgetContent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const PenSuggestionWidgetContent = () => {
                    const data = useContext(WidgetDataContext);
                    const pens = useMemo(() => scorePens(filterPens(data)), [data]);
                    const [pickedPen, setPickedPen] = useState();
                  
                  
                  Severity: Minor
                  Found in app/javascript/src/dashboard/pen_suggestion_widget.jsx - About 1 hr to fix

                    Function getMicroClusters has 32 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/pens-micro-clusters/microClusters.js - About 1 hr to fix

                      Function PenCard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const PenCard = (props) => {
                        const {
                          hiddenFields,
                          id,
                          brand,
                      Severity: Minor
                      Found in app/javascript/src/collected_pens/cards/PenCard.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 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 CollectedPens has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const CollectedPens = () => {
                          const [data, setData] = useState(null);
                          useEffect(() => {
                            fetch("/admins/graphs/collected-pens.json")
                              .then((res) => res.json())
                        Severity: Minor
                        Found in app/javascript/src/admin/graphs/CollectedPens.jsx - 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-micro-clusters/macroClusters.js - About 1 hr to fix

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

                            export const CollectedInks = () => {
                              const [data, setData] = useState(null);
                              useEffect(() => {
                                fetch("/admins/graphs/collected-inks.json")
                                  .then((res) => res.json())
                            Severity: Minor
                            Found in app/javascript/src/admin/graphs/CollectedInks.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 SignUps has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

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

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

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