ujh/fountainpencompanion

View on GitHub

Showing 401 of 401 total issues

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

  return matchSorter(rows, filterValue.replace(/\s+/gi, ""), {
    keys: [(row) => attrs.map((a) => row.values[a]).join("")]
  });
Severity: Major
Found in app/javascript/src/currently_inked/table/match.js and 1 other location - About 1 hr to fix
app/javascript/src/collected_pens/table/match.js on lines 22..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  return matchSorter(rows, filterValue.replace(/\s+/gi, ""), {
    keys: [(row) => attrs.map((a) => row.values[a]).join("")]
  });
Severity: Major
Found in app/javascript/src/collected_pens/table/match.js and 1 other location - About 1 hr to fix
app/javascript/src/currently_inked/table/match.js on lines 11..13

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      <Actions
        archive={archive}
        activeLayout="card"
        numberOfInks={data.length}
        onFilterChange={setMatchOn}
app/javascript/src/collected_inks/table/CollectedInksTable.jsx on lines 274..282

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    expect(fuzzyMatch(input, "3776")).toStrictEqual([
      {
        brand: "Platinum",
        model: "#3776 Century",
        nib: "F",
Severity: Major
Found in app/javascript/src/collected_pens/cards/match.spec.js and 1 other location - About 1 hr to fix
app/javascript/src/collected_pens/cards/match.spec.js on lines 66..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      <Actions
        archive={archive}
        activeLayout="table"
        numberOfInks={preGlobalFilteredRows.length}
        onFilterChange={setGlobalFilter}
app/javascript/src/collected_inks/cards/CollectedInksCards.jsx on lines 19..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    expect(fuzzyMatch(input, "amber")).toStrictEqual([
      {
        brand: "Pilot",
        model: "Custom 823",
        nib: "M",
Severity: Major
Found in app/javascript/src/collected_pens/cards/match.spec.js and 1 other location - About 1 hr to fix
app/javascript/src/collected_pens/cards/match.spec.js on lines 78..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

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

    export const ignoreCluster = ({ id }) =>
      putRequest(`/admins/micro_clusters/${id}.json`, {
        data: {
          type: "micro_cluster",
          attributes: { ignored: true }
    Severity: Major
    Found in app/javascript/src/admin/micro-clusters/ignoreCluster.jsx and 2 other locations - About 1 hr to fix
    app/javascript/src/admin/pens-micro-clusters/microClusters.js on lines 47..53
    app/javascript/src/admin/pens-model-micro-clusters/microClusters.js on lines 47..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export const ignoreCluster = ({ id }) =>
      putRequest(`/admins/pens/model_micro_clusters/${id}.json`, {
        data: {
          type: "pens_model_micro_cluster",
          attributes: { ignored: true }
    app/javascript/src/admin/micro-clusters/ignoreCluster.jsx on lines 3..9
    app/javascript/src/admin/pens-micro-clusters/microClusters.js on lines 47..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export const ignoreCluster = ({ id }) =>
      putRequest(`/admins/pens/micro_clusters/${id}.json`, {
        data: {
          type: "pens_micro_cluster",
          attributes: { ignored: true }
    app/javascript/src/admin/micro-clusters/ignoreCluster.jsx on lines 3..9
    app/javascript/src/admin/pens-model-micro-clusters/microClusters.js on lines 47..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

    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 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

    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

      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 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 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

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

                  const { queryByText } = render(
                    <Counter
                      data={{ bottle: 1, sample: 3, cartridge: 0, swab: 0 }}
                      field="cartridge"
                    />
              Severity: Major
              Found in app/javascript/src/collected_inks/table/Counter.spec.jsx and 1 other location - About 1 hr to fix
              app/javascript/src/collected_inks/table/Counter.spec.jsx on lines 8..13

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                    <Table
                      hiddenFields={hiddenFields}
                      getTableProps={getTableProps}
                      headerGroups={headerGroups}
                      getTableBodyProps={getTableBodyProps}
              app/javascript/src/admin/components/clustering/App.jsx on lines 60..68

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language