PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: dashbitco/nimble_options (elixir)

Issue:
Proposal: add `integer` type
I was surprised to find that only `:non_neg_integer` and `:pos_integer` were supported, but this seems like a pretty common type that should be included by default. Thoughts?

Pull request:
add `:integer` type
Resolves #42 

Patch:
diff --git a/lib/nimble_options.ex b/lib/nimble_options.ex
index d2ac608..c878d7f 100644
--- a/lib/nimble_options.ex
+++ b/lib/nimble_options.ex
@@ -83,6 +83,8 @@ defmodule NimbleOptions do
 
     * `:boolean` - A boolean.
 
+    * `:integer` - An integer.
+
     * `:non_neg_integer` - A non-negative integer.
 
     * `:pos_integer` - A positive integer.
@@ -174,6 +176,7 @@ defmodule NimbleOptions do
     :keyword_list,
     :non_empty_keyword_list,
     :atom,
+    :integer,
     :non_neg_integer,
     :pos_integer,
     :mfa,
@@ -336,6 +339,10 @@ defmodule NimbleOptions do
     end
   end
 
+  defp validate_type(:integer, key, value) when not is_integer(value) do
+    error_tuple("expected #{inspect(key)} to be an integer, got: #{inspect(value)}")
+  end
+
   defp validate_type(:non_neg_integer, key, value) when not is_integer(value) or value < 0 do
     error_tuple("expected #{inspect(key)} to be a non negative integer, got: #{inspect(value)}")
   end


Test patch:
diff --git a/test/nimble_options_test.exs b/test/nimble_options_test.exs
index 84d4aaf..627820d 100644
--- a/test/nimble_options_test.exs
+++ b/test/nimble_options_test.exs
@@ -34,7 +34,7 @@ defmodule NimbleOptionsTest do
       Reason: invalid option type :foo.
 
       Available types: :any, :keyword_list, :non_empty_keyword_list, :atom, \
-      :non_neg_integer, :pos_integer, :mfa, :mod_arg, :string, :boolean, :timeout, \
+      :integer, :non_neg_integer, :pos_integer, :mfa, :mod_arg, :string, :boolean, :timeout, \
       :pid, {:fun, arity}, {:one_of, choices}, {:custom, mod, fun, args} (in options [:stages])\
       """
 
@@ -187,6 +187,29 @@ defmodule NimbleOptionsTest do
                 }}
     end
 
+    test "valid integer" do
+      schema = [min_demand: [type: :integer]]
+      opts = [min_demand: 12]
+
+      assert NimbleOptions.validate(opts, schema) == {:ok, opts}
+    end
+
+    test "invalid integer" do
+      schema = [min_demand: [type: :integer]]
+
+      assert NimbleOptions.validate([min_demand: 1.5], schema) ==
+               {:error,
+                %ValidationError{
+                  message: "expected :min_demand to be an integer, got: 1.5"
+                }}
+
+      assert NimbleOptions.validate([min_demand: :an_atom], schema) ==
+               {:error,
+                %ValidationError{
+                  message: "expected :min_demand to be an integer, got: :an_atom"
+                }}
+    end
+
     test "valid non negative integer" do
       schema = [min_demand: [type: :non_neg_integer]]
       opts = [min_demand: 0]