<commit_before>defmodule Credo.Check.Design.DuplicatedCode do
  @moduledoc """
  Code should not be copy-pasted in a codebase when there is room to abstract
  the copied functionality in a meaningful way.

  That said, you should by no means "ABSTRACT ALL THE THINGS!".

  Sometimes it can serve a purpose to have code be explicit in two places, even
  if it means the snippets are nearly identical. A good example for this are
  Database Adapters in a project like Ecto, where you might have nearly
  identical functions for things like `order_by` or `limit` in both the
  Postgres and MySQL adapters.

  In this case, introducing an `AbstractAdapter` just to avoid code duplication
  might cause more trouble down the line than having a bit of duplicated code.

  Like all `Software Design` issues, this is just advice and might not be
  applicable to your project/situation.
  """

  @explanation [
    check: @moduledoc,
    params: [
      mass_threshold:
        "The minimum mass which a part of code has to have to qualify for this check.",
      nodes_threshold: "The number of nodes that need to be found to raise an issue."
    ]
  ]
  @default_params [
    mass_threshold: 40,
    nodes_threshold: 2,
    excluded_macros: []
  ]

  alias Credo.Check.CodeHelper
  alias Credo.Issue
  alias Credo.SourceFile
<commit_msg>Added description for the 'excluded_macros' parameter on the check for duplicated code<commit_after>defmodule Credo.Check.Design.DuplicatedCode do
  @moduledoc """
  Code should not be copy-pasted in a codebase when there is room to abstract
  the copied functionality in a meaningful way.

  That said, you should by no means "ABSTRACT ALL THE THINGS!".

  Sometimes it can serve a purpose to have code be explicit in two places, even
  if it means the snippets are nearly identical. A good example for this are
  Database Adapters in a project like Ecto, where you might have nearly
  identical functions for things like `order_by` or `limit` in both the
  Postgres and MySQL adapters.

  In this case, introducing an `AbstractAdapter` just to avoid code duplication
  might cause more trouble down the line than having a bit of duplicated code.

  Like all `Software Design` issues, this is just advice and might not be
  applicable to your project/situation.
  """

  @explanation [
    check: @moduledoc,
    params: [
      mass_threshold:
        "The minimum mass which a part of code has to have to qualify for this check.",
      nodes_threshold: "The number of nodes that need to be found to raise an issue.",
      excluded_macros: "List of macros to be excluded from this check."
    ]
  ]
  @default_params [
    mass_threshold: 40,
    nodes_threshold: 2,
    excluded_macros: []
  ]

  alias Credo.Check.CodeHelper
  alias Credo.Issue
  alias Credo.SourceFile

{'fraction_non_alphanumeric': 0.05167498218104063, 'fraction_numerical': 0.0021382751247327157, 'mean_word_length': 3.4768740031897925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '356729', 'n_tokens_mistral': 804, 'n_tokens_neox': 756, 'n_words': 383}