diff --git a/.check.exs b/.check.exs index bc4974c..4656abb 100644 --- a/.check.exs +++ b/.check.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + [ ## all available options with default values (see `mix check` docs for description) # parallel: true, @@ -5,6 +9,7 @@ ## list of tools (see `mix check` docs for defaults) tools: [ - {:doctor, false} + {:doctor, false}, + {:reuse, command: ["pipx", "run", "reuse", "lint", "-q"]} ] ] diff --git a/.credo.exs b/.credo.exs index 25624ef..80b173c 100644 --- a/.credo.exs +++ b/.credo.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + # This file contains the configuration for Credo and you are probably reading # this after creating it with `mix credo.gen.config`. # diff --git a/.formatter.exs b/.formatter.exs index d2cda26..1f46000 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + # Used by "mix format" [ inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 597c8ec..c0fc5ec 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + --- updates: - directory: / diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index 4e43ecf..2399d95 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + name: CI on: push: @@ -15,3 +19,4 @@ jobs: with: spark-formatter: false spark-cheat-sheets: false + reuse: true diff --git a/.gitignore b/.gitignore index 3c37a21..c3d3045 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + # The directory Mix will write compiled artifacts to. /_build/ diff --git a/.tool-versions b/.tool-versions index 626f673..fa20ca9 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,3 @@ erlang 27.0.1 elixir 1.18.4 +pipx 1.8.0 diff --git a/.tool-versions.license b/.tool-versions.license new file mode 100644 index 0000000..9d4120b --- /dev/null +++ b/.tool-versions.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 Zach Daniel + +SPDX-License-Identifier: MIT diff --git a/CHANGELOG.md b/CHANGELOG.md index 5556b4a..e1e115a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ + + # Change Log All notable changes to this project will be documented in this file. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 4275fd0..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 Zachary Scott Daniel - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..d817195 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index c8b308b..3ea07b8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ + +[![CI](https://github.com/ash-project/usage_rules/actions/workflows/elixir.yml/badge.svg)](https://github.com/ash-project/usage_rules/actions/workflows/elixir.yml) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Hex version badge](https://img.shields.io/hexpm/v/usage_rules.svg)](https://hex.pm/packages/usage_rules) +[![Hexdocs badge](https://img.shields.io/badge/docs-hexdocs-purple)](https://hexdocs.pm/usage_rules) +[![REUSE status](https://api.reuse.software/badge/github.com/ash-project/usage_rules)](https://api.reuse.software/info/github.com/ash-project/usage_rules) + # UsageRules **UsageRules** is a development tool for Elixir projects that: diff --git a/config/config.exs b/config/config.exs index 8bca5fb..fe85300 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + import Config if Mix.env() == :dev do diff --git a/lib/mix/tasks/usage_rules.docs.ex b/lib/mix/tasks/usage_rules.docs.ex index 5128a16..5a17047 100644 --- a/lib/mix/tasks/usage_rules.docs.ex +++ b/lib/mix/tasks/usage_rules.docs.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.UsageRules.Docs do use Mix.Task diff --git a/lib/mix/tasks/usage_rules.install.ex b/lib/mix/tasks/usage_rules.install.ex index fed6def..dc3610c 100644 --- a/lib/mix/tasks/usage_rules.install.ex +++ b/lib/mix/tasks/usage_rules.install.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.UsageRules.Install.Docs do @moduledoc false diff --git a/lib/mix/tasks/usage_rules.search_docs.ex b/lib/mix/tasks/usage_rules.search_docs.ex index efe787a..10d2a13 100644 --- a/lib/mix/tasks/usage_rules.search_docs.ex +++ b/lib/mix/tasks/usage_rules.search_docs.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.UsageRules.SearchDocs do use Mix.Task # This will eventually be replaced with something like `mix hex.docs.search` ideally diff --git a/lib/mix/tasks/usage_rules.sync.ex b/lib/mix/tasks/usage_rules.sync.ex index ab8bd14..9b935fc 100644 --- a/lib/mix/tasks/usage_rules.sync.ex +++ b/lib/mix/tasks/usage_rules.sync.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.UsageRules.Sync.Docs do @moduledoc false @@ -304,7 +308,8 @@ if Code.ensure_loaded?(Igniter) do link_to_folder && is_nil(igniter.args.positional[:file]) -> Igniter.add_issue(igniter, "--link-to-folder option requires a file to write to") - # If no packages are given and neither --list nor --all nor --remove nor --remove-missing nor --folder-only is set, add error + # If no packages are given and neither --list nor --all nor --remove nor --remove-missing nor --folder-only is + # set, add error Enum.empty?(provided_packages) && !all_option && !list_option && !remove_option && !remove_missing_option && !folder_only -> add_usage_error(igniter) @@ -846,13 +851,12 @@ if Code.ensure_loaded?(Igniter) do section_names = rules - |> Enum.map(fn {_name, _path, sub_rule} -> + |> Enum.map_join(", ", fn {_name, _path, sub_rule} -> case sub_rule do nil -> to_string(package_name) sub_rule_name -> "#{package_name}:#{sub_rule_name}" end end) - |> Enum.join(", ") acc |> Igniter.add_notice( diff --git a/lib/usage_rules.ex b/lib/usage_rules.ex index 5fdb388..5934450 100644 --- a/lib/usage_rules.ex +++ b/lib/usage_rules.ex @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule UsageRules do @moduledoc """ Tools for gathering usage rules from dependencies for projects. diff --git a/mix.exs b/mix.exs index 509cf26..9318835 100644 --- a/mix.exs +++ b/mix.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule UsageRules.MixProject do use Mix.Project @@ -28,17 +32,20 @@ defmodule UsageRules.MixProject do defp package do [ - name: :usage_rules, + maintainers: [ + "Zach Daniel " + ], licenses: ["MIT"], maintainers: "Zach Daniel", files: ~w(lib .formatter.exs mix.exs README* LICENSE* CHANGELOG* usage-rules usage-rules.md), links: %{ - "GitHub" => @source_url, + "GitHub" => "https://github.com/ash-project/usage_rules", + "Changelog" => "https://github.com/ash-project/usage_rules/blob/main/CHANGELOG.md", "Discord" => "https://discord.gg/HTHRaaVPUc", "Website" => "https://ash-hq.org", - "Forum" => "https://elixirforum.com/c/ash-framework-forum/", - "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md" + "Forum" => "https://elixirforum.com/c/elixir-framework-forums/ash-framework-forum", + "REUSE Compliance" => "https://api.reuse.software/info/github.com/ash-project/usage_rules" } ] end diff --git a/mix.lock.license b/mix.lock.license new file mode 100644 index 0000000..9d4120b --- /dev/null +++ b/mix.lock.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 Zach Daniel + +SPDX-License-Identifier: MIT diff --git a/test/mix/tasks/usage_rules.sync_test.exs b/test/mix/tasks/usage_rules.sync_test.exs index 6479fb8..b725f56 100644 --- a/test/mix/tasks/usage_rules.sync_test.exs +++ b/test/mix/tasks/usage_rules.sync_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule Mix.Tasks.UsageRules.SyncTest do use ExUnit.Case, async: true import Igniter.Test @@ -80,7 +84,7 @@ defmodule Mix.Tasks.UsageRules.SyncTest do {:error, [error_message]} -> assert String.contains?( error_message, - "Cannot specify packages when using --all or --list options" + "Cannot specify packages when using --all option" ) result -> @@ -146,8 +150,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -191,8 +195,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -434,8 +438,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -504,8 +508,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -559,8 +563,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -600,8 +604,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -723,8 +727,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -776,8 +780,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -877,8 +881,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -908,8 +912,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -943,8 +947,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -1013,8 +1017,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -1052,8 +1056,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -1181,8 +1185,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -1236,8 +1240,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. @@ -1296,8 +1300,8 @@ defmodule Mix.Tasks.UsageRules.SyncTest do # Usage Rules - **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. - Before attempting to use any of these packages or to discover if you should use them, review their + **IMPORTANT**: Consult these usage rules early and often when working with the packages listed below. + Before attempting to use any of these packages or to discover if you should use them, review their usage rules to understand the correct patterns, conventions, and best practices. diff --git a/test/test_helper.exs b/test/test_helper.exs index 869559e..2a10459 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + ExUnit.start() diff --git a/test/usage_rules_test.exs b/test/usage_rules_test.exs index 9e212a6..fce8b74 100644 --- a/test/usage_rules_test.exs +++ b/test/usage_rules_test.exs @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 Zach Daniel +# +# SPDX-License-Identifier: MIT + defmodule UsageRulesTest do use ExUnit.Case end diff --git a/usage-rules.md.license b/usage-rules.md.license new file mode 100644 index 0000000..9d4120b --- /dev/null +++ b/usage-rules.md.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 Zach Daniel + +SPDX-License-Identifier: MIT diff --git a/usage-rules/elixir.md.license b/usage-rules/elixir.md.license new file mode 100644 index 0000000..9d4120b --- /dev/null +++ b/usage-rules/elixir.md.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 Zach Daniel + +SPDX-License-Identifier: MIT diff --git a/usage-rules/otp.md.license b/usage-rules/otp.md.license new file mode 100644 index 0000000..9d4120b --- /dev/null +++ b/usage-rules/otp.md.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2025 Zach Daniel + +SPDX-License-Identifier: MIT