Skip to content

Commit

Permalink
Allow repo with only a dotnet-tools.json file
Browse files Browse the repository at this point in the history
Allow a repository to only contain a `dotnet-tools.json` file for .NET dependabot updates.
Resolves dependabot#9408.
  • Loading branch information
martincostello committed Apr 2, 2024
1 parent 866b76f commit e98ce35
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nuget/lib/dependabot/nuget/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ def self.required_files_in?(filenames)
return true if filenames.any? { |f| f.end_with?(".sln") }
return true if filenames.any? { |f| f.match?("^src$") }
return true if filenames.any? { |f| f.end_with?(".proj") }
return true if filenames.any? { |f| f.match?(/^dotnet\-tools\.json$/i) }

filenames.any? { |name| name.match?(/\.(cs|vb|fs)proj$/) }
end

sig { override.returns(String) }
def self.required_files_message
"Repo must contain a .proj file, .(cs|vb|fs)proj file, or a packages.config."
"Repo must contain a .proj file, .(cs|vb|fs)proj file, a packages.config, or a dotnet-tools.json."
end

sig do
Expand Down Expand Up @@ -70,7 +71,7 @@ def fetch_files
Pathname.new(fetched_file.directory).join(fetched_file.name).cleanpath.to_path
end

if project_files.none? && packages_config_files.none?
if project_files.none? && packages_config_files.none? && dotnet_tools_json.nil?
raise T.must(@missing_sln_project_file_errors.first) if @missing_sln_project_file_errors&.any?

raise_dependency_file_not_found
Expand Down

0 comments on commit e98ce35

Please sign in to comment.